<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="nfdi4health-pr-mds-registry" />
  <url value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
  <version value="0.9" />
  <name value="NFDI4Health_PR_MDS_Registry" />
  <title value="NFDI4Health PR MDS Registry" />
  <status value="draft" />
  <publisher value="NFDI4Health" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="https://www.nfdi4health.de" />
    </telecom>
  </contact>
  <description value="Group of items applicable only to registries." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <mapping>
    <identity value="objimpl" />
    <uri value="http://hl7.org/fhir/object-implementation" />
    <name value="Object Implementation Information" />
  </mapping>
  <mapping>
    <identity value="NFDI4Health" />
    <name value="NFDI4Health to FHIR Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Library" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Library" />
  <derivation value="constraint" />
  <differential>
    <element id="Library">
      <path value="Library" />
      <constraint>
        <key value="biosamples-a" />
        <severity value="error" />
        <human value="0..*, if Design.dataSource.general == 'C70699'" />
        <expression value="extension.extension.where(url='general').valueCoding.where(code = 'C70699').exists() implies extension.extension.where(url='biosamples').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="biosamples-b" />
        <severity value="error" />
        <human value="0..0, if Design.dataSource.general != 'C70699'" />
        <expression value="extension.extension.where(url='general').valueCoding.where(code = 'C70699').exists().not() implies extension.extension.where(url='biosamples').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="imaging-a" />
        <severity value="error" />
        <human value="0..*, if Design.dataSource.general == '031'" />
        <expression value="extension.extension.where(url='general').valueCoding.where(code = '031').exists() implies extension.where(url='https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-radiomics').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="imaging-b" />
        <severity value="error" />
        <human value="0..0, if Design.dataSource.general != '031'" />
        <expression value="extension.extension.where(url='general').valueCoding.where(code = '031').exists().not() implies extension.where(url='https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-radiomics').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="omics-a" />
        <severity value="error" />
        <human value="0..*, if Design.dataSource.general == '033'" />
        <expression value="extension.extension.where(url='general').valueCoding.where(code = '033').exists() implies extension.extension.where(url='omics').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="omics-b" />
        <severity value="error" />
        <human value="0..0, if Design.dataSource.general != '033'" />
        <expression value="extension.extension.where(url='general').valueCoding.where(code = '033').exists().not() implies extension.extension.where(url='omics').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="supportingInformation-a" />
        <severity value="error" />
        <human value="Cardinality: 0..*, if Design.dataSharingPlan.generally == '373066001'" />
        <expression value="extension.extension.where(url='generally').valueCoding.where(code = '373066001').exists() implies extension.extension.where(url='supportingInformation').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="supportingInformation-b" />
        <severity value="error" />
        <human value="Cardinality: 0..0, if Design.dataSharingPlan.generally != '373066001'" />
        <expression value="extension.extension.where(url='generally').valueCoding.where(code = '373066001').exists().not() implies extension.extension.where(url='supportingInformation').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="timeFrame-a" />
        <severity value="error" />
        <human value="Cardinality: 0..*, if Design.dataSharingPlan.generally == '373066001'" />
        <expression value="extension.extension.where(url='generally').valueCoding.where(code = '373066001').exists() implies extension.extension.where(url='timeFrame').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="timeFrame-b" />
        <severity value="error" />
        <human value="Cardinality: 0..0, if Design.dataSharingPlan.generally != '373066001'" />
        <expression value="extension.extension.where(url='generally').valueCoding.where(code = '373066001').exists().not() implies extension.extension.where(url='timeFrame').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="accessCriteria-a" />
        <severity value="error" />
        <human value="Cardinality: 0..*, if Design.dataSharingPlan.generally == '373066001'" />
        <expression value="extension.extension.where(url='generally').valueCoding.where(code = '373066001').exists() implies extension.extension.where(url='accessCriteria').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="accessCriteria-b" />
        <severity value="error" />
        <human value="Cardinality: 0..0, if Design.dataSharingPlan.generally != '373066001'" />
        <expression value="extension.extension.where(url='generally').valueCoding.where(code = '373066001').exists().not() implies extension.extension.where(url='accessCriteria').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="recordLinkage-a" />
        <severity value="error" />
        <human value="Cardinality: 1..1, if Design.dataSharingPlan.recordLinkage == 'Yes'" />
        <expression value="extension.extension.where(url='recordLinkage').where(value=true).exists()  implies extension.where(url='https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-record-linkage').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="recordLinkage-b" />
        <severity value="error" />
        <human value="Cardinality: 0..0, if Design.dataSharingPlan.recordLinkage == 'No'" />
        <expression value="extension.extension.where(url='recordLinkage').where(value=false).exists() implies extension.where(url='https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-record-linkage').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="legalBasisDetails-a" />
        <severity value="error" />
        <human value="Cardinality: 1..1, if RecordLinkage.legalBasis == 'True'" />
        <expression value="extension.extension.where(url='legalBasis').where(value=true).exists() implies extension.extension.where(url='legalBasisDetails').exists()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <constraint>
        <key value="legalBasisDetails-b" />
        <severity value="error" />
        <human value="Cardinality: 0..0, if RecordLinkage.legalBasis == 'False'" />
        <expression value="extension.extension.where(url='legalBasis').where(value=false).exists() implies extension.extension.where(url='legalBasisDetails').exists().not()" />
        <source value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-registry" />
      </constraint>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design" />
      </mapping>
    </element>
    <element id="Library.extension">
      <path value="Library.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <min value="5" />
    </element>
    <element id="Library.extension:groupsOfDiseases">
      <path value="Library.extension" />
      <sliceName value="groupsOfDiseases" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-groups-of-diseases" />
      </type>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.groupsOfDiseases" />
      </mapping>
    </element>
    <element id="Library.extension:ethicsCommitteeApproval">
      <path value="Library.extension" />
      <sliceName value="ethicsCommitteeApproval" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-library-ethics-approval" />
      </type>
    </element>
    <element id="Library.extension:keywords">
      <path value="Library.extension" />
      <sliceName value="keywords" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-keywords" />
      </type>
    </element>
    <element id="Library.extension:descriptions">
      <path value="Library.extension" />
      <sliceName value="descriptions" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-descriptions" />
      </type>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Resource.descriptions" />
      </mapping>
    </element>
    <element id="Library.extension:dataSource">
      <path value="Library.extension" />
      <sliceName value="dataSource" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-data-source" />
      </type>
    </element>
    <element id="Library.extension:subject">
      <path value="Library.extension" />
      <sliceName value="subject" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-subject" />
      </type>
    </element>
    <element id="Library.extension:outcomes">
      <path value="Library.extension" />
      <sliceName value="outcomes" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-library-outcomes" />
      </type>
    </element>
    <element id="Library.extension:assessments">
      <path value="Library.extension" />
      <sliceName value="assessments" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-assessments" />
      </type>
    </element>
    <element id="Library.extension:dataSharingPlan">
      <path value="Library.extension" />
      <sliceName value="dataSharingPlan" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-data-sharing-plan" />
      </type>
    </element>
    <element id="Library.extension:dataProviders">
      <path value="Library.extension" />
      <sliceName value="dataProviders" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-library-data-providers" />
      </type>
    </element>
    <element id="Library.extension:dataProvidersNumber">
      <path value="Library.extension" />
      <sliceName value="dataProvidersNumber" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-library-data-providers-number" />
      </type>
    </element>
    <element id="Library.extension:population">
      <path value="Library.extension" />
      <sliceName value="population" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-library-population" />
      </type>
    </element>
    <element id="Library.extension:recordLinkage">
      <path value="Library.extension" />
      <sliceName value="recordLinkage" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-record-linkage" />
      </type>
    </element>
    <element id="Library.identifier">
      <path value="Library.identifier" />
      <short value="Alternative identifiers" />
      <definition value="Group of items providing information about identifiers (IDs) assigned to the given [RESOURCE] by another registering systems, e.g. a registry of clinical trials or a data repository." />
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Resource.idsAlternative" />
      </mapping>
    </element>
    <element id="Library.identifier.type">
      <path value="Library.identifier.type" />
      <short value="Type of the registry" />
      <definition value="Type/name of the system where the given [RESOURCE] is already registered." />
      <min value="1" />
      <binding>
        <strength value="required" />
        <description value="Value set defining codes to specify the type of a resource identifier." />
        <valueSet value="https://www.nfdi4health.de/fhir/metadataschema/ValueSet/nfdi4health-vs-mds-id-type-nci-local" />
      </binding>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Resource.idsAlternative.scheme" />
      </mapping>
    </element>
    <element id="Library.identifier.value">
      <path value="Library.identifier.value" />
      <definition value="Identifier" />
      <min value="1" />
      <example>
        <label value="Identifier (ID) assigned to the given [RESOURCE] by another registering system, e.g. by a registry of clinical trials or a data repository." />
        <valueString value="ISRCTN91495258" />
      </example>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Resource.idsAlternative.identifier" />
      </mapping>
    </element>
    <element id="Library.status">
      <path value="Library.status" />
      <comment value="The item does not exist in NFDI4Health' MDS. Fixed to 'active' for all studies." />
      <fixedCode value="active" />
    </element>
    <element id="Library.subject[x]">
      <path value="Library.subject[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="Library.subject[x]:subjectReference">
      <path value="Library.subject[x]" />
      <sliceName value="subjectReference" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-group-intended" />
        <targetProfile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-group-actual" />
      </type>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.eligibilityCriteria" />
      </mapping>
    </element>
    <element id="Library.subject[x]:subjectCodeableConcept">
      <path value="Library.subject[x]" />
      <sliceName value="subjectCodeableConcept" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.subject" />
      </mapping>
    </element>
    <element id="Library.description">
      <path value="Library.description" />
      <short value="Additional information about the [RESOURCE]" />
      <definition value="Any additional information about specific aspects of the [RESOURCE] that could not be captured by other fields.." />
      <comment value="Short input help: You can provide here specific aspects of the [RESOURCE] that could not be captured by other fields." />
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.comment" />
      </mapping>
    </element>
    <element id="Library.effectivePeriod">
      <path value="Library.effectivePeriod" />
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.administrativeInformation.startDate" />
      </mapping>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.administrativeInformation.endDate" />
      </mapping>
    </element>
    <element id="Library.effectivePeriod.start">
      <path value="Library.effectivePeriod.start" />
      <short value="Start date" />
      <definition value="Start date of data collection for the [RESOURCE]." />
      <comment value="Additional information: Preferred date format: DD.MM.YYYY. | Short input help: In case of a planned [RESOURCE], enter the intended start date. In case of an ongoing [RESOURCE], enter the actual start date." />
    </element>
    <element id="Library.effectivePeriod.end">
      <path value="Library.effectivePeriod.end" />
      <short value="End date" />
      <definition value="In case of a [RESOURCE] with patients or other participants, it is the date when the last participant is examined or receives an intervention, or the date of the last participant's last visit." />
      <comment value="Additional information: Preferred date format: DD.MM.YYYY. | Short input help: In case of a planned or ongoing [RESOURCE], enter the intended end date. In case of a completed [RESOURCE], enter the actual end date." />
    </element>
    <element id="Library.topic">
      <path value="Library.topic" />
      <short value="Primary focus of the [RESOURCE]" />
      <definition value="Group of items providing information about the focus of the [RESOURCE] (e.g. medication, food, therapy, device, etc.)." />
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.focus" />
      </mapping>
    </element>
    <element id="Library.topic.coding.extension">
      <path value="Library.topic.coding.extension" />
      <min value="1" />
    </element>
    <element id="Library.topic.coding.extension:codeableConcept">
      <path value="Library.topic.coding.extension" />
      <sliceName value="codeableConcept" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-ex-mds-codeableconcept" />
      </type>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.focus.code" />
      </mapping>
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.focus.classification" />
      </mapping>
    </element>
    <element id="Library.topic.text">
      <path value="Library.topic.text" />
      <short value="Focus area" />
      <definition value="Focus area of the [RESOURCE] (e.g. medication, food, therapy, device, etc.)." />
      <comment value="Additional Information: The use of terms from established terminologies/classifications (e.g. SNOMED CT, ICD, etc.) is preferred. However, also self-assigned terms are allowed. | Short input help: Preferably, use terms from SNOMED CT (https://browser.ihtsdotools.org)." />
      <min value="1" />
      <mapping>
        <identity value="NFDI4Health" />
        <map value="Design.focus.label" />
      </mapping>
    </element>
    <element id="Library.relatedArtifact">
      <path value="Library.relatedArtifact" />
      <max value="1" />
      <type>
        <code value="RelatedArtifact" />
        <profile value="https://www.nfdi4health.de/fhir/metadataschema/StructureDefinition/nfdi4health-pr-mds-related-artifact-resource" />
      </type>
    </element>
  </differential>
</StructureDefinition>