{
  "resourceType": "StructureDefinition",
  "id": "ncdhc-observation-edb-consistent-lmp-us",
  "url": "http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-observation-edb-consistent-lmp-us",
  "version": "dv1.0.0",
  "name": "NCDHCEDBConsistentLastMenstrualPeriodUltrasoundScanObservation",
  "title": "NCDHC EDB Consistent between Last Menstrual Period and antenatal Ultrasound Scan Observation",
  "status": "draft",
  "date": "2020-03-20",
  "publisher": "National Children's Digital Health Collaborative (NCDHC)",
  "description": "NCDHC Estimated Date of Birth consistent between Last Menstrual Period and Antenatal Ultrasound Scan Observation",
  "copyright": "Copyright © 2020 Australian Digital Health Agency - All rights reserved. This content is licensed under a Creative Commons Attribution 4.0 International License. See https://creativecommons.org/licenses/by/4.0/",
  "fhirVersion": "3.0.2",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-observation-base",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "short": "NCDHC EDB Consistent between Last Menstrual Period and antenatal Ultrasound Scan Observation",
        "constraint": [
          {
            "key": "inv-obs-edblmpus-001",
            "severity": "error",
            "human": "There is at most one related Estimated Date of Birth from Last Period observation",
            "expression": "related.target.resolve().code.coding.where(system='http://snomed.info/sct' and code='289206005').count()<2"
          },
          {
            "key": "inv-obs-edblmpus-002",
            "severity": "error",
            "human": "There is at most one related Obsteteric Ultrasound Scan observation",
            "expression": "related.target.resolve().code.coding.where(system='http://snomed.info/sct' and code='268445003').count()<2"
          }
        ]
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "mustSupport": true
      },
      {
        "id": "Observation.code.coding",
        "path": "Observation.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "closed"
        },
        "min": 1
      },
      {
        "id": "Observation.code.coding:EstimatedDateDeliverySNOMED-CT",
        "path": "Observation.code.coding",
        "sliceName": "EstimatedDateDeliverySNOMED-CT",
        "min": 1,
        "max": "1",
        "patternCoding": {
          "system": "http://snomed.info/sct",
          "code": "1377101000168100"
        }
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-patient-expectant-mother"
          }
        ]
      },
      {
        "id": "Observation.value[x]:valueCodeableConcept",
        "path": "Observation.valueCodeableConcept",
        "sliceName": "valueCodeableConcept",
        "short": "Statement about what was observed.",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSetUri": "http://hl7.org.au/fhir/ch/v1/ValueSet/ncdhc-generic-yes-no-1"
        }
      },
      {
        "id": "Observation.related.target",
        "path": "Observation.related.target",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-observation-estimated-date-birth-last-period"
          },
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-observation-ultrasound-scan-obstetric"
          }
        ]
      }
    ]
  }
}