{
  "resourceType": "StructureDefinition",
  "url": "http://ihis.sg/profile/G1",
  "name": "G1",
  "status": "active",
  "fhirVersion": "4.3.0",
  "kind": "resource",
  "abstract": false,
  "type": "Goal",
  "baseDefinition": "http://ihis.sg/StructureDefinition/putHealthplanGoal",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Goal.lifecycleStatus",
        "path": "Goal.lifecycleStatus",
        "fixedCode": "active"
      },
      {
        "id": "Goal.description.coding",
        "path": "Goal.description.coding",
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://ihis.sg/ValueSet/hsg-health-goal"
        }
      },
      {
        "id": "Goal.description.coding.code",
        "path": "Goal.description.coding.code",
        "fixedCode": "G1"
      },
      {
        "id": "Goal.target",
        "path": "Goal.target",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "measure.coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Goal.target.extension",
        "path": "Goal.target.extension",
        "max": "0"
      },
      {
        "id": "Goal.target.measure.id",
        "path": "Goal.target.measure.id",
        "max": "0"
      },
      {
        "id": "Goal.target.measure.extension",
        "path": "Goal.target.measure.extension",
        "max": "0"
      },
      {
        "id": "Goal.target.measure.coding",
        "path": "Goal.target.measure.coding",
        "max": "1"
      },
      {
        "id": "Goal.target.measure.coding.code",
        "path": "Goal.target.measure.coding.code",
        "constraint": [
          {
            "key": "g1-1",
            "severity": "error",
            "human": "If present, G1 goal measure allowed values are GM001, GM008",
            "expression": "($this in ('GM001' | 'GM008'))"
          }
        ]
      },
      {
        "id": "Goal.target.detail[x]",
        "path": "Goal.target.detail[x]",
        "binding": {
          "strength": "required",
          "valueSet": "http://unitsofmeasure.org"
        }
      },
      {
        "id": "Goal.target:GM001",
        "path": "Goal.target",
        "sliceName": "GM001",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Goal.target:GM001.measure.coding",
        "path": "Goal.target.measure.coding",
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://ihis.sg/ValueSet/hsg-goal-measure"
        }
      },
      {
        "id": "Goal.target:GM001.measure.coding.code",
        "path": "Goal.target.measure.coding.code",
        "fixedCode": "GM001"
      },
      {
        "id": "Goal.target:GM001.measure.text",
        "path": "Goal.target.measure.text",
        "max": "0"
      },
      {
        "id": "Goal.target:GM001.detail[x]",
        "path": "Goal.target.detail[x]",
        "min": 1,
        "type": [
          {
            "code": "Quantity"
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://unitsofmeasure.org"
        }
      },
      {
        "id": "Goal.target:GM001.detail[x].value",
        "path": "Goal.target.detail[x].value",
        "min": 1,
        "minValueDecimal": 1.0,
        "maxValueDecimal": 999.9
      },
      {
        "id": "Goal.target:GM001.detail[x].system",
        "path": "Goal.target.detail[x].system",
        "min": 1,
        "fixedUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Goal.target:GM001.detail[x].code",
        "path": "Goal.target.detail[x].code",
        "min": 1,
        "fixedCode": "kg"
      },
      {
        "id": "Goal.target:GM001.due[x]",
        "path": "Goal.target.due[x]",
        "max": "0",
        "type": [
          {
            "code": "Duration"
          }
        ]
      },
      {
        "id": "Goal.target:GM008",
        "path": "Goal.target",
        "sliceName": "GM008",
        "max": "1"
      },
      {
        "id": "Goal.target:GM008.measure.coding",
        "path": "Goal.target.measure.coding",
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://ihis.sg/ValueSet/hsg-goal-measure"
        }
      },
      {
        "id": "Goal.target:GM008.measure.coding.code",
        "path": "Goal.target.measure.coding.code",
        "fixedCode": "GM008"
      },
      {
        "id": "Goal.target:GM008.measure.text",
        "path": "Goal.target.measure.text",
        "max": "0"
      },
      {
        "id": "Goal.target:GM008.detail[x]",
        "path": "Goal.target.detail[x]",
        "min": 1,
        "type": [
          {
            "code": "Quantity"
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://unitsofmeasure.org"
        }
      },
      {
        "id": "Goal.target:GM008.detail[x].value",
        "path": "Goal.target.detail[x].value",
        "min": 1,
        "minValueDecimal": 1.0,
        "maxValueDecimal": 999.9
      },
      {
        "id": "Goal.target:GM008.detail[x].system",
        "path": "Goal.target.detail[x].system",
        "min": 1,
        "fixedUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Goal.target:GM008.detail[x].code",
        "path": "Goal.target.detail[x].code",
        "min": 1,
        "fixedCode": "kg"
      },
      {
        "id": "Goal.target:GM008.due[x]",
        "path": "Goal.target.due[x]",
        "min": 1,
        "type": [
          {
            "code": "Duration"
          }
        ]
      },
      {
        "id": "Goal.target:GM008.due[x].value",
        "path": "Goal.target.due[x].value",
        "min": 1,
        "minValueDecimal": 1.0,
        "maxValueDecimal": 12.0,
        "constraint": [
          {
            "key": "gm8-1",
            "severity": "error",
            "human": "Valid numeric value required",
            "expression": "$this.toString().matches('^[0-9]*$')"
          }
        ]
      },
      {
        "id": "Goal.target:GM008.due[x].system",
        "path": "Goal.target.due[x].system",
        "min": 1,
        "fixedUri": "http://unitsofmeasure.org"
      },
      {
        "id": "Goal.target:GM008.due[x].code",
        "path": "Goal.target.due[x].code",
        "min": 1,
        "fixedCode": "mo"
      }
    ]
  }
}