Skip to content

DDI-Lifecycle 4.0 (experimental)

Experimental

DDI-Lifecycle 4.0 is in public review. It is not a final standard. ddigraph reads a 4.0 file only when you name the lifecycle4 flavor: it never detects one. This flavor may change in any release, as the standard does.

What it reads

A DDI-Lifecycle 4.0 file is an ItemContainer in the namespace ddi:instance:4_0. It may list some TopLevelReference elements first. Then come its items:

<ItemContainer xmlns="ddi:instance:4_0">
  <TopLevelReference>
    <URN>urn:ddi:example.org:inst-1:1</URN>
    <Agency>example.org</Agency><ID>inst-1</ID><Version>1</Version>
    <TypeOfObject>Instrument</TypeOfObject>
  </TopLevelReference>
  <Instrument>
    <URN>urn:ddi:example.org:inst-1:1</URN>
    <Agency>example.org</Agency><ID>inst-1</ID><Version>1</Version>
    <InstrumentName xml:lang="en">Health survey</InstrumentName>
    <ControlConstructReference>
      <URN>urn:ddi:example.org:seq-1:1</URN>
      <Agency>example.org</Agency><ID>seq-1</ID><Version>1</Version>
      <TypeOfObject>Sequence</TypeOfObject>
    </ControlConstructReference>
  </Instrument>
</ItemContainer>

The graph has the shape of a DDI-L 3 graph:

  • Items. Each item is a node. Its label is its element name, such as Instrument, CodeList or Category. Its identity is the URN of its Agency, ID and Version.
  • Nested nodes. An element inside an item is a node too when it has its own identity and DDI-L 3 has a label for it. A Code in its CodeList is one. Its parent CONTAINS it, in document order.
  • References. Each reference is a relationship, with the name DDI-L 3 gives it. A ControlConstructReference is HAS_CONSTRUCT, and a ConceptReference is USES_CONCEPT. A reference that is new in 4.0 takes its element name without Reference, in upper case. So a BroaderReference is BROADER.
  • Entry points. A TopLevelReference is a HAS_ENTRY_POINT relationship from the Dataset node, as in DDI-L 3. So is each Instrument and StudyUnit in the file.
  • Resolution. References resolve as in DDI-L 3, by --resolve, and never across agencies. A reference to an item the file does not hold ends at a stub. Its label is the reference's TypeOfObject.
  • Text. Names and labels keep their language, from xml:lang.

Load and validate a file

Name the flavor on each command:

ddigraph validate items.xml --flavor lifecycle4
ddigraph load items.xml --format lifecycle4
ddigraph store add items.xml --flavor lifecycle4

validate checks the file against the bundled 4.0 schema, schemas/ddi-l4/lifecycle40.xsd. Without the flavor, each command stops, since it cannot tell which flavor the file is.

The schema's decimal type has a lowest and a highest value of 29 digits. lxml on Windows cannot read numbers that long, so ddigraph drops those two limits, in memory only and on every system. A decimal still has at most 29 digits.

In Python, give the flavor to ddigraph.ir.parse and write the stream with a lens:

from ddigraph import ir
from ddigraph.lens.memory import MemoryLens

lens = MemoryLens()
lens.write(ir.parse("items.xml", flavor="lifecycle4", dataset_id="items"), dataset_id="items")

What it does not do yet

  • Some properties. It reads each node's label, a category's label and a sequence's count of constructs. A grid's response type is code when one of the grid's dimensions has a code list, and is not set otherwise. 4.0 moves other DDI-L 3 properties into new elements. These are not read yet: a question's text and response type, a measurement's text, a study's title, a code list's count of codes, a category scheme's count of categories, a construct's condition and a variable's kind of representation.
  • Some names. It reads a node's name from the element DDI-L 3 reads it from. Some 4.0 nodes keep their name in another element, such as ArchiveModuleName or DevelopmentActivityName. These names are not read yet: those of Archive, ConceptualComponent, DataCollection, DDIProfile, GenericMap, LogicalProduct, Methodology and PhysicalDataProduct, of the six development activities, and of the access and parameter nodes.
  • Copies of objects. 4.0 writes some references as a copy of the object they name, not as a reference. A CodeReference in a CategoryValue is one: it is a whole Code. So is an element whose name ends in _IdentifiableType, and the LocationValue a LocationValue supersedes or precedes. A copy has no TypeOfObject. ddigraph does not read it: it makes no node and no relationship of the copy or of what it holds.
  • One node in two versions. A node that a DDI-L 3 dataset and a 4.0 dataset both hold keeps a label for each. Most labels are the same in both versions, but 4.0 renames some objects. When each of the node's two names is a label only its own version has, such as a 3.3 CategoryMap that 4.0 calls GenericMap, the node keeps both labels and reads back in each dataset. When both files hold the object, one name is a label both versions have and the other is not, the second write stops with an error, and the first dataset still reads as it was. A 3.3 RecordLayout that 4.0 calls ProprietaryRecordLayout is such a node, since 4.0 has a RecordLayout too. Load those two versions in two databases. A 4.0 file that only refers to such a node is not refused: it reads the node as the RecordLayout the 3.3 dataset holds.
  • Detection. ddigraph detect never returns lifecycle4.