diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4429c00f7..5321c408f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ on: grove_fhir_ref: description: grove-fhir tag or commit carrying the Grove FHIR Implementation Guides contract. type: string - default: 9740cbb9ffbb7d4bc13e7d1628b715391f14b327 + default: ce72a6359b8130a032b1b08fda16e483f9c638ae fhir_only: description: Run only producer conformance against the selected grove-fhir contract. type: boolean @@ -36,7 +36,7 @@ on: grove_fhir_ref: description: grove-fhir tag or commit carrying the Grove FHIR Implementation Guides contract. type: string - default: 9740cbb9ffbb7d4bc13e7d1628b715391f14b327 + default: ce72a6359b8130a032b1b08fda16e483f9c638ae concurrency: group: tests-${{ github.ref }} @@ -287,7 +287,7 @@ jobs: runs-on: macos-latest timeout-minutes: 90 env: - GROVE_FHIR_REF: ${{ inputs.grove_fhir_ref || '9740cbb9ffbb7d4bc13e7d1628b715391f14b327' }} + GROVE_FHIR_REF: ${{ inputs.grove_fhir_ref || 'ce72a6359b8130a032b1b08fda16e483f9c638ae' }} steps: - uses: actions/checkout@v7 with: diff --git a/Scripts/Tests/test_generate_grove_fhir_swift_contract.py b/Scripts/Tests/test_generate_grove_fhir_swift_contract.py index f9a6b2355..9a456616c 100644 --- a/Scripts/Tests/test_generate_grove_fhir_swift_contract.py +++ b/Scripts/Tests/test_generate_grove_fhir_swift_contract.py @@ -1006,6 +1006,57 @@ def test_generates_additional_result_bindings_without_combining_namespaces(self) ) self.assertNotIn('allowedValues: ["lap", "running"]', generated) + def test_generates_the_component_extension_and_each_components_fixed_members(self): + measurement = { + **HEART_RATE, + "quantity": None, + "componentExtension": {"url": "https://example.org/test-details", "slice": "details"}, + "components": [{ + "id": "left-250", + "system": "http://loinc.org", + "code": "91375-6", + "quantity": {"system": UCUM, "code": "dB", "unit": "dB"}, + "extensionValues": [ + {"member": "frequency", "valueQuantity": {"value": 250, "system": UCUM, "code": "Hz"}}, + {"member": "ear", "valueCode": "left"}, + {"member": "masked", "valueBoolean": False}, + ], + }], + } + generated = "\n".join(MODULE.measurement_lines(measurement)) + self.assertIn('componentExtension: ComponentExtensionContract(url: "https://example.org/test-details"),', generated) + self.assertIn( + 'extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "250", ' + 'system: "http://unitsofmeasure.org", code: "Hz"), ' + 'ExtensionValueContract(member: "ear", valueCode: "left"), ' + 'ExtensionValueContract(member: "masked", valueBoolean: false)]),', + generated, + ) + plain = "\n".join(MODULE.measurement_lines(HEART_RATE)) + self.assertIn("componentExtension: nil,", plain) + + def test_rejects_extension_values_it_cannot_type(self): + component = {"id": "left-250", "system": "http://loinc.org", "code": "91375-6"} + base = {**HEART_RATE, "componentExtension": {"url": "https://example.org/test-details"}} + for values, message in [ + ([{"member": "ear", "valueCode": "left", "valueBoolean": True}], "exactly one value"), + ([{"member": "ear"}], "exactly one value"), + ([{"member": "ear", "valueString": "left"}], "exactly one value"), + ([{"member": "ear", "valueCode": 1}], "not a string"), + ([{"member": "masked", "valueBoolean": "false"}], "not a boolean"), + ([{"member": "frequency", "valueQuantity": {"value": True, "system": UCUM, "code": "Hz"}}], "value, system and code"), + ([{"member": "frequency", "valueQuantity": {"value": 250, "code": "Hz"}}], "value, system and code"), + ]: + with self.subTest(values=values), self.assertRaisesRegex(ValueError, message): + MODULE.measurement_lines({**base, "components": [{**component, "extensionValues": values}]}) + with self.assertRaisesRegex(ValueError, "names no component extension"): + MODULE.measurement_lines({ + **HEART_RATE, + "components": [{**component, "extensionValues": [{"member": "ear", "valueCode": "left"}]}], + }) + with self.assertRaisesRegex(ValueError, "without a url"): + MODULE.measurement_lines({**HEART_RATE, "componentExtension": {"slice": "details"}}) + def test_preserves_effective_datetime_or_period_choice(self): catalogs = self.catalogs() catalogs["measurement-catalog.json"]["measurements"] = [ @@ -1121,6 +1172,7 @@ def test_generates_the_body_mass_index_contract_from_its_standard_claim(self): ' quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg/m2", unit: "kg/m2", ' "valueDomain: nil),\n" " components: [],\n" + " componentExtension: nil,\n" " resultCodeSystem: nil,\n" " allowedValues: [],\n" " resultCodes: [],\n" diff --git a/Scripts/check-ig-example-containment.py b/Scripts/check-ig-example-containment.py index c8b67733d..e88a44fd3 100755 --- a/Scripts/check-ig-example-containment.py +++ b/Scripts/check-ig-example-containment.py @@ -63,6 +63,12 @@ "example": "HealthKitMetadataObservationExample", "golden": "guide-example-source-metadata", }, + { + "guide": "healthkit", + "resourceType": "Observation", + "example": "HealthkitAudiogramPanelExample", + "golden": "guide-example-audiogram", + }, ], }, } @@ -70,7 +76,7 @@ NOT_YET_PAIRED = { "healthkit": { "unprojected": { - "Observation/HealthkitAudiogramPanelExample": "Grove does not convert audiograms yet", + "Observation/HealthkitAudiogramPanelExample": "the projection does not invert an audiogram; its golden pairs it", "Observation/HealthkitBiologicalSexExample": "Grove does not convert characteristics yet", "Observation/HealthkitBloodTypeExample": "Grove does not convert characteristics yet", "Observation/HealthkitDateOfBirthExample": "Grove does not convert characteristics yet", diff --git a/Scripts/generate-grove-fhir-swift-contract.py b/Scripts/generate-grove-fhir-swift-contract.py index 7de69e327..2edef9ce8 100755 --- a/Scripts/generate-grove-fhir-swift-contract.py +++ b/Scripts/generate-grove-fhir-swift-contract.py @@ -389,6 +389,49 @@ def coding_contract_expression(coding: dict) -> str: ) +def extension_value_expression(value: dict, label: str) -> str: + """One member a component fixes in its measurement's component extension, with exactly one value.""" + member = value.get("member") + kinds = [key for key in ("valueCode", "valueBoolean", "valueQuantity") if key in value] + if not isinstance(member, str) or len(kinds) != 1 or set(value) != {"member", kinds[0]}: + raise ValueError(f"{label} must fix one member with exactly one value: {value!r}") + rendered = value[kinds[0]] + if kinds[0] == "valueCode": + if not isinstance(rendered, str): + raise ValueError(f"{label} member {member!r} fixes a code that is not a string") + return f"ExtensionValueContract(member: {swift_string(member)}, valueCode: {swift_string(rendered)})" + if kinds[0] == "valueBoolean": + if not isinstance(rendered, bool): + raise ValueError(f"{label} member {member!r} fixes a boolean that is not a boolean") + return f"ExtensionValueContract(member: {swift_string(member)}, valueBoolean: {str(rendered).lower()})" + number = rendered.get("value") if isinstance(rendered, dict) else None + if ( + not isinstance(rendered, dict) + or set(rendered) != {"value", "system", "code"} + or isinstance(number, bool) + or not isinstance(number, (int, float)) + or not isinstance(rendered["system"], str) + or not isinstance(rendered["code"], str) + ): + raise ValueError(f"{label} member {member!r} must fix a quantity's value, system and code: {rendered!r}") + return ( + f"ExtensionValueContract(member: {swift_string(member)}, " + f"valueQuantity: {swift_string(json.dumps(number, allow_nan=False))}, " + f"system: {swift_string(rendered['system'])}, code: {swift_string(rendered['code'])})" + ) + + +def component_extension_expression(measurement: dict) -> str: + """The extension every component of the measurement carries, or `nil` when the catalog names none.""" + extension = measurement.get("componentExtension") + if extension is None: + return "nil" + url = extension.get("url") if isinstance(extension, dict) else None + if not isinstance(url, str): + raise ValueError(f"measurement {measurement['id']!r} names a component extension without a url") + return f"ComponentExtensionContract(url: {swift_string(url)})" + + def measurement_lines( measurement: dict, access: str = "package", profile_expression: str | None = None ) -> list[str]: @@ -427,6 +470,15 @@ def measurement_lines( for result_code in component.get("resultCodes", []) ) result_code_system = component_result_code_system(component) + extension_values = component.get("extensionValues", []) + if extension_values and measurement.get("componentExtension") is None: + raise ValueError( + f"component {component['id']!r} of {measurement['id']!r} fixes extension values, " + "but its measurement names no component extension" + ) + rendered_extension_values = ", ".join( + extension_value_expression(value, f"component {component['id']!r}") for value in extension_values + ) lines.append( " ComponentContract(" f"id: {swift_string(component['id'])}, " @@ -435,11 +487,13 @@ def measurement_lines( f"quantity: {rendered_quantity}, " f"resultCodeSystem: " f"{swift_string(result_code_system) if result_code_system else 'nil'}, " - f"resultCodes: [{rendered_result_codes}])," + f"resultCodes: [{rendered_result_codes}], " + f"extensionValues: [{rendered_extension_values}])," ) lines.append(" ],") else: lines.append(" components: [],") + lines.append(f" componentExtension: {component_extension_expression(measurement)},") result_code_system = measurement.get("resultCodeSystem") lines.append( f" resultCodeSystem: {swift_string(result_code_system) if result_code_system else 'nil'}," @@ -1032,6 +1086,53 @@ def validate_direct_claim(claim: dict, label: str) -> None: " package let quantity: QuantityContract?", " package let resultCodeSystem: String?", " package let resultCodes: [ResultCodeContract]", + " /// The members of the measurement's component extension that the component fixes.", + " package let extensionValues: [ExtensionValueContract]", + "}", + "", + "", + "/// The extension every component of a measurement carries.", + "package struct ComponentExtensionContract: Hashable, Sendable {", + " package let url: String", + "", + " package init(url: String) {", + " self.url = url", + " }", + "}", + "", + "", + "/// One member of a component extension that the catalog fixes for one component.", + "package struct ExtensionValueContract: Hashable, Sendable {", + " /// A fixed member value.", + " package enum Value: Hashable, Sendable {", + " case code(String)", + " case boolean(Bool)", + " case quantity(value: Decimal, system: String, code: String)", + " }", + "", + " package let member: String", + " package let value: Value", + "", + " package init(member: String, valueCode: String) {", + " self.member = member", + " value = .code(valueCode)", + " }", + "", + " package init(member: String, valueBoolean: Bool) {", + " self.member = member", + " value = .boolean(valueBoolean)", + " }", + "", + " package init(member: String, valueQuantity lexical: String, system: String, code: String) {", + " guard let decimal = Decimal(", + " string: lexical,", + " locale: .posix", + " ) else {", + " preconditionFailure(\"Generated extension quantity is not a decimal: \\(lexical)\")", + " }", + " self.member = member", + " value = .quantity(value: decimal, system: system, code: code)", + " }", "}", "", "", @@ -1064,6 +1165,8 @@ def validate_direct_claim(claim: dict, label: str) -> None: " package let requiredCodings: [CodingContract]", " package let quantity: QuantityContract?", " package let components: [ComponentContract]", + " /// The extension every component carries, if the catalog names one.", + " package let componentExtension: ComponentExtensionContract?", " package let resultCodeSystem: String?", " package let allowedValues: [String]", " package let resultCodes: [ResultCodeContract]", diff --git a/Scripts/validate-fhir-conformance.sh b/Scripts/validate-fhir-conformance.sh index c074a60cd..1c2a8d44d 100755 --- a/Scripts/validate-fhir-conformance.sh +++ b/Scripts/validate-fhir-conformance.sh @@ -25,7 +25,7 @@ GUIDES="${GROVE_FHIR_GUIDES:-$(pwd)/.fhir/grove-fhir}" # Grove. An unreleased contract is pinned by its commit alone, with an empty version. # .github/workflows/tests.yml defaults to the same ref. PINNED_GROVE_FHIR_VERSION= -PINNED_GROVE_FHIR_COMMIT=9740cbb9ffbb7d4bc13e7d1628b715391f14b327 +PINNED_GROVE_FHIR_COMMIT=ce72a6359b8130a032b1b08fda16e483f9c638ae GROVE_FHIR_REF="${GROVE_FHIR_REF:-${PINNED_GROVE_FHIR_VERSION:-$PINNED_GROVE_FHIR_COMMIT}}" GUIDE_SOURCE="${GROVE_FHIR_GUIDE_SOURCE:-}" diff --git a/Sources/GroveFHIRContract/Generated.swift b/Sources/GroveFHIRContract/Generated.swift index 79338e621..363f3ccb6 100644 --- a/Sources/GroveFHIRContract/Generated.swift +++ b/Sources/GroveFHIRContract/Generated.swift @@ -418,6 +418,53 @@ package struct ComponentContract: Hashable, Sendable { package let quantity: QuantityContract? package let resultCodeSystem: String? package let resultCodes: [ResultCodeContract] + /// The members of the measurement's component extension that the component fixes. + package let extensionValues: [ExtensionValueContract] +} + + +/// The extension every component of a measurement carries. +package struct ComponentExtensionContract: Hashable, Sendable { + package let url: String + + package init(url: String) { + self.url = url + } +} + + +/// One member of a component extension that the catalog fixes for one component. +package struct ExtensionValueContract: Hashable, Sendable { + /// A fixed member value. + package enum Value: Hashable, Sendable { + case code(String) + case boolean(Bool) + case quantity(value: Decimal, system: String, code: String) + } + + package let member: String + package let value: Value + + package init(member: String, valueCode: String) { + self.member = member + value = .code(valueCode) + } + + package init(member: String, valueBoolean: Bool) { + self.member = member + value = .boolean(valueBoolean) + } + + package init(member: String, valueQuantity lexical: String, system: String, code: String) { + guard let decimal = Decimal( + string: lexical, + locale: .posix + ) else { + preconditionFailure("Generated extension quantity is not a decimal: \(lexical)") + } + self.member = member + value = .quantity(value: decimal, system: system, code: code) + } } @@ -450,6 +497,8 @@ package struct MeasurementContract: Sendable { package let requiredCodings: [CodingContract] package let quantity: QuantityContract? package let components: [ComponentContract] + /// The extension every component carries, if the catalog names one. + package let componentExtension: ComponentExtensionContract? package let resultCodeSystem: String? package let allowedValues: [String] package let resultCodes: [ResultCodeContract] @@ -482,6 +531,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kcal", unit: "kcal", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -499,6 +549,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "Cel", unit: "Cel", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -516,6 +567,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kcal", unit: "kcal", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -533,6 +585,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg/dL", unit: "mg/dL", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -550,9 +603,10 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "systolic", system: "http://loinc.org", code: "8480-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mm[Hg]", unit: "mmHg", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "diastolic", system: "http://loinc.org", code: "8462-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mm[Hg]", unit: "mmHg", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "systolic", system: "http://loinc.org", code: "8480-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mm[Hg]", unit: "mmHg", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "diastolic", system: "http://loinc.org", code: "8462-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mm[Hg]", unit: "mmHg", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -570,6 +624,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -587,6 +642,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "cm", unit: "cm", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -604,6 +660,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "Cel", unit: "Cel", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -621,6 +678,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -638,6 +696,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -655,6 +714,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -672,8 +732,9 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "sensation", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-mobile-measurement", code: "cervical-mucus-sensation", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-cervical-mucus-sensation", resultCodes: [ResultCodeContract(code: "light", display: "Light"), ResultCodeContract(code: "medium", display: "Medium"), ResultCodeContract(code: "heavy", display: "Heavy")]), + ComponentContract(id: "sensation", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-mobile-measurement", code: "cervical-mucus-sensation", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-cervical-mucus-sensation", resultCodes: [ResultCodeContract(code: "light", display: "Light"), ResultCodeContract(code: "medium", display: "Medium"), ResultCodeContract(code: "heavy", display: "Heavy")], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-cervical-mucus-quality", allowedValues: ["dry", "sticky", "creamy", "watery", "egg-white", "unusual", "unknown"], resultCodes: [ @@ -699,6 +760,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "revolutions/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -716,6 +778,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -733,6 +796,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -750,6 +814,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -767,6 +832,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -784,6 +850,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -801,6 +868,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -818,6 +886,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -835,6 +904,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -852,6 +922,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -869,6 +940,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kcal", unit: "kcal", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -886,6 +958,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -903,6 +976,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -920,6 +994,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -937,6 +1012,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -954,6 +1030,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -971,6 +1048,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -988,6 +1066,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1005,6 +1084,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1022,6 +1102,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1039,6 +1120,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1056,6 +1138,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1073,6 +1156,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1090,6 +1174,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1107,6 +1192,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1124,6 +1210,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1141,6 +1228,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1158,6 +1246,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1175,6 +1264,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1192,6 +1282,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1209,6 +1300,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "g", unit: "g", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1226,6 +1318,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1243,6 +1336,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1260,6 +1354,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1277,6 +1372,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1294,6 +1390,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1311,6 +1408,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1328,6 +1426,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1345,6 +1444,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ug", unit: "ug", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1362,6 +1462,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mg", unit: "mg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1379,6 +1480,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1396,6 +1498,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "uS", unit: "uS", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1413,6 +1516,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{flights}", unit: "flights", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1430,6 +1534,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mL", unit: "mL", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1447,6 +1552,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1464,6 +1570,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1481,6 +1588,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1498,6 +1606,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-intermenstrual-bleeding", allowedValues: ["present"], resultCodes: [ @@ -1517,6 +1626,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1534,6 +1644,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1551,8 +1662,9 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "cycleStart", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-mobile-measurement", code: "menstrual-cycle-start", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-menstrual-cycle-start", resultCodes: [ResultCodeContract(code: "cycle-start", display: "Cycle start"), ResultCodeContract(code: "not-cycle-start", display: "Not cycle start")]), + ComponentContract(id: "cycleStart", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-mobile-measurement", code: "menstrual-cycle-start", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-menstrual-cycle-start", resultCodes: [ResultCodeContract(code: "cycle-start", display: "Cycle start"), ResultCodeContract(code: "not-cycle-start", display: "Not cycle start")], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-menstruation-flow", allowedValues: ["unspecified", "light", "medium", "heavy", "none"], resultCodes: [ @@ -1576,6 +1688,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1593,6 +1706,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-ovulation-test-result", allowedValues: ["negative", "high-fertility", "luteinizing-hormone-surge", "indeterminate"], resultCodes: [ @@ -1615,6 +1729,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1632,6 +1747,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1649,6 +1765,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "W", unit: "W", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1666,6 +1783,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1683,6 +1801,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "breaths/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1700,6 +1819,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "breaths/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1719,6 +1839,7 @@ package enum MeasurementCatalog { ], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1736,6 +1857,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-sexual-activity", allowedValues: ["protected", "unprotected", "unknown"], resultCodes: [ @@ -1757,6 +1879,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "Cel", unit: "Cel", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1774,6 +1897,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1791,6 +1915,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "h", unit: "h", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1808,6 +1933,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1825,6 +1951,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-sleep-stage", allowedValues: ["awake", "in-bed", "out-of-bed", "asleep-unspecified", "light", "deep", "rem", "unknown"], resultCodes: [], @@ -1842,6 +1969,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1859,6 +1987,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{steps}", unit: "steps", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1876,6 +2005,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mL/kg/min", unit: "mL/kg/min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1893,6 +2023,7 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{pushes}", unit: "pushes", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -1910,19 +2041,20 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "active-duration", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "active-duration", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "s", unit: "s", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "distance-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "distance-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "active-energy-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "active-energy-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kcal", unit: "kcal", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "heart-rate-avg", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "heart-rate-avg", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "heart-rate-max", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "heart-rate-max", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "heart-rate-min", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "heart-rate-min", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "step-count-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "step-count-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{steps}", unit: "{steps}", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "elevation-gain", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "elevation-gain", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "flights-climbed-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "flights-climbed-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{flights}", unit: "{flights}", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "speed-avg", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "speed-avg", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "swimming-stroke-count-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "swimming-stroke-count-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{strokes}", unit: "{strokes}", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "pool-lap-count", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "pool-lap-count", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{laps}", unit: "{laps}", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "active-duration", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "active-duration", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "s", unit: "s", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "distance-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "distance-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "active-energy-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "active-energy-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kcal", unit: "kcal", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "heart-rate-avg", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "heart-rate-avg", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "heart-rate-max", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "heart-rate-max", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "heart-rate-min", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "heart-rate-min", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "step-count-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "step-count-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{steps}", unit: "{steps}", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "elevation-gain", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "elevation-gain", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "flights-climbed-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "flights-climbed-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{flights}", unit: "{flights}", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "speed-avg", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "speed-avg", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "swimming-stroke-count-sum", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "swimming-stroke-count-sum", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{strokes}", unit: "{strokes}", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "pool-lap-count", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "pool-lap-count", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{laps}", unit: "{laps}", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-activity", allowedValues: ["running", "walking", "cycling", "hiking", "swimming", "strength-training", "high-intensity-interval-training", "yoga", "pilates", "rowing", "elliptical", "stair-climbing", "dancing", "tennis", "table-tennis", "badminton", "squash", "basketball", "soccer", "american-football", "baseball", "volleyball", "golf", "boxing", "martial-arts", "skiing", "snowboarding", "other"], resultCodes: [], @@ -1940,12 +2072,13 @@ package enum MeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "repetitions", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "repetitions", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{count}", unit: "repetitions", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "set-weight", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "set-weight", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "set-index", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "set-index", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{count}", unit: "set index", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "rating-of-perceived-exertion", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "rating-of-perceived-exertion", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "RPE 0-10", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "lap-length", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "lap-length", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "repetitions", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "repetitions", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{count}", unit: "repetitions", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "set-weight", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "set-weight", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "set-index", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "set-index", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{count}", unit: "set index", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "rating-of-perceived-exertion", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "rating-of-perceived-exertion", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "RPE 0-10", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), + ComponentContract(id: "lap-length", system: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-statistic", code: "lap-length", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/mobile/CodeSystem/grove-workout-segment-type", allowedValues: ["lap", "pause", "resume", "motion-paused", "motion-resumed", "pause-or-resume-request", "marker", "segment-generic", "rest", "other-workout", "unknown"], resultCodes: [], @@ -2056,6 +2189,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2073,6 +2207,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2090,6 +2225,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-apple-stand-hour", allowedValues: ["stood", "idle"], resultCodes: [ @@ -2110,6 +2246,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2127,6 +2264,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2144,36 +2282,37 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "left-250", system: "http://loinc.org", code: "91375-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-250", system: "http://loinc.org", code: "91374-9", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-500", system: "http://loinc.org", code: "89024-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-500", system: "http://loinc.org", code: "89025-1", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-750", system: "http://loinc.org", code: "91379-8", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-750", system: "http://loinc.org", code: "91378-0", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-1000", system: "http://loinc.org", code: "89016-0", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-1000", system: "http://loinc.org", code: "89017-8", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-1500", system: "http://loinc.org", code: "91373-1", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-1500", system: "http://loinc.org", code: "91372-3", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-2000", system: "http://loinc.org", code: "89018-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-2000", system: "http://loinc.org", code: "89019-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-3000", system: "http://loinc.org", code: "89020-2", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-3000", system: "http://loinc.org", code: "89021-0", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-4000", system: "http://loinc.org", code: "89022-8", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-4000", system: "http://loinc.org", code: "89023-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-5000", system: "http://loinc.org", code: "91377-2", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-5000", system: "http://loinc.org", code: "91376-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-6000", system: "http://loinc.org", code: "89026-9", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-6000", system: "http://loinc.org", code: "89027-7", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "left-8000", system: "http://loinc.org", code: "89028-5", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), - ComponentContract(id: "right-8000", system: "http://loinc.org", code: "89029-3", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "left-250", system: "http://loinc.org", code: "91375-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "250", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-250", system: "http://loinc.org", code: "91374-9", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "250", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-500", system: "http://loinc.org", code: "89024-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "500", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-500", system: "http://loinc.org", code: "89025-1", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "500", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-750", system: "http://loinc.org", code: "91379-8", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "750", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-750", system: "http://loinc.org", code: "91378-0", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "750", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-1000", system: "http://loinc.org", code: "89016-0", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "1000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-1000", system: "http://loinc.org", code: "89017-8", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "1000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-1500", system: "http://loinc.org", code: "91373-1", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "1500", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-1500", system: "http://loinc.org", code: "91372-3", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "1500", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-2000", system: "http://loinc.org", code: "89018-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "2000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-2000", system: "http://loinc.org", code: "89019-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "2000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-3000", system: "http://loinc.org", code: "89020-2", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "3000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-3000", system: "http://loinc.org", code: "89021-0", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "3000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-4000", system: "http://loinc.org", code: "89022-8", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "4000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-4000", system: "http://loinc.org", code: "89023-6", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "4000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-5000", system: "http://loinc.org", code: "91377-2", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "5000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-5000", system: "http://loinc.org", code: "91376-4", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "5000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-6000", system: "http://loinc.org", code: "89026-9", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "6000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-6000", system: "http://loinc.org", code: "89027-7", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "6000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), + ComponentContract(id: "left-8000", system: "http://loinc.org", code: "89028-5", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "8000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "left")]), + ComponentContract(id: "right-8000", system: "http://loinc.org", code: "89029-3", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB", unit: "dB", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: [ExtensionValueContract(member: "frequency", valueQuantity: "8000", system: "http://unitsofmeasure.org", code: "Hz"), ExtensionValueContract(member: "ear", valueCode: "right")]), ], + componentExtension: ComponentExtensionContract(url: "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test"), resultCodeSystem: nil, allowedValues: [], resultCodes: [], additionalResultBindings: [], method: nil, methodChoice: [], - effective: .dateTime, + effective: .dateTimeOrPeriod, category: nil ) @@ -2184,6 +2323,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-biological-sex", allowedValues: ["female", "male", "other"], resultCodes: [ @@ -2205,6 +2345,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -2222,6 +2363,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-bleeding-after-menopause", allowedValues: ["unspecified", "light", "medium", "heavy", "none"], resultCodes: [ @@ -2245,6 +2387,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-bleeding-after-pregnancy", allowedValues: ["unspecified", "light", "medium", "heavy", "none"], resultCodes: [ @@ -2268,6 +2411,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-bleeding-during-pregnancy", allowedValues: ["unspecified", "light", "medium", "heavy", "none"], resultCodes: [ @@ -2291,6 +2435,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2308,6 +2453,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-blood-type", allowedValues: ["a-positive", "a-negative", "b-positive", "b-negative", "ab-positive", "ab-negative", "o-positive", "o-negative"], resultCodes: [ @@ -2334,6 +2480,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-contraceptive-use", allowedValues: ["unspecified", "implant", "injection", "intrauterine-device", "intravaginal-ring", "oral", "patch"], resultCodes: [ @@ -2359,6 +2506,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "W", unit: "W", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2376,6 +2524,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2393,6 +2542,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB[SPL]", unit: "dB(SPL)", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2410,6 +2560,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-environmental-audio-exposure-notification", allowedValues: ["momentary-limit"], resultCodes: [ @@ -2429,6 +2580,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB[SPL]", unit: "dB(SPL)", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2446,6 +2598,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-fitzpatrick-skin-type", allowedValues: ["type-i", "type-ii", "type-iii", "type-iv", "type-v", "type-vi"], resultCodes: [ @@ -2470,6 +2623,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2487,6 +2641,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "L", unit: "L", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2504,6 +2659,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "L", unit: "L", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2521,6 +2677,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "score", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2538,6 +2695,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "s", unit: "s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2555,6 +2713,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB[SPL]", unit: "dB(SPL)", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2572,6 +2731,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-headphone-audio-exposure-notification", allowedValues: ["seven-day-limit"], resultCodes: [ @@ -2591,6 +2751,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2608,8 +2769,9 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "threshold", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "high-heart-rate-threshold", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "threshold", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "high-heart-rate-threshold", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-high-heart-rate-notification", allowedValues: ["occurred"], resultCodes: [ @@ -2629,6 +2791,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-hypertension-notification", allowedValues: ["occurred"], resultCodes: [ @@ -2648,6 +2811,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-infrequent-menstrual-cycles", allowedValues: ["present", "not-present"], resultCodes: [ @@ -2668,6 +2832,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{puff}", unit: "puffs", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2685,8 +2850,9 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "[iU]", unit: "IU", valueDomain: nil), components: [ - ComponentContract(id: "insulinDeliveryReason", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-metadata-key", code: "HKInsulinDeliveryReason", quantity: nil, resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "insulinDeliveryReason", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-metadata-key", code: "HKInsulinDeliveryReason", quantity: nil, resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2704,6 +2870,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-irregular-heart-rhythm-notification", allowedValues: ["occurred"], resultCodes: [ @@ -2723,6 +2890,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-irregular-menstrual-cycles", allowedValues: ["present", "not-present"], resultCodes: [ @@ -2743,6 +2911,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-lactation-status", allowedValues: ["lactating"], resultCodes: [ @@ -2762,8 +2931,9 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "threshold", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "low-cardio-fitness-threshold", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mL/kg/min", unit: "mL/kg/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "threshold", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "low-cardio-fitness-threshold", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "mL/kg/min", unit: "mL/kg/min", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-low-cardio-fitness-notification", allowedValues: ["low-fitness"], resultCodes: [ @@ -2783,8 +2953,9 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "threshold", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "low-heart-rate-threshold", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), resultCodeSystem: nil, resultCodes: []), + ComponentContract(id: "threshold", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "low-heart-rate-threshold", quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), resultCodeSystem: nil, resultCodes: [], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-low-heart-rate-notification", allowedValues: ["occurred"], resultCodes: [ @@ -2804,6 +2975,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-menopausal-state", allowedValues: ["menopause", "perimenopause", "none"], resultCodes: [ @@ -2825,6 +2997,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{drinks}", unit: "drinks", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2842,6 +3015,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{falls}", unit: "falls", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2859,6 +3033,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "L/min", unit: "L/min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2876,6 +3051,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2893,6 +3069,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-persistent-intermenstrual-bleeding", allowedValues: ["present", "not-present"], resultCodes: [ @@ -2913,6 +3090,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "score", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2930,6 +3108,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kcal/kg/h", unit: "kcal/(kg.h)", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -2947,6 +3126,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-pregnancy-status", allowedValues: ["pregnant"], resultCodes: [ @@ -2966,6 +3146,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-pregnancy-test-result", allowedValues: ["negative", "positive", "indeterminate"], resultCodes: [ @@ -2987,6 +3168,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-progesterone-test-result", allowedValues: ["negative", "positive", "indeterminate"], resultCodes: [ @@ -3008,6 +3190,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-prolonged-menstrual-periods", allowedValues: ["present", "not-present"], resultCodes: [ @@ -3028,6 +3211,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3045,6 +3229,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3062,6 +3247,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "cm", unit: "cm", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3079,6 +3265,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3096,6 +3283,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-sleep-apnea-notification", allowedValues: ["occurred"], resultCodes: [ @@ -3115,6 +3303,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/h", unit: "events/hour", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3132,6 +3321,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3149,6 +3339,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3166,11 +3357,12 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "1", unit: "valence", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "-1", inclusive: true), maximum: QuantityBoundary(value: "1", inclusive: true), integerOnly: false)), components: [ - ComponentContract(id: "kind", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "kind", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-kind", resultCodes: [ResultCodeContract(code: "momentary-emotion", display: "Momentary emotion"), ResultCodeContract(code: "daily-mood", display: "Daily mood")]), - ComponentContract(id: "valence-classification", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "valence-classification", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-valence-classification", resultCodes: [ResultCodeContract(code: "very-unpleasant", display: "Very unpleasant"), ResultCodeContract(code: "unpleasant", display: "Unpleasant"), ResultCodeContract(code: "slightly-unpleasant", display: "Slightly unpleasant"), ResultCodeContract(code: "neutral", display: "Neutral"), ResultCodeContract(code: "slightly-pleasant", display: "Slightly pleasant"), ResultCodeContract(code: "pleasant", display: "Pleasant"), ResultCodeContract(code: "very-pleasant", display: "Very pleasant")]), - ComponentContract(id: "label", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "state-of-mind-label", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-label", resultCodes: [ResultCodeContract(code: "amazed", display: "Amazed"), ResultCodeContract(code: "amused", display: "Amused"), ResultCodeContract(code: "angry", display: "Angry"), ResultCodeContract(code: "anxious", display: "Anxious"), ResultCodeContract(code: "ashamed", display: "Ashamed"), ResultCodeContract(code: "brave", display: "Brave"), ResultCodeContract(code: "calm", display: "Calm"), ResultCodeContract(code: "content", display: "Content"), ResultCodeContract(code: "disappointed", display: "Disappointed"), ResultCodeContract(code: "discouraged", display: "Discouraged"), ResultCodeContract(code: "disgusted", display: "Disgusted"), ResultCodeContract(code: "embarrassed", display: "Embarrassed"), ResultCodeContract(code: "excited", display: "Excited"), ResultCodeContract(code: "frustrated", display: "Frustrated"), ResultCodeContract(code: "grateful", display: "Grateful"), ResultCodeContract(code: "guilty", display: "Guilty"), ResultCodeContract(code: "happy", display: "Happy"), ResultCodeContract(code: "hopeless", display: "Hopeless"), ResultCodeContract(code: "irritated", display: "Irritated"), ResultCodeContract(code: "jealous", display: "Jealous"), ResultCodeContract(code: "joyful", display: "Joyful"), ResultCodeContract(code: "lonely", display: "Lonely"), ResultCodeContract(code: "passionate", display: "Passionate"), ResultCodeContract(code: "peaceful", display: "Peaceful"), ResultCodeContract(code: "proud", display: "Proud"), ResultCodeContract(code: "relieved", display: "Relieved"), ResultCodeContract(code: "sad", display: "Sad"), ResultCodeContract(code: "scared", display: "Scared"), ResultCodeContract(code: "stressed", display: "Stressed"), ResultCodeContract(code: "surprised", display: "Surprised"), ResultCodeContract(code: "worried", display: "Worried"), ResultCodeContract(code: "annoyed", display: "Annoyed"), ResultCodeContract(code: "confident", display: "Confident"), ResultCodeContract(code: "drained", display: "Drained"), ResultCodeContract(code: "hopeful", display: "Hopeful"), ResultCodeContract(code: "indifferent", display: "Indifferent"), ResultCodeContract(code: "overwhelmed", display: "Overwhelmed"), ResultCodeContract(code: "satisfied", display: "Satisfied")]), - ComponentContract(id: "association", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "state-of-mind-association", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-association", resultCodes: [ResultCodeContract(code: "community", display: "Community"), ResultCodeContract(code: "current-events", display: "Current events"), ResultCodeContract(code: "dating", display: "Dating"), ResultCodeContract(code: "education", display: "Education"), ResultCodeContract(code: "family", display: "Family"), ResultCodeContract(code: "fitness", display: "Fitness"), ResultCodeContract(code: "friends", display: "Friends"), ResultCodeContract(code: "health", display: "Health"), ResultCodeContract(code: "hobbies", display: "Hobbies"), ResultCodeContract(code: "identity", display: "Identity"), ResultCodeContract(code: "money", display: "Money"), ResultCodeContract(code: "partner", display: "Partner"), ResultCodeContract(code: "self-care", display: "Self care"), ResultCodeContract(code: "spirituality", display: "Spirituality"), ResultCodeContract(code: "tasks", display: "Tasks"), ResultCodeContract(code: "travel", display: "Travel"), ResultCodeContract(code: "work", display: "Work"), ResultCodeContract(code: "weather", display: "Weather")]), + ComponentContract(id: "kind", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "kind", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-kind", resultCodes: [ResultCodeContract(code: "momentary-emotion", display: "Momentary emotion"), ResultCodeContract(code: "daily-mood", display: "Daily mood")], extensionValues: []), + ComponentContract(id: "valence-classification", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "valence-classification", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-valence-classification", resultCodes: [ResultCodeContract(code: "very-unpleasant", display: "Very unpleasant"), ResultCodeContract(code: "unpleasant", display: "Unpleasant"), ResultCodeContract(code: "slightly-unpleasant", display: "Slightly unpleasant"), ResultCodeContract(code: "neutral", display: "Neutral"), ResultCodeContract(code: "slightly-pleasant", display: "Slightly pleasant"), ResultCodeContract(code: "pleasant", display: "Pleasant"), ResultCodeContract(code: "very-pleasant", display: "Very pleasant")], extensionValues: []), + ComponentContract(id: "label", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "state-of-mind-label", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-label", resultCodes: [ResultCodeContract(code: "amazed", display: "Amazed"), ResultCodeContract(code: "amused", display: "Amused"), ResultCodeContract(code: "angry", display: "Angry"), ResultCodeContract(code: "anxious", display: "Anxious"), ResultCodeContract(code: "ashamed", display: "Ashamed"), ResultCodeContract(code: "brave", display: "Brave"), ResultCodeContract(code: "calm", display: "Calm"), ResultCodeContract(code: "content", display: "Content"), ResultCodeContract(code: "disappointed", display: "Disappointed"), ResultCodeContract(code: "discouraged", display: "Discouraged"), ResultCodeContract(code: "disgusted", display: "Disgusted"), ResultCodeContract(code: "embarrassed", display: "Embarrassed"), ResultCodeContract(code: "excited", display: "Excited"), ResultCodeContract(code: "frustrated", display: "Frustrated"), ResultCodeContract(code: "grateful", display: "Grateful"), ResultCodeContract(code: "guilty", display: "Guilty"), ResultCodeContract(code: "happy", display: "Happy"), ResultCodeContract(code: "hopeless", display: "Hopeless"), ResultCodeContract(code: "irritated", display: "Irritated"), ResultCodeContract(code: "jealous", display: "Jealous"), ResultCodeContract(code: "joyful", display: "Joyful"), ResultCodeContract(code: "lonely", display: "Lonely"), ResultCodeContract(code: "passionate", display: "Passionate"), ResultCodeContract(code: "peaceful", display: "Peaceful"), ResultCodeContract(code: "proud", display: "Proud"), ResultCodeContract(code: "relieved", display: "Relieved"), ResultCodeContract(code: "sad", display: "Sad"), ResultCodeContract(code: "scared", display: "Scared"), ResultCodeContract(code: "stressed", display: "Stressed"), ResultCodeContract(code: "surprised", display: "Surprised"), ResultCodeContract(code: "worried", display: "Worried"), ResultCodeContract(code: "annoyed", display: "Annoyed"), ResultCodeContract(code: "confident", display: "Confident"), ResultCodeContract(code: "drained", display: "Drained"), ResultCodeContract(code: "hopeful", display: "Hopeful"), ResultCodeContract(code: "indifferent", display: "Indifferent"), ResultCodeContract(code: "overwhelmed", display: "Overwhelmed"), ResultCodeContract(code: "satisfied", display: "Satisfied")], extensionValues: []), + ComponentContract(id: "association", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "state-of-mind-association", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-state-of-mind-association", resultCodes: [ResultCodeContract(code: "community", display: "Community"), ResultCodeContract(code: "current-events", display: "Current events"), ResultCodeContract(code: "dating", display: "Dating"), ResultCodeContract(code: "education", display: "Education"), ResultCodeContract(code: "family", display: "Family"), ResultCodeContract(code: "fitness", display: "Fitness"), ResultCodeContract(code: "friends", display: "Friends"), ResultCodeContract(code: "health", display: "Health"), ResultCodeContract(code: "hobbies", display: "Hobbies"), ResultCodeContract(code: "identity", display: "Identity"), ResultCodeContract(code: "money", display: "Money"), ResultCodeContract(code: "partner", display: "Partner"), ResultCodeContract(code: "self-care", display: "Self care"), ResultCodeContract(code: "spirituality", display: "Spirituality"), ResultCodeContract(code: "tasks", display: "Tasks"), ResultCodeContract(code: "travel", display: "Travel"), ResultCodeContract(code: "work", display: "Work"), ResultCodeContract(code: "weather", display: "Weather")], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3188,6 +3380,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{strokes}", unit: "strokes", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: nil, integerOnly: true)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3205,6 +3398,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3222,6 +3416,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3239,6 +3434,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-symptom-appetite-changes", allowedValues: ["no-change", "decreased", "increased", "change-unspecified"], resultCodes: [ @@ -3261,6 +3457,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3278,6 +3475,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3295,6 +3493,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3312,6 +3511,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3329,6 +3529,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3346,6 +3547,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3363,6 +3565,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3380,6 +3583,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3397,6 +3601,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3414,6 +3619,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3431,6 +3637,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3448,6 +3655,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3465,6 +3673,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3482,6 +3691,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3499,6 +3709,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3516,6 +3727,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3533,6 +3745,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3550,6 +3763,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3567,6 +3781,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3584,6 +3799,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3601,6 +3817,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3618,6 +3835,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present"], resultCodes: [], @@ -3635,6 +3853,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3652,6 +3871,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3669,6 +3889,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3686,6 +3907,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3703,6 +3925,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3720,6 +3943,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3737,6 +3961,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3754,6 +3979,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3771,6 +3997,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present"], resultCodes: [], @@ -3788,6 +4015,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3805,6 +4033,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3822,6 +4051,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3839,6 +4069,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "min", unit: "min", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3856,6 +4087,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "s", unit: "s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3873,6 +4105,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m", unit: "m", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3890,6 +4123,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{uvindex}", unit: "UV index", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3907,6 +4141,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity", allowedValues: ["not-present", "present", "mild", "moderate", "severe"], resultCodes: [], @@ -3924,6 +4159,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "cm", unit: "cm", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3941,6 +4177,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3958,6 +4195,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3975,6 +4213,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -3992,6 +4231,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4009,6 +4249,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "%", unit: "%", valueDomain: QuantityValueDomain(minimum: QuantityBoundary(value: "0", inclusive: true), maximum: QuantityBoundary(value: "100", inclusive: true), integerOnly: false)), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4026,8 +4267,9 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [ - ComponentContract(id: "notification-occurrence", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "walking-steadiness-notification-occurrence", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-notification-occurrence", resultCodes: [ResultCodeContract(code: "initial", display: "Initial"), ResultCodeContract(code: "repeat", display: "Repeat")]), + ComponentContract(id: "notification-occurrence", system: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement", code: "walking-steadiness-notification-occurrence", quantity: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-notification-occurrence", resultCodes: [ResultCodeContract(code: "initial", display: "Initial"), ResultCodeContract(code: "repeat", display: "Repeat")], extensionValues: []), ], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-walking-steadiness-notification", allowedValues: ["low", "very-low"], resultCodes: [ @@ -4048,6 +4290,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "cm", unit: "cm", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4065,6 +4308,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "Cel", unit: "Cel", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4082,6 +4326,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-wheelchair-use", allowedValues: ["uses-wheelchair", "does-not-use-wheelchair"], resultCodes: [ @@ -4102,6 +4347,7 @@ package enum HealthKitMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "score", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4239,6 +4485,7 @@ package enum GoogleHealthMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "/min", unit: "beats/minute", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4264,6 +4511,7 @@ package enum OuraMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "a", unit: "years", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4281,6 +4529,7 @@ package enum OuraMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "score", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4307,6 +4556,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4324,6 +4574,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4341,6 +4592,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4358,6 +4610,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4375,6 +4628,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg", unit: "kg", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4392,6 +4646,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4409,6 +4664,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4426,6 +4682,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "ms", unit: "ms", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4443,6 +4700,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/withings/CodeSystem/withings-atrial-fibrillation-notification-ecg", allowedValues: ["signs-detected"], resultCodes: [ @@ -4462,6 +4720,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: nil, components: [], + componentExtension: nil, resultCodeSystem: "https://grovealliance.org/fhir/withings/CodeSystem/withings-atrial-fibrillation-notification-ppg", allowedValues: ["signs-detected"], resultCodes: [ @@ -4481,6 +4740,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "score", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4498,6 +4758,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "m/s", unit: "m/s", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4515,6 +4776,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "a", unit: "years", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4532,6 +4794,7 @@ package enum WithingsMeasurementCatalog { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "{score}", unit: "score", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], @@ -4622,6 +4885,7 @@ package enum HealthKitContract { requiredCodings: [], quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "kg/m2", unit: "kg/m2", valueDomain: nil), components: [], + componentExtension: nil, resultCodeSystem: nil, allowedValues: [], resultCodes: [], diff --git a/Sources/GroveHealthKitFHIR/GroveHealthKitFHIR.docc/GroveHealthKitFHIR.md b/Sources/GroveHealthKitFHIR/GroveHealthKitFHIR.docc/GroveHealthKitFHIR.md index 81e2d8a55..fa2bc64bc 100644 --- a/Sources/GroveHealthKitFHIR/GroveHealthKitFHIR.docc/GroveHealthKitFHIR.md +++ b/Sources/GroveHealthKitFHIR/GroveHealthKitFHIR.docc/GroveHealthKitFHIR.md @@ -108,6 +108,7 @@ Exporting a sample again at another instant is a new version of the same source `conversionInstants` supplies the retained conversion instant of a sample by its UUID, a food correlation's members and an ECG's symptoms included; a sample without an entry uses the call's `at` instant. Reusing a sample's first conversion instant keeps its record version when it is exported again, alone or through its correlation. These instants state when Grove converted a sample and change no clinical effective time. A food correlation exports as one eating-occasion Observation that references its nutrient members, each exported as a record of its own under the same disclosure options; a member also passed as its own record in the same call is exported twice. +An audiogram exports as one audiogram-panel Observation with a component for each sensitivity test, coded where the guide names its ear and frequency and labeled with its exact frequency otherwise. Before iOS 18.1, macOS 15.1 and watchOS 11.1, HealthKit states only each ear's air-conduction sensitivity, so those components carry no masking state or clamping bounds. A blood-pressure reading exports only as its `HKCorrelation`: a systolic or diastolic sample on its own is refused with ``HealthKitConversionError/componentRequiresCorrelation(_:)``. A sample your application created but did not save into HealthKit, for example because the user does not let it write the sample's type, names no source until HealthKit saves it. Export it as ``HealthKitFHIRExporter/Record/unsavedSample(_:source:)`` from the build that created it, which takes a quantity sample or a correlation for now: the exporter states the source revision HealthKit would stamp on saving it, so the record states the writer, source revision and gateway role it would for the saved sample. The members of an unsaved food correlation state the same revision, as HealthKit attributes a saved correlation's members to its source. diff --git a/Sources/GroveHealthKitFHIR/HealthKitAudiogramContent.swift b/Sources/GroveHealthKitFHIR/HealthKitAudiogramContent.swift new file mode 100644 index 000000000..d6e9da51e --- /dev/null +++ b/Sources/GroveHealthKitFHIR/HealthKitAudiogramContent.swift @@ -0,0 +1,269 @@ +// +// This source file is part of the Grove open-source project +// +// SPDX-FileCopyrightText: 2026 Stanford University and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + +#if canImport(HealthKit) + +import Foundation +import GroveFHIRContract +import HealthKit +import ModelsR4 + + +/// An audiogram's sensitivity tests, one component each, compiled once against the audiogram panel contract. +/// +/// Each component carries the contract's component extension with the test's frequency, ear, conduction method, +/// masking state when the source exposes it, and clamping bounds when the source states any. A test at an ear and +/// frequency the contract codes uses that component's code and states the frequency as the contract fixes it; any +/// other test keeps its exact frequency under a text-only code. Frequencies are compared as whole millihertz, as the +/// panel invariant `healthkit-audiogram-panel-1` compares them. +@available(iOS 18, macOS 15, watchOS 11, *) +struct HealthKitAudiogramContent: Sendable { + /// The ear a sensitivity test was presented to, spelled as the guide's `healthkit-audiogram-ear` codes. + enum Ear: String, Hashable, Sendable { + case left + case right + } + + /// An ear and a frequency in whole millihertz. + struct Coordinate: Hashable, Sendable { + let ear: Ear + let millihertz: Int64 + } + + /// A coded component: its code and sensitivity quantity, and the frequency the contract fixes for it. + private struct CodedComponent: Sendable { + let template: ComponentTemplate + let frequency: Decimal + } + + /// The ear and frequency one contract component fixes, with the frequency's unit. + private struct FixedCoordinate { + let coordinate: Coordinate + let frequency: Decimal + let system: String + let code: String + } + + /// One sensitivity test of the sample at its coordinate, with the frequency as the record states it. + private struct PlacedReading { + let coordinate: Coordinate + let frequency: GroveFHIRDecimal + let reading: Reading + } + + /// One sensitivity test as the source states it: the ear, the hearing level in dB, the masking state when the + /// source exposes it, and the source's clamping bounds in dB. + struct Reading { + let ear: Ear + let sensitivity: Double + // swiftlint:disable:next discouraged_optional_boolean - An SDK before iOS 18.1 does not expose masking. + var masked: Bool? + var lowerBound: Double? + var upperBound: Double? + } + + /// One sensitivity point: its frequency in hertz, as the record states it, and its tests. + struct Point { + let frequency: GroveFHIRDecimal + let readings: [Reading] + } + + /// The URL of the extension every component carries. + private let extensionURL: String + /// The coded components, by ear and frequency. + private let coded: [Coordinate: CodedComponent] + /// The sensitivity quantity of a component the contract does not code. + private let sensitivity: QuantityTemplate + /// The frequency quantity, without a value. + private let frequency: Quantity + + /// The content of `contract`: every component must fix one ear and one positive frequency in hertz, share the + /// sensitivity quantity, and name a distinct ear and frequency. + init(_ contract: MeasurementContract) throws(HealthKitContentDefect) { + guard let componentExtension = contract.componentExtension else { + throw HealthKitContentDefect("states no extension for its audiogram components") + } + guard let first = contract.components.first, let sensitivity = first.quantity else { + throw HealthKitContentDefect("states no audiogram sensitivity quantity") + } + var coded: [Coordinate: CodedComponent] = [:] + var units: Set<[String]> = [] + for component in contract.components { + let fixed = try Self.fixedCoordinate(of: component) + guard component.quantity == sensitivity, let template = ComponentTemplate(component) else { + throw HealthKitContentDefect("states audiogram component \(component.id) in another quantity") + } + units.insert([fixed.system, fixed.code]) + guard units.count == 1 else { + throw HealthKitContentDefect("states audiogram frequencies in more than one unit") + } + guard coded.updateValue(CodedComponent(template: template, frequency: fixed.frequency), forKey: fixed.coordinate) == nil else { + throw HealthKitContentDefect("states audiogram ear \(fixed.coordinate.ear.rawValue) at \(fixed.frequency) Hz twice") + } + } + guard units == [[Canonicals.ucumSystem, "Hz"]] else { + throw HealthKitContentDefect("states audiogram frequencies in a unit other than UCUM Hz") + } + extensionURL = componentExtension.url + self.coded = coded + self.sensitivity = QuantityTemplate(sensitivity) + frequency = Quantity(code: "Hz", system: Canonicals.ucum, unit: "Hz") + } + + /// The whole millihertz of the decimal `hertz`, its value times 1000 truncated as the panel invariant truncates + /// it, or `nil` for a frequency that is not positive or that no 64-bit integer holds. + static func millihertz(_ hertz: Decimal) -> Int64? { + var scaled = hertz * 1000 + var truncated = Decimal() + NSDecimalRound(&truncated, &scaled, 0, .down) + guard hertz > 0, truncated < Decimal(Int64.max) else { + return nil + } + return NSDecimalNumber(decimal: truncated).int64Value + } + + /// The ear and frequency a component fixes. + private static func fixedCoordinate(of component: ComponentContract) throws(HealthKitContentDefect) -> FixedCoordinate { + var ear: Ear? + var frequency: ExtensionValueContract.Value? + for fixed in component.extensionValues { + switch (fixed.member, fixed.value) { + case ("ear", .code(let code)) where ear == nil: + ear = Ear(rawValue: code) + guard ear != nil else { + throw HealthKitContentDefect("states audiogram component \(component.id) at ear \(code)") + } + case ("frequency", .quantity) where frequency == nil: + frequency = fixed.value + default: + throw HealthKitContentDefect("fixes audiogram component \(component.id) member \(fixed.member) unexpectedly") + } + } + guard let ear, case let .quantity(value, system, code)? = frequency, let millihertz = millihertz(value) else { + throw HealthKitContentDefect("states audiogram component \(component.id) without one ear and positive frequency") + } + return FixedCoordinate(coordinate: Coordinate(ear: ear, millihertz: millihertz), frequency: value, system: system, code: code) + } + + /// The sensitivity tests of one point: each test from iOS 18.1, else the point's ear sensitivities. A conduction + /// method or side the guide does not name is unsupported. + private static func readings(_ point: HKAudiogramSensitivityPoint) throws(HealthKitConversionError.ValueFailure) -> [Reading] { + if #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) { + return try point.tests.map { test throws(HealthKitConversionError.ValueFailure) in + guard test.type == .air else { + throw .unsupportedValue(test.type.rawValue) + } + let ear: Ear + switch test.side { + case .left: ear = .left + case .right: ear = .right + @unknown default: throw .unsupportedValue(test.side.rawValue) + } + return Reading( + ear: ear, + sensitivity: test.sensitivity.doubleValue(for: .decibelHearingLevel()), + masked: test.masked, + lowerBound: test.clampingRange?.lowerBound?.doubleValue(for: .decibelHearingLevel()), + upperBound: test.clampingRange?.upperBound?.doubleValue(for: .decibelHearingLevel()) + ) + } + } + let sides: [(Ear, HKQuantity?)] = [(.left, point.leftEarSensitivity), (.right, point.rightEarSensitivity)] + return sides.compactMap { ear, value in + value.map { Reading(ear: ear, sensitivity: $0.doubleValue(for: .decibelHearingLevel()), masked: nil, lowerBound: nil, upperBound: nil) } + } + } + + /// Sets the audiogram's components on `observation`, ordered by frequency and then ear, and no value. A frequency + /// that is not positive and finite is an invalid shape, as ``components(_:)`` states for the rest. + func apply(to observation: inout Observation, sample: HKAudiogramSample) throws { + let points = try sample.sensitivityPoints.map { point in + let hertz = point.frequency.doubleValue(for: .hertz()) + guard let frequency = try? GroveFHIRDecimal(hertz) else { + throw HealthKitConversionError.ValueFailure.shapeInvalid + } + return Point(frequency: frequency, readings: try Self.readings(point)) + } + observation.component = try components(points) + } + + /// The components of `points`, ordered by frequency and then ear. No point, a point without a test, a frequency + /// that is not positive, a second test of one ear at one frequency (by whole millihertz), and a clamping range + /// whose lower bound is not below its upper bound are an invalid shape. + func components(_ points: [Point]) throws -> [ObservationComponent] { + var tests: [PlacedReading] = [] + var coordinates: Set = [] + for point in points { + guard let millihertz = Self.millihertz(point.frequency.decimal), !point.readings.isEmpty else { + throw HealthKitConversionError.ValueFailure.shapeInvalid + } + for reading in point.readings { + let coordinate = Coordinate(ear: reading.ear, millihertz: millihertz) + guard coordinates.insert(coordinate).inserted else { + throw HealthKitConversionError.ValueFailure.shapeInvalid + } + tests.append(PlacedReading(coordinate: coordinate, frequency: point.frequency, reading: reading)) + } + } + guard !tests.isEmpty else { + throw HealthKitConversionError.ValueFailure.shapeInvalid + } + tests.sort { first, second in + first.coordinate.millihertz != second.coordinate.millihertz + ? first.coordinate.millihertz < second.coordinate.millihertz + : first.coordinate.ear.rawValue < second.coordinate.ear.rawValue + } + return try tests.map { try component($0.reading, at: $0.coordinate, frequency: $0.frequency) } + } + + /// The component of one test. + private func component(_ reading: Reading, at coordinate: Coordinate, frequency exact: GroveFHIRDecimal) throws -> ObservationComponent { + var component: ObservationComponent + var frequency = self.frequency + if let coded = coded[coordinate] { + component = try coded.template.component(reading.sensitivity) + frequency.value = FHIRPrimitive(FHIRDecimal(coded.frequency)) + } else { + frequency.value = exact.primitive + let label = "Air conduction threshold, \(reading.ear.rawValue) ear, \(exact.lexical) Hz" + component = ObservationComponent( + code: CodeableConcept(text: label.asFHIRStringPrimitive()), + value: .quantity(try sensitivity.quantity(reading.sensitivity)) + ) + } + var details = [ + Extension(url: "frequency", value: .quantity(frequency)), + Extension(url: "ear", value: .code(reading.ear.rawValue.asFHIRStringPrimitive())), + Extension(url: "conduction", value: .code("air")) + ] + if let masked = reading.masked { + details.append(Extension(url: "masked", value: .boolean(FHIRPrimitive(FHIRBool(masked))))) + } + if let range = try clampingRange(reading) { + details.append(Extension(url: "clampingRange", value: .range(range))) + } + component.extension = [Extension(extension: details, url: FHIRPrimitive(FHIRURI(stringLiteral: extensionURL)))] + return component + } + + /// The source's clamping bounds in the sensitivity quantity, or `nil` when it states none. + private func clampingRange(_ reading: Reading) throws -> ModelsR4.Range? { + guard reading.lowerBound != nil || reading.upperBound != nil else { + return nil + } + if let low = reading.lowerBound, let high = reading.upperBound, !(low < high) { + throw HealthKitConversionError.ValueFailure.shapeInvalid + } + return ModelsR4.Range( + high: try reading.upperBound.map { try sensitivity.quantity($0) }, + low: try reading.lowerBound.map { try sensitivity.quantity($0) } + ) + } +} + +#endif diff --git a/Sources/GroveHealthKitFHIR/HealthKitContentPlan+Compile.swift b/Sources/GroveHealthKitFHIR/HealthKitContentPlan+Compile.swift index 40536f9e5..6f8959383 100644 --- a/Sources/GroveHealthKitFHIR/HealthKitContentPlan+Compile.swift +++ b/Sources/GroveHealthKitFHIR/HealthKitContentPlan+Compile.swift @@ -373,6 +373,8 @@ extension HealthKitContentCompiler { return try Self.protection(contract) case .bloodPressure: return .bloodPressure(try Self.bloodPressureMembers(contract)) + case .audiogram: + return .audiogram(try HealthKitAudiogramContent(contract)) case .workout: return .workout(try HealthKitWorkoutContent(contract)) case .stateOfMind: diff --git a/Sources/GroveHealthKitFHIR/HealthKitContentRules.swift b/Sources/GroveHealthKitFHIR/HealthKitContentRules.swift index bb2016c3e..0159404a9 100644 --- a/Sources/GroveHealthKitFHIR/HealthKitContentRules.swift +++ b/Sources/GroveHealthKitFHIR/HealthKitContentRules.swift @@ -51,6 +51,8 @@ enum HealthKitContentRules { case protection /// The blood-pressure correlation's members, one component each. case bloodPressure + /// The audiogram's sensitivity tests, one component each. + case audiogram /// The workout's activity, totals and heart-rate statistics. case workout /// The reflection's valence and its coded axes. @@ -94,7 +96,7 @@ enum HealthKitContentRules { /// Supported rows the adapter declares it does not convert yet; any other supported row without a rule is a defect. static let notYetConvertible: Set = Set([ - .biologicalSex, .bloodType, .dateOfBirth, .fitzpatrickSkinType, .wheelchairUse, .audiogram + .biologicalSex, .bloodType, .dateOfBirth, .fitzpatrickSkinType, .wheelchairUse ]).union(platform27Groups.isEmpty ? platform27Types : []) /// The types of the rules that name a platform 27 SDK symbol. @@ -282,6 +284,7 @@ extension HealthKitContentRules { RuleGroup(.food, [.food]), RuleGroup(.observation(.quantity(.platformRate)), [.appleSleepingBreathingDisturbances]), RuleGroup(.observation(.bloodPressure), [.bloodPressure]), + RuleGroup(.observation(.audiogram), [.audiogram]), RuleGroup(.observation(.workout), [.workout]), RuleGroup(.observation(.stateOfMind), [.stateOfMind]), RuleGroup(.electrocardiogram, [.electrocardiogram]), diff --git a/Sources/GroveHealthKitFHIR/HealthKitObservationContent.swift b/Sources/GroveHealthKitFHIR/HealthKitObservationContent.swift index dd64b2c32..ad3f2e115 100644 --- a/Sources/GroveHealthKitFHIR/HealthKitObservationContent.swift +++ b/Sources/GroveHealthKitFHIR/HealthKitObservationContent.swift @@ -69,6 +69,8 @@ enum ValueRule: Sendable { case protection(unknown: CodeableConcept, protected: CodeableConcept, unprotected: CodeableConcept) /// The panel's members, one component each, in the contract's component order, and no value. case bloodPressure([BloodPressureMember]) + /// An audiogram's sensitivity tests, one component each, and no value. + case audiogram(HealthKitAudiogramContent) /// A workout session's activity and statistics. case workout(HealthKitWorkoutContent) /// A reflection's valence and coded axes. @@ -193,6 +195,8 @@ extension ValueRule { case .bloodPressure(let members): let correlation = try sample.cast(to: HKCorrelation.self) observation.component = try members.map { try $0.component(in: correlation) } + case .audiogram(let content): + try content.apply(to: &observation, sample: try sample.cast(to: HKAudiogramSample.self)) case .workout(let content): try content.apply(to: &observation, workout: try sample.cast(to: HKWorkout.self)) case .stateOfMind(let content): diff --git a/Sources/GroveHealthKitFHIR/Observation+HealthKitSample.swift b/Sources/GroveHealthKitFHIR/Observation+HealthKitSample.swift index a74ae86e6..a9c8ae013 100644 --- a/Sources/GroveHealthKitFHIR/Observation+HealthKitSample.swift +++ b/Sources/GroveHealthKitFHIR/Observation+HealthKitSample.swift @@ -157,7 +157,7 @@ enum HealthKitSampleProjection { } let envelope = try envelope(of: observation, contract: contract, sampleType: type, syncIdentifier: syncIdentifier) return try category(of: observation, type: type, plan: projection.plan, contract: contract, envelope: envelope) - case .workout, .stateOfMind: + case .workout, .stateOfMind, .audiogram: throw .measurementNotMappable(id: contract.id) } } @@ -166,7 +166,7 @@ enum HealthKitSampleProjection { private static func inverts(_ rule: ValueRule) -> Bool { switch rule { case .quantity(_, .unit), .quantity(_, .percent), .quantity(_, .platformRate), .coded, .duration, .protection, .bloodPressure: true - case .quantity(_, .score), .workout, .stateOfMind: false + case .quantity(_, .score), .workout, .stateOfMind, .audiogram: false } } @@ -385,7 +385,7 @@ extension HealthKitSampleProjection { case let .protection(unknown, protected, unprotected): protection = try protectionMetadata(of: observation, unknown: unknown, protected: protected, unprotected: unprotected, contract: contract) value = HKCategoryValue.notApplicable.rawValue - case .quantity, .bloodPressure, .workout, .stateOfMind: + case .quantity, .bloodPressure, .workout, .stateOfMind, .audiogram: throw .measurementNotMappable(id: contract.id) } let metadata = try metadata(of: observation, envelope: envelope, rule: plan.metadataComponent, contract: contract) diff --git a/Tests/GroveHealthKitFHIRTests/ConformanceFixtureTests.swift b/Tests/GroveHealthKitFHIRTests/ConformanceFixtureTests.swift index cf8cfa56b..cd1932920 100644 --- a/Tests/GroveHealthKitFHIRTests/ConformanceFixtureTests.swift +++ b/Tests/GroveHealthKitFHIRTests/ConformanceFixtureTests.swift @@ -89,6 +89,8 @@ struct ConformanceFixtureTests { private static let validatedGoldens: Set = [ "guide-example-heart-rate", "guide-example-source-metadata", + "guide-example-audiogram", + "audiogram-test-details", "high-heart-rate-threshold", "workout-session", "workout-session-context", diff --git a/Tests/GroveHealthKitFHIRTests/ContentCorpus/ContentInvariantTests.swift b/Tests/GroveHealthKitFHIRTests/ContentCorpus/ContentInvariantTests.swift index 9f3b15ea5..eb9aa1bcb 100644 --- a/Tests/GroveHealthKitFHIRTests/ContentCorpus/ContentInvariantTests.swift +++ b/Tests/GroveHealthKitFHIRTests/ContentCorpus/ContentInvariantTests.swift @@ -78,9 +78,9 @@ enum ContentCorpusInvariants { /// corpus reproducing across processes; Mobile milliseconds rounding from 1970 is `HealthKitEffectiveTimeTests`.) @Suite struct ContentInvariantTests { - /// Supported rows the adapter does not convert yet: the audiogram and five characteristics. + /// Supported rows the adapter does not convert yet: five characteristics. private static let notYetConvertible = Set([ - "HKDataTypeIdentifierAudiogram", "HKCharacteristicTypeIdentifierBiologicalSex", + "HKCharacteristicTypeIdentifierBiologicalSex", "HKCharacteristicTypeIdentifierBloodType", "HKCharacteristicTypeIdentifierDateOfBirth", "HKCharacteristicTypeIdentifierFitzpatrickSkinType", "HKCharacteristicTypeIdentifierWheelchairUse" ]).union(Platform27Fixtures.isAvailable ? [] : Platform27Fixtures.convertibleOnlyWhereAvailable.map(\.rawValue)) diff --git a/Tests/GroveHealthKitFHIRTests/GoldenGraphCases.swift b/Tests/GroveHealthKitFHIRTests/GoldenGraphCases.swift index bab6212eb..eb6f3a409 100644 --- a/Tests/GroveHealthKitFHIRTests/GoldenGraphCases.swift +++ b/Tests/GroveHealthKitFHIRTests/GoldenGraphCases.swift @@ -321,6 +321,29 @@ extension GoldenCase { }, GoldenCase("guide-example-source-metadata") { try await guideExampleHeartRate(metadata: ["com.example.note": "after exercise"]) + }, + // HealthkitAudiogramPanelExample: 20 dB left and 25 dB right at 250 Hz, unmasked, at 10:30 Los Angeles time. + GoldenCase("guide-example-audiogram") { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + throw AudiogramTestsUnavailable() + } + return try await audiogram(duration: 0, [ + AudiogramPoint(hertz: 250, tests: [AudiogramTest(side: .left, decibels: 20), AudiogramTest(side: .right, decibels: 25)]) + ]) + }, + // A six-minute test with a masked, clamped catalog frequency and two frequencies the catalog does not code. + GoldenCase("audiogram-test-details") { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + throw AudiogramTestsUnavailable() + } + return try await audiogram(duration: 360, [ + AudiogramPoint(hertz: 125, tests: [AudiogramTest(side: .left, decibels: 15)]), + AudiogramPoint(hertz: 250, tests: [ + AudiogramTest(side: .left, decibels: 20, masked: true, lowerBound: -10, upperBound: 80), + AudiogramTest(side: .right, decibels: 25, upperBound: 100) + ]), + AudiogramPoint(hertz: 1_250.5, tests: [AudiogramTest(side: .right, decibels: 30)]) + ]) } ] @@ -391,4 +414,59 @@ extension GoldenCase { } } + +extension GoldenCase { + /// HealthKit states an audiogram's sensitivity tests from iOS 18.1, macOS 15.1 and watchOS 11.1. + struct AudiogramTestsUnavailable: Error {} +} + + +@available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) +extension GoldenCase { + /// One audiogram sensitivity test of a golden case: the ear, the hearing level in dB, masking, and the source's + /// clamping bounds. + struct AudiogramTest { + let side: HKAudiogramSensitivityTestSide + let decibels: Double + var masked = false + var lowerBound: Double? + var upperBound: Double? + } + + /// One audiogram frequency of a golden case and its tests. + struct AudiogramPoint { + let hertz: Double + let tests: [AudiogramTest] + } + + /// An audiogram at the guide example's start, 2026-08-19T10:30:00-07:00, over `duration` seconds. + fileprivate static func audiogram(duration: TimeInterval, _ points: [AudiogramPoint]) async throws -> GoldenOutput { + let sensitivityPoints = try points.map { point in + let tests = try point.tests.map { test in + let clamping = try (test.lowerBound == nil && test.upperBound == nil ? nil : HKAudiogramSensitivityPointClampingRange( + lowerBound: test.lowerBound.map { NSNumber(value: $0) }, + upperBound: test.upperBound.map { NSNumber(value: $0) } + )) + return try HKAudiogramSensitivityTest( + sensitivity: HKQuantity(unit: .decibelHearingLevel(), doubleValue: test.decibels), + type: .air, + masked: test.masked, + side: test.side, + clampingRange: clamping + ) + } + return try HKAudiogramSensitivityPoint(frequency: HKQuantity(unit: .hertz(), doubleValue: point.hertz), tests: tests) + } + let start = Date(timeIntervalSince1970: 1_787_160_600) + let sample = HKAudiogramSample( + sensitivityPoints: sensitivityPoints, + start: start, + end: start.addingTimeInterval(duration), + device: nil, + metadata: [HKMetadataKeyTimeZone: GoldenFixtures.timeZone] + ) + return try await GoldenFixtures.export(try StoredSampleFixtures.stored(sample, uuid: GoldenFixtures.uuid(0x79))) + } +} + #endif diff --git a/Tests/GroveHealthKitFHIRTests/HealthKitAggregateConversionTests.swift b/Tests/GroveHealthKitFHIRTests/HealthKitAggregateConversionTests.swift index 310f43b06..5c353e1ea 100644 --- a/Tests/GroveHealthKitFHIRTests/HealthKitAggregateConversionTests.swift +++ b/Tests/GroveHealthKitFHIRTests/HealthKitAggregateConversionTests.swift @@ -193,7 +193,7 @@ struct HealthKitFHIRAggregateConversionTests { @Test("Every registered type a bare sample cannot convert is refused for what its catalog row states") func unconvertibleRowsFailClosedWithTheirCatalogReason() throws { let notYetConvertible = Set([ - .audiogram, .biologicalSex, .bloodType, .dateOfBirth, .fitzpatrickSkinType, .wheelchairUse, + .biologicalSex, .bloodType, .dateOfBirth, .fitzpatrickSkinType, .wheelchairUse, .visionPrescription, .medicationDoseEvent, .userAnnotatedMedicationConcept ]).union(Platform27Fixtures.isAvailable ? [] : Platform27Fixtures.convertibleOnlyWhereAvailable) let recordingDocuments: Set = [ diff --git a/Tests/GroveHealthKitFHIRTests/HealthKitAudiogramContentTests.swift b/Tests/GroveHealthKitFHIRTests/HealthKitAudiogramContentTests.swift new file mode 100644 index 000000000..c81e06205 --- /dev/null +++ b/Tests/GroveHealthKitFHIRTests/HealthKitAudiogramContentTests.swift @@ -0,0 +1,228 @@ +// +// This source file is part of the Grove open-source project +// +// SPDX-FileCopyrightText: 2026 Stanford University and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + +#if canImport(HealthKit) + +import Foundation +@testable import GroveFHIRContract +@testable import GroveHealthKitFHIR +import HealthKit +import ModelsR4 +import Testing + + +/// The audiogram panel: one component per sensitivity test, coded where the catalog names the ear and frequency, with +/// the test's details in the sensitivity-test extension. +@Suite +struct HealthKitAudiogramContentTests { + /// One sensitivity test. + @available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) + struct Test { + var side: HKAudiogramSensitivityTestSide = .left + var decibels: Double = 25 + var masked = false + var clamping: (lower: Double?, upper: Double?)? + } + + private static let extensionURL = "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + + @available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) + private static func point(hertz: Double, _ tests: [Test]) throws -> HKAudiogramSensitivityPoint { + let tests = try tests.map { test in + try HKAudiogramSensitivityTest( + sensitivity: HKQuantity(unit: .decibelHearingLevel(), doubleValue: test.decibels), + type: .air, + masked: test.masked, + side: test.side, + clampingRange: try test.clamping.map { bounds in + try HKAudiogramSensitivityPointClampingRange( + lowerBound: bounds.lower.map { NSNumber(value: $0) }, + upperBound: bounds.upper.map { NSNumber(value: $0) } + ) + } + ) + } + return try HKAudiogramSensitivityPoint(frequency: HKQuantity(unit: .hertz(), doubleValue: hertz), tests: tests) + } + + @available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) + private static func sample(_ points: [HKAudiogramSensitivityPoint], duration: TimeInterval = 300) throws -> HKAudiogramSample { + let start = GoldenFixtures.conversionInstant.addingTimeInterval(-600) + let sample = HKAudiogramSample( + sensitivityPoints: points, + start: start, + end: start.addingTimeInterval(duration), + device: nil, + metadata: GoldenFixtures.timeZoneMetadata + ) + return try StoredSampleFixtures.stored(sample, uuid: GoldenFixtures.uuid(0xE7)) + } + + /// The components the audiogram content sets for `points`, as wire JSON objects. + @available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) + private static func components(_ points: [HKAudiogramSensitivityPoint]) throws -> [[String: Any]] { + let content = try HealthKitAudiogramContent(HealthKitMeasurementCatalog.audiogramPanel) + var observation = Observation(code: CodeableConcept(), status: FHIRPrimitive(.final)) + try content.apply(to: &observation, sample: try sample(points)) + #expect(observation.value == nil) + let data = try JSONEncoder().encode(try #require(observation.component)) + return try #require(try JSONSerialization.jsonObject(with: data) as? [[String: Any]]) + } + + /// The sensitivity-test extension's members of a component, by member URL. + private static func details(_ component: [String: Any]) throws -> [String: [String: Any]] { + let extensions = try #require(component["extension"] as? [[String: Any]]) + #expect(extensions.count == 1) + #expect(extensions.first?["url"] as? String == extensionURL) + let members = try #require(extensions.first?["extension"] as? [[String: Any]]) + return Dictionary(members.map { ($0["url"] as? String ?? "", $0) }) { first, _ in first } + } + + /// The first Observation of a record's Bundle. + private static func observation(in json: Data) throws -> Observation? { + let bundle = try JSONDecoder().decode(ModelsR4.Bundle.self, from: json) + return bundle.entry?.lazy.compactMap { $0.resource?.get() as? Observation }.first + } + + @Test("A catalog ear and frequency uses its LOINC component and the catalog's integer frequency, keeping masking and clamping bounds") + func codedTest() throws { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + return + } + let components = try Self.components([Self.point(hertz: 250, [Test(masked: true, clamping: (-10, 80))])]) + try #require(components.count == 1) + let component = components[0] + #expect(component["code"] as? NSDictionary == ["coding": [["system": "http://loinc.org", "code": "91375-6"]]]) + #expect(component["valueQuantity"] as? NSDictionary == ["value": 25, "unit": "dB", "system": "http://unitsofmeasure.org", "code": "dB"]) + let members = try Self.details(component) + #expect(Set(members.keys) == ["frequency", "ear", "conduction", "masked", "clampingRange"]) + let frequency = try #require(members["frequency"]?["valueQuantity"] as? [String: Any]) + #expect(frequency as NSDictionary == ["value": 250, "unit": "Hz", "system": "http://unitsofmeasure.org", "code": "Hz"]) + #expect((frequency["value"] as? NSNumber).map { CFNumberIsFloatType($0) } == false) + #expect(members["ear"]?["valueCode"] as? String == "left") + #expect(members["conduction"]?["valueCode"] as? String == "air") + #expect(members["masked"]?["valueBoolean"] as? Bool == true) + let range = try #require(members["clampingRange"]?["valueRange"] as? [String: Any]) + #expect(range["low"] as? NSDictionary == ["value": -10, "unit": "dB", "system": "http://unitsofmeasure.org", "code": "dB"]) + #expect(range["high"] as? NSDictionary == ["value": 80, "unit": "dB", "system": "http://unitsofmeasure.org", "code": "dB"]) + } + + @Test("A frequency the catalog does not code keeps its exact value under a text-only code, never a neighbouring frequency's") + func uncodedFrequency() throws { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + return + } + let components = try Self.components([Self.point(hertz: 1_250.5, [Test(side: .right, decibels: 30)])]) + try #require(components.count == 1) + let component = components[0] + #expect(component["code"] as? NSDictionary == ["text": "Air conduction threshold, right ear, 1250.5 Hz"]) + #expect((component["valueQuantity"] as? [String: Any])?["value"] as? Double == 30) + let members = try Self.details(component) + #expect(Set(members.keys) == ["frequency", "ear", "conduction", "masked"]) + #expect((members["frequency"]?["valueQuantity"] as? [String: Any])?["value"] as? Double == 1_250.5) + #expect(members["ear"]?["valueCode"] as? String == "right") + } + + @Test("A frequency within a millihertz of a catalog frequency is that catalog component, as the panel invariant compares them") + func catalogFrequencyByMillihertz() throws { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + return + } + let components = try Self.components([Self.point(hertz: 250.000_4, [Test()])]) + try #require(components.count == 1) + #expect((components[0]["code"] as? [String: Any])?["coding"] != nil) + #expect((try Self.details(components[0])["frequency"]?["valueQuantity"] as? [String: Any])?["value"] as? Int == 250) + #expect(HealthKitAudiogramContent.millihertz(try GroveFHIRDecimal(250.000_4).decimal) == 250_000) + // In binary64, 128.003 * 1000 is 128002.99999999999; the decimal the record states is 128.003. + #expect(HealthKitAudiogramContent.millihertz(try GroveFHIRDecimal(128.003).decimal) == 128_003) + #expect(HealthKitAudiogramContent.millihertz(try GroveFHIRDecimal(0.000_9).decimal) == 0) + #expect(HealthKitAudiogramContent.millihertz(0) == nil) + #expect(HealthKitAudiogramContent.millihertz(-1) == nil) + #expect(HealthKitAudiogramContent.millihertz(try GroveFHIRDecimal(1e17).decimal) == nil) + } + + @Test("Each ear keeps its own masking state, and components follow frequency, then ear") + func bothEarsInOrder() throws { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + return + } + let components = try Self.components([ + Self.point(hertz: 125, [Test(side: .left)]), + Self.point(hertz: 1_000, [Test(side: .right), Test(side: .left, masked: true)]) + ]) + let codes = components.map { component in + ((component["code"] as? [String: Any])?["coding"] as? [[String: Any]])?.first?["code"] as? String + ?? (component["code"] as? [String: Any])?["text"] as? String + } + #expect(codes == ["Air conduction threshold, left ear, 125 Hz", "89016-0", "89017-8"]) + let masking = try components.map { try Self.details($0)["masked"]?["valueBoolean"] as? Bool } + #expect(masking == [false, true, false]) + } + + @Test("A second test of one ear at one frequency, an empty point or audiogram, and an empty clamping range are refused") + func invalidShapes() throws { + // HealthKit refuses most of these shapes itself, so they are built as readings rather than samples. + let content = try HealthKitAudiogramContent(HealthKitMeasurementCatalog.audiogramPanel) + let left = HealthKitAudiogramContent.Reading(ear: .left, sensitivity: 25) + let point = { (hertz: Double, readings: [HealthKitAudiogramContent.Reading]) in + HealthKitAudiogramContent.Point(frequency: try GroveFHIRDecimal(hertz), readings: readings) + } + var equalBounds = left + equalBounds.lowerBound = 80 + equalBounds.upperBound = 80 + let cases: [[HealthKitAudiogramContent.Point]] = [ + [try point(250, [left]), try point(250.000_5, [left])], + [try point(128.003, [left]), try point(128.003_000_1, [left])], + [try point(250, [left, left])], + [try point(250, [])], + [try point(0, [left])], + [], + [try point(250, [equalBounds])] + ] + for points in cases { + #expect(throws: HealthKitConversionError.ValueFailure.shapeInvalid, "\(points.map(\.frequency.lexical))") { + try content.components(points) + } + } + var bounded = left + bounded.lowerBound = -10 + #expect(try content.components([try point(128.002, [left]), try point(128.003, [bounded])]).count == 2) + } + + @Test("An audiogram exports its whole test interval as a period, a point test as an instant, and a stable record") + func exchangeRecord() async throws { + guard #available(iOS 18.1, macOS 15.1, watchOS 11.1, visionOS 2.1, *) else { + return + } + let exporter = try ExporterFixtures.exporter() + let points = [try Self.point(hertz: 250, [Test()]), try Self.point(hertz: 1_250, [Test(side: .right)])] + let sample = try Self.sample(points) + let first = try await ExporterFixtures.collect(exporter, [.sample(sample)]) + let second = try await ExporterFixtures.collect(exporter, [.sample(sample)]) + let record = try #require(first.first?.record) + #expect(second.first?.record?.json == record.json) + let observation = try #require(try Self.observation(in: record.json)) + guard case .period(let period) = observation.effective else { + Issue.record("A hearing test interval must not be reduced to its start") + return + } + #expect(period.start != period.end) + #expect(observation.component?.count == 2) + #expect(observation.meta?.profile == [Profile.healthkitAudiogramPanel]) + + let instant = try await ExporterFixtures.collect(exporter, [.sample(try Self.sample(points, duration: 0))]) + let instantRecord = try #require(instant.first?.record) + let pointObservation = try #require(try Self.observation(in: instantRecord.json)) + guard case .dateTime = pointObservation.effective else { + Issue.record("A test without an interval states an instant") + return + } + } +} + +#endif diff --git a/Tests/GroveHealthKitFHIRTests/HealthKitContentCompilerTests.swift b/Tests/GroveHealthKitFHIRTests/HealthKitContentCompilerTests.swift index ac60a4d35..b46490345 100644 --- a/Tests/GroveHealthKitFHIRTests/HealthKitContentCompilerTests.swift +++ b/Tests/GroveHealthKitFHIRTests/HealthKitContentCompilerTests.swift @@ -26,6 +26,8 @@ struct ContractDraft { var quantity: QuantityContract? /// The components. var components: [ComponentContract] + /// The extension every component carries. + var componentExtension: ComponentExtensionContract? /// The CodeSystem of the coded results. var resultCodeSystem: String? /// The codes the contract admits without publishing them. @@ -42,6 +44,7 @@ struct ContractDraft { requiredCodings: base.requiredCodings, quantity: quantity, components: components, + componentExtension: componentExtension, resultCodeSystem: resultCodeSystem, allowedValues: allowedValues, resultCodes: resultCodes, @@ -58,6 +61,7 @@ struct ContractDraft { self.base = base code = base.code quantity = base.quantity + componentExtension = base.componentExtension components = base.components resultCodeSystem = base.resultCodeSystem allowedValues = base.allowedValues @@ -120,6 +124,46 @@ struct HealthKitContentCompilerTests { try Self.expectRefused(.appleWalkingSteadinessEvent, "states no coded component notification-occurrence") { $0.components = [] } } + @Test("An audiogram contract without its component extension, or with a component that fixes no single ear and frequency, refuses the audiogram") + func audiogramMismatchesRefuseTheType() throws { + let ear = ExtensionValueContract(member: "ear", valueCode: "left") + let frequency = ExtensionValueContract(member: "frequency", valueQuantity: "250", system: "http://unitsofmeasure.org", code: "Hz") + try Self.expectRefused(.audiogram, "states no extension for its audiogram components") { $0.componentExtension = nil } + try Self.expectRefused(.audiogram, "states no audiogram sensitivity quantity") { $0.components = [] } + try Self.expectRefused(.audiogram, "states audiogram component left-250 at ear both") { draft in + draft.component("left-250") { $0.with(extensionValues: [frequency, ExtensionValueContract(member: "ear", valueCode: "both")]) } + } + try Self.expectRefused(.audiogram, "states audiogram component left-250 without one ear and positive frequency") { draft in + draft.component("left-250") { $0.with(extensionValues: [ear]) } + } + try Self.expectRefused(.audiogram, "fixes audiogram component left-250 member ear unexpectedly") { draft in + draft.component("left-250") { $0.with(extensionValues: [frequency, ear, ear]) } + } + try Self.expectRefused(.audiogram, "fixes audiogram component left-250 member masked unexpectedly") { draft in + draft.component("left-250") { $0.with(extensionValues: [frequency, ear, ExtensionValueContract(member: "masked", valueBoolean: false)]) } + } + try Self.expectRefused(.audiogram, "states audiogram ear left at 250 Hz twice") { draft in + draft.component("left-500") { $0.with(extensionValues: [frequency, ear]) } + } + try Self.expectRefused(.audiogram, "states audiogram component left-500 in another quantity") { draft in + draft.component("left-500") { $0.with(quantity: QuantityContract(system: "http://unitsofmeasure.org", code: "dB[SPL]", unit: "dB")) } + } + try Self.expectRefused(.audiogram, "states audiogram frequencies in more than one unit") { draft in + let kilohertz = ExtensionValueContract(member: "frequency", valueQuantity: "0.5", system: "http://unitsofmeasure.org", code: "kHz") + draft.component("left-500") { $0.with(extensionValues: [kilohertz, ear]) } + } + try Self.expectRefused(.audiogram, "states audiogram frequencies in a unit other than UCUM Hz") { draft in + draft.components = draft.components.map { component in + component.with(extensionValues: component.extensionValues.map { fixed in + guard case let .quantity(value, system, _) = fixed.value else { + return fixed + } + return ExtensionValueContract(member: fixed.member, valueQuantity: "\(value)", system: system, code: "kHz") + }) + } + } + } + @Test("A hand-written workout, State of Mind or notification-occurrence code the contract does not admit refuses its type") func unadmittedCodesRefuseTheType() throws { let workoutSystem = try #require(MeasurementCatalog.workout.resultCodeSystem) @@ -292,6 +336,19 @@ extension HealthKitContentCompilerTests { extension ComponentContract { + /// The component fixing `extensionValues` instead of its own. + func with(extensionValues: [ExtensionValueContract]) -> ComponentContract { + ComponentContract( + id: id, + system: system, + code: code, + quantity: quantity, + resultCodeSystem: resultCodeSystem, + resultCodes: resultCodes, + extensionValues: extensionValues + ) + } + /// The component under `id`, coded `code`, read in `quantity`, publishing only the result codes `keep` keeps. func with( id: String? = nil, @@ -305,7 +362,8 @@ extension ComponentContract { code: code ?? self.code, quantity: quantity ?? self.quantity, resultCodeSystem: resultCodeSystem, - resultCodes: resultCodes.filter(keep) + resultCodes: resultCodes.filter(keep), + extensionValues: extensionValues ) } } diff --git a/Tests/GroveHealthKitFHIRTests/HealthKitConverterTests.swift b/Tests/GroveHealthKitFHIRTests/HealthKitConverterTests.swift index 70d6a6eeb..45b538b10 100644 --- a/Tests/GroveHealthKitFHIRTests/HealthKitConverterTests.swift +++ b/Tests/GroveHealthKitFHIRTests/HealthKitConverterTests.swift @@ -871,7 +871,7 @@ struct HealthKitFHIRConverterTests { // (the characteristics are no HKSample at all). Every other row converts its own sample; a row of another // status never does. let servedByRecordEntryPoint: Set = [.electrocardiogram, .food] - let notYetEmitted = Set([.audiogram, .biologicalSex, .bloodType, .dateOfBirth, .fitzpatrickSkinType, .wheelchairUse]) + let notYetEmitted = Set([.biologicalSex, .bloodType, .dateOfBirth, .fitzpatrickSkinType, .wheelchairUse]) .union(Platform27Fixtures.isAvailable ? [] : Platform27Fixtures.convertibleOnlyWhereAvailable) for row in rows { let type = HealthKitSourceType(rawValue: row.sourceTypeIdentifier) diff --git a/Tests/GroveHealthKitFHIRTests/HealthKitFHIRExporterTests.swift b/Tests/GroveHealthKitFHIRTests/HealthKitFHIRExporterTests.swift index 43aafb0f0..686c8095b 100644 --- a/Tests/GroveHealthKitFHIRTests/HealthKitFHIRExporterTests.swift +++ b/Tests/GroveHealthKitFHIRTests/HealthKitFHIRExporterTests.swift @@ -162,7 +162,7 @@ struct HealthKitFHIRExporterTests { let notYetConvertible = ExchangeGraphRule.mobileInputNotYetConvertible.diagnostic(at: "HKSample.sampleType") let expected: [(HealthKitConversionError, ProducerDiagnostic)] = [ (.invalidValue(.stepCount, .outsideDomain), ExchangeGraphRule.mobileInputValueOutsideDomain.diagnostic(at: "HKSample.value")), - (.notYetConvertible(.audiogram), notYetConvertible), + (.invalidValue(.audiogram, .shapeInvalid), ExchangeGraphRule.mobileInputValueShapeInvalid.diagnostic(at: "HKSample.value")), (.notYetConvertible(.visionPrescription), notYetConvertible) ] let samples: [HKSample] = [fractionalSteps, audiogram, prescription, try GoldenFixtures.heartRate(uuid: GoldenFixtures.uuid(8))] diff --git a/Tests/GroveHealthKitFHIRTests/Resources/ContentCorpus/content-corpus.jsonl b/Tests/GroveHealthKitFHIRTests/Resources/ContentCorpus/content-corpus.jsonl index 325c91681..07bf3c428 100644 --- a/Tests/GroveHealthKitFHIRTests/Resources/ContentCorpus/content-corpus.jsonl +++ b/Tests/GroveHealthKitFHIRTests/Resources/ContentCorpus/content-corpus.jsonl @@ -2431,7 +2431,7 @@ {"id":"assessment/HKScoredAssessmentTypeIdentifierPHQ9/14","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"assessment":{"score":14,"type":"HKScoredAssessmentTypeIdentifierPHQ9"}},"start":1787005800,"writer":"unattributed"}}},"output":{"graphs":[{"envelope":{"digest":"3b2fc723669a9c9cc95a9dd1278848ded3698531cc6f4c9fd2e809684e113286","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"_effectiveDateTime":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"America/Los_Angeles"}]},"code":{"coding":[{"code":"44261-6","display":"Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]","system":"http://loinc.org"}]},"effectiveDateTime":"2026-08-17T15:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKScoredAssessmentTypeIdentifierPHQ9"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:oDcWD3H5Nzbu6JTo-wqFh3Cy9CVrzpDhGlIjrS7oH-c"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:zvmbhc8M7iZhYmhD0ZjaGmizzP3mtM_pBk5TV8yEVF0"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-phq9-assessment"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueQuantity":{"code":"{score}","system":"http://unitsofmeasure.org","unit":"score","value":14}}],"warnings":[]}]}} {"id":"assessment/HKScoredAssessmentTypeIdentifierPHQ9/27","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"assessment":{"score":27,"type":"HKScoredAssessmentTypeIdentifierPHQ9"}},"start":1787005800,"writer":"unattributed"}}},"output":{"graphs":[{"envelope":{"digest":"7218e956ebdb3f2a142c1e07a1dee226759a8bbde339fbe5a318a0f76adbf745","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"_effectiveDateTime":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"America/Los_Angeles"}]},"code":{"coding":[{"code":"44261-6","display":"Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]","system":"http://loinc.org"}]},"effectiveDateTime":"2026-08-17T15:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKScoredAssessmentTypeIdentifierPHQ9"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:oDcWD3H5Nzbu6JTo-wqFh3Cy9CVrzpDhGlIjrS7oH-c"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:zvmbhc8M7iZhYmhD0ZjaGmizzP3mtM_pBk5TV8yEVF0"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-phq9-assessment"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueQuantity":{"code":"{score}","system":"http://unitsofmeasure.org","unit":"score","value":27}}],"warnings":[]}]}} {"id":"assessment/HKScoredAssessmentTypeIdentifierPHQ9/28","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"assessment":{"score":28,"type":"HKScoredAssessmentTypeIdentifierPHQ9"}},"start":1787005800,"writer":"unattributed"}}},"output":{"graphs":[{"envelope":{"digest":"e359339fa8cef96f116748648b2ada2d73479343ac972a115e0e9b6cbd3e1ed1","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"_effectiveDateTime":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"America/Los_Angeles"}]},"code":{"coding":[{"code":"44261-6","display":"Patient Health Questionnaire 9 item (PHQ-9) total score [Reported]","system":"http://loinc.org"}]},"effectiveDateTime":"2026-08-17T15:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKScoredAssessmentTypeIdentifierPHQ9"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:oDcWD3H5Nzbu6JTo-wqFh3Cy9CVrzpDhGlIjrS7oH-c"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:zvmbhc8M7iZhYmhD0ZjaGmizzP3mtM_pBk5TV8yEVF0"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-phq9-assessment"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueQuantity":{"code":"{score}","system":"http://unitsofmeasure.org","unit":"score","value":28}}],"warnings":[]}]}} -{"id":"row/HKDataTypeIdentifierAudiogram","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"bare":{"sampleClass":"HKAudiogramSample","type":"HKDataTypeIdentifierAudiogram"}},"start":1787005800,"writer":"unattributed"}}},"output":{"refused":{"code":"mobile-input.not-yet-convertible","error":"notYetConvertible(GroveHealthKitFHIR.HealthKitSourceType.audiogram)","location":"HKSample.sampleType"}}} +{"id":"row/HKDataTypeIdentifierAudiogram","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"bare":{"sampleClass":"HKAudiogramSample","type":"HKDataTypeIdentifierAudiogram"}},"start":1787005800,"writer":"unattributed"}}},"output":{"refused":{"code":"mobile-input.value-shape-invalid","error":"invalidValue(GroveHealthKitFHIR.HealthKitSourceType.audiogram, GroveHealthKitFHIR.HealthKitConversionError.ValueFailure.shapeInvalid)","location":"HKSample.value"}}} {"id":"row/HKVisionPrescriptionTypeIdentifier","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"bare":{"sampleClass":"HKVisionPrescription","type":"HKVisionPrescriptionTypeIdentifier"}},"start":1787005800,"writer":"unattributed"}}},"output":{"refused":{"code":"mobile-input.not-yet-convertible","error":"notYetConvertible(GroveHealthKitFHIR.HealthKitSourceType.visionPrescription)","location":"HKSample.sampleType"}}} {"id":"row/HKMedicationDoseEventTypeIdentifierMedicationDoseEvent","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"bare":{"sampleClass":"HKMedicationDoseEvent","type":"HKMedicationDoseEventTypeIdentifierMedicationDoseEvent"}},"start":1787005800,"writer":"unattributed"}}},"output":{"refused":{"code":"mobile-input.not-yet-convertible","error":"notYetConvertible(GroveHealthKitFHIR.HealthKitSourceType.medicationDoseEvent)","location":"HKSample.sampleType"}}} {"id":"metadata/heart-rate-motion-context/absent","input":{"convert":{"source":{"context":"plain","end":1787005800,"metadata":{"HKTimeZone":{"string":"America/Los_Angeles"}},"record":{"quantity":{"type":"HKQuantityTypeIdentifierHeartRate","unit":"count/min","value":72}},"start":1787005800,"writer":"unattributed"}}},"output":{"graphs":[{"envelope":{"digest":"b958bbc61beb0a49b66ab07f36a61dc3ed371daa16b0ceab0f5b11faf1965815","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"_effectiveDateTime":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"America/Los_Angeles"}]},"category":[{"coding":[{"code":"vital-signs","display":"Vital Signs","system":"http://terminology.hl7.org/CodeSystem/observation-category"}]}],"code":{"coding":[{"code":"8867-4","display":"Heart rate","system":"http://loinc.org"}]},"effectiveDateTime":"2026-08-17T15:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierHeartRate"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:VVvJDi4nChkPklE2zNFnjsI8R2EESNY6ZmkQjLVNsjQ"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:BCDmF07PwhPGl9-EQEJTCAcXAM-B0OSsO_sKoMDE5rE"}],"meta":{"profile":["https://grovealliance.org/fhir/mobile/StructureDefinition/grove-mobile-heart-rate","https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-observation"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueQuantity":{"code":"/min","system":"http://unitsofmeasure.org","unit":"beats/minute","value":72}}],"warnings":[]}]}} @@ -2751,7 +2751,7 @@ {"id":"retraction/HKClinicalTypeIdentifierVitalSignRecord","input":{"retract":{"type":"HKClinicalTypeIdentifierVitalSignRecord"}},"output":{"targets":[{"identifier":"v0:test:1:S8gBqR2RHltEgsuLmRnqOIgk9fsbD9F8IDYewal3Bok","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} {"id":"retraction/HKCorrelationTypeIdentifierBloodPressure","input":{"retract":{"type":"HKCorrelationTypeIdentifierBloodPressure"}},"output":{"targets":[{"identifier":"v0:test:1:doVPnvrBLloit0idVcBN7j360amKQX_nsASUbcTd7a8","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} {"id":"retraction/HKCorrelationTypeIdentifierFood","input":{"retract":{"type":"HKCorrelationTypeIdentifierFood"}},"output":{"targets":[{"identifier":"v0:test:1:MJHOjFAx3mD3UMBJLPckXNd80Z1IB8IX-fPBvkLXpFI","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} -{"id":"retraction/HKDataTypeIdentifierAudiogram","input":{"retract":{"type":"HKDataTypeIdentifierAudiogram"}},"output":{"nothingToRetract":true}} +{"id":"retraction/HKDataTypeIdentifierAudiogram","input":{"retract":{"type":"HKDataTypeIdentifierAudiogram"}},"output":{"targets":[{"identifier":"v0:test:1:Rp9og86BcrsR8R8ytV3Q-kBlR6yswhil5pGZPhY9_hE","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} {"id":"retraction/HKDataTypeIdentifierElectrocardiogram","input":{"retract":{"type":"HKDataTypeIdentifierElectrocardiogram"}},"output":{"targets":[{"identifier":"v0:test:1:BoF9u897SMv64Ln9nWgrLmX8VA9uyPRdmNk6SJY0krI","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} {"id":"retraction/HKDataTypeIdentifierHeartbeatSeries","input":{"retract":{"type":"HKDataTypeIdentifierHeartbeatSeries"}},"output":{"targets":[{"identifier":"v0:test:1:iX--MzI0MGrvyapHnU73sSiP2C1nLB-KvIvZjrB-afY","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} {"id":"retraction/HKDataTypeStateOfMind","input":{"retract":{"type":"HKDataTypeStateOfMind"}},"output":{"targets":[{"identifier":"v0:test:1:0U0d2dJDVBb4EF6BnvvO-EQZOfbxAqo27Ij8qO8q0nQ","identifierRole":"source-record","identifierSystem":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","nativeRecordIdentifier":null,"resourceType":"","role":"source-record"}]}} @@ -2978,7 +2978,7 @@ {"id":"catalog/entry/HKClinicalTypeIdentifierVitalSignRecord","input":{"catalog":{"projection":{"entry":{"type":"HKClinicalTypeIdentifierVitalSignRecord"}}}},"output":{"measurements":[],"outputs":[{"discriminator":"single","role":"clinical-record"}],"requirement":null,"status":"platform-exclusive","title":"Vital Sign Record"}} {"id":"catalog/entry/HKCorrelationTypeIdentifierBloodPressure","input":{"catalog":{"projection":{"entry":{"type":"HKCorrelationTypeIdentifierBloodPressure"}}}},"output":{"measurements":[{"id":"blood-pressure","profiles":["https://grovealliance.org/fhir/mobile/StructureDefinition/grove-mobile-blood-pressure"]}],"outputs":[{"discriminator":"single","role":"blood-pressure"}],"requirement":null,"status":"supported","title":"Blood Pressure"}} {"id":"catalog/entry/HKCorrelationTypeIdentifierFood","input":{"catalog":{"projection":{"entry":{"type":"HKCorrelationTypeIdentifierFood"}}}},"output":{"measurements":[{"id":"food-correlation","profiles":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-food-correlation"]}],"outputs":[{"discriminator":"single","role":"food-correlation"}],"requirement":null,"status":"supported","title":"Food"}} -{"id":"catalog/entry/HKDataTypeIdentifierAudiogram","input":{"catalog":{"projection":{"entry":{"type":"HKDataTypeIdentifierAudiogram"}}}},"output":{"measurements":[{"id":"audiogram-panel","profiles":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel"]}],"outputs":[],"requirement":null,"status":"supported","title":"Audiogram"}} +{"id":"catalog/entry/HKDataTypeIdentifierAudiogram","input":{"catalog":{"projection":{"entry":{"type":"HKDataTypeIdentifierAudiogram"}}}},"output":{"measurements":[{"id":"audiogram-panel","profiles":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel"]}],"outputs":[{"discriminator":"single","role":"audiogram-panel"}],"requirement":null,"status":"supported","title":"Audiogram"}} {"id":"catalog/entry/HKDataTypeIdentifierElectrocardiogram","input":{"catalog":{"projection":{"entry":{"type":"HKDataTypeIdentifierElectrocardiogram"}}}},"output":{"measurements":[{"id":"electrocardiogram","profiles":["https://grovealliance.org/fhir/sensor/StructureDefinition/grove-sensor-ecg-observation","https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-ecg-observation"]}],"outputs":[{"discriminator":"single","role":"electrocardiogram"},{"discriminator":"single","role":"average-heart-rate"}],"requirement":"The caller supplies the HKElectrocardiogram, every voltage measurement with its exact timeSinceSampleStart, and each associated HKCategorySample when symptomsStatus is present. Classification is Observation.interpretation; Apple ECG algorithm version is Observation.method; optional average heart rate is a separate LOINC 8867-4 Observation derived from the waveform. Each supplied symptom is converted through its existing HealthKit symptom Observation profile as a separate record, and the ECG hasMember carries that Observation's opaque source-output Identifier. Sampling frequency and reported count are validated against SampledData but are not duplicated on the wire. The adapter preserves source and waveform intervals, lead, offsets, and voltages without fetching or resampling.","status":"supported","title":"ECG"}} {"id":"catalog/entry/HKDataTypeIdentifierHeartbeatSeries","input":{"catalog":{"projection":{"entry":{"type":"HKDataTypeIdentifierHeartbeatSeries"}}}},"output":{"measurements":[],"outputs":[{"discriminator":"single","role":"native-recording"}],"requirement":"The beat-to-beat interval series is admitted as a recording document carrying the published beat-interval-series column schema. No shared measurement models a beat series, so the samples are carried rather than reduced to a scalar.","status":"platform-exclusive","title":"Heartbeat Series"}} {"id":"catalog/entry/HKDataTypeStateOfMind","input":{"catalog":{"projection":{"entry":{"type":"HKDataTypeStateOfMind"}}}},"output":{"measurements":[{"id":"state-of-mind","profiles":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-state-of-mind"]}],"outputs":[{"discriminator":"single","role":"state-of-mind"}],"requirement":null,"status":"supported","title":"State of Mind"}} @@ -3484,7 +3484,7 @@ {"id":"guide-example/HealthkitAppleStandHourExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"apple-stand-hour","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierAppleStandHour"}],"id":"HealthkitAppleStandHourExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:7v9Ew6YEQt7z6uD-ZfVTNLMuWXYUyZjWQnkkzFPCFlo"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:Sh3-0x_ATHMvEI2s2pisKKmY2lFKk7Dg7npVmd0PTTg"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-apple-stand-hour"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"stood","display":"Stood","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-apple-stand-hour"}]}}}},"output":{"graphs":[{"envelope":{"digest":"0d695e1929fae1ee3db6d6a0a6d1fcf416fcf5a3ae80047ec318e4c00c27763f","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"code":{"coding":[{"code":"apple-stand-hour","display":"Apple stand hour","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"_end":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"_start":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierAppleStandHour"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:vb6Mfc21GK9LqlIbMmGIMnrTbves8H15eyJKnpTtrbc"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:F5qkX0j8T8ydE-WYzM0JQo3lhE2VYMnbV_7xvuovUe4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-apple-stand-hour"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueCodeableConcept":{"coding":[{"code":"stood","display":"Stood","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-apple-stand-hour"},{"code":"stood","display":"Stood","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-apple-stand-hour-value"}]}}],"warnings":["mobile-omission.unmodeled-metadata@HKSample.metadata"]}]}} {"id":"guide-example/HealthkitAppleStandTimeExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"apple-stand-time","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierAppleStandTime"}],"id":"HealthkitAppleStandTimeExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:CuC4LLtLAGd_DtyiKlrsLLVF5CUqMNp40xCZcR3Xv5g"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:-JhtKvdVPcj4t7VlNH7STBOF42Sk9IrcA6h7CBgXQ-I"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-apple-stand-time"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueQuantity":{"code":"min","system":"http://unitsofmeasure.org","value":12}}}},"output":{"graphs":[{"envelope":{"digest":"f76ab57b3a531b4c779bac28501b4e3762fc2ec102c1a1b5864ff2eeecc56c7b","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"code":{"coding":[{"code":"apple-stand-time","display":"Apple stand time","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"_end":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"_start":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierAppleStandTime"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:Hw2qC_hew8UkTfpI8ROTjPzbk1ekCxXT06o_UGmIxkQ"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:daOjL79ce3xQTDRVgROPuo8dN8W_eSLZJ4nHGejd0ew"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-apple-stand-time"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueQuantity":{"code":"min","system":"http://unitsofmeasure.org","unit":"min","value":12}}],"warnings":["mobile-omission.unmodeled-metadata@HKSample.metadata"]}]}} {"id":"guide-example/HealthkitAtrialFibrillationBurdenExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"atrial-fibrillation-burden","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierAtrialFibrillationBurden"}],"id":"HealthkitAtrialFibrillationBurdenExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:UrrXwtYPzF9Hsv40BxrvwTDxf3CVCfa7lsYDhd-WUEA"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:MZTLTdpfBNqgGCH1s2trcW6VO2RLbODh52Iavn0RvKE"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-atrial-fibrillation-burden"]},"method":{"coding":[{"code":"percentage-of-time","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-aggregation-method"}]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueQuantity":{"code":"%","system":"http://unitsofmeasure.org","value":2}}}},"output":{"graphs":[{"envelope":{"digest":"9429c908797236190a2eb087addae9f694d1560b3cbbf56af3ac9a2eb4bc9de4","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"code":{"coding":[{"code":"atrial-fibrillation-burden","display":"Atrial fibrillation burden","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"_end":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"_start":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierAtrialFibrillationBurden"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:QFqNHSl1pCaoySLlNU3JbTR9Dg-8TbgZCkNEyQWPMJ4"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:WFpyh4vwA1cbaQ4A8WEmRPD7dvo6ZnjXF857GwsiwZQ"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-atrial-fibrillation-burden"]},"method":{"coding":[{"code":"percentage-of-time","display":"Percentage of time","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-aggregation-method"}]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueQuantity":{"code":"%","system":"http://unitsofmeasure.org","unit":"%","value":2}}],"warnings":["mobile-omission.unmodeled-metadata@HKSample.metadata"]}]}} -{"id":"guide-example/HealthkitAudiogramPanelExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"89015-2","display":"Pure tone air conduction threshold audiometry panel","system":"http://loinc.org"}]},"component":[{"code":{"coding":[{"code":"91375-6","system":"http://loinc.org"}]},"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":20}},{"code":{"coding":[{"code":"91374-9","system":"http://loinc.org"}]},"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":25}}],"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKDataTypeIdentifierAudiogram"}],"id":"HealthkitAudiogramPanelExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:xRWq80LfUXEp-pfC_99R-9PkqhJ_LIfZ-CVjGDeCZBU"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:bza8NKWu5vBX5kJmd7z7sxz9yE4zq7j3FCcPJXQdVI4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"}}}},"output":{"unprojected":{"code":"mobile-input.unsupported-source-type","error":"measurementNotMappable(id: \"audiogram-panel\")"}}} +{"id":"guide-example/HealthkitAudiogramPanelExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"89015-2","display":"Pure tone air conduction threshold audiometry panel","system":"http://loinc.org"}]},"component":[{"code":{"coding":[{"code":"91375-6","system":"http://loinc.org"}]},"extension":[{"extension":[{"url":"frequency","valueQuantity":{"code":"Hz","system":"http://unitsofmeasure.org","value":250}},{"url":"ear","valueCode":"left"},{"url":"conduction","valueCode":"air"},{"url":"masked","valueBoolean":false}],"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test"}],"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":20}},{"code":{"coding":[{"code":"91374-9","system":"http://loinc.org"}]},"extension":[{"extension":[{"url":"frequency","valueQuantity":{"code":"Hz","system":"http://unitsofmeasure.org","value":250}},{"url":"ear","valueCode":"right"},{"url":"conduction","valueCode":"air"},{"url":"masked","valueBoolean":false}],"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test"}],"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":25}}],"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKDataTypeIdentifierAudiogram"}],"id":"HealthkitAudiogramPanelExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:xRWq80LfUXEp-pfC_99R-9PkqhJ_LIfZ-CVjGDeCZBU"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:bza8NKWu5vBX5kJmd7z7sxz9yE4zq7j3FCcPJXQdVI4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"}}}},"output":{"unprojected":{"code":"mobile-input.unsupported-source-type","error":"measurementNotMappable(id: \"audiogram-panel\")"}}} {"id":"guide-example/HealthkitBiologicalSexExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"46098-0","display":"Sex","system":"http://loinc.org"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCharacteristicTypeIdentifierBiologicalSex"}],"id":"HealthkitBiologicalSexExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:AXsfNjy29LPpDz56jvON4jU0ixGBu2uAQmrxHAgF2ng"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:a_24qcTu5x_m3VHq1GJ6xWpy84Xi9a0uWEqLqqwjau0"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-biological-sex"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"female","display":"Female","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-biological-sex"}]}}}},"output":{"unprojected":{"code":"mobile-input.unsupported-source-type","error":"measurementNotMappable(id: \"biological-sex\")"}}} {"id":"guide-example/HealthkitBladderIncontinenceExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"bladder-incontinence","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierBladderIncontinence"}],"id":"HealthkitBladderIncontinenceExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:bge-uIBbA_Mqg8-4kJj0Y4CCtUQE-9M-H6H_qn0kc3s"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:B0_3rqYIZqI-yQe_7-Z2Ah4MmZdos4a1p9pbPL2z6Ww"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-bladder-incontinence"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"not-present","display":"Not present","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity"}]}}}},"output":{"graphs":[{"envelope":{"digest":"3341a7dfde74581371f9c5772ab98e8e5e6452fc8d685bf243a6ad338addbf34","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"_effectiveDateTime":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"code":{"coding":[{"code":"bladder-incontinence","display":"Bladder incontinence","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierBladderIncontinence"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:kQ4b3lipIN-9e6cysU201PWZENPESVzs9cGpYe5Xbug"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:bKe255DsoQeWtXCRRcdGuS-dtR8qlr8ShcRa3FWIcDg"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-bladder-incontinence"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueCodeableConcept":{"coding":[{"code":"not-present","display":"Not present","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity"},{"code":"notPresent","display":"Not present","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-symptom-severity"}]}}],"warnings":["mobile-omission.unmodeled-metadata@HKSample.metadata"]}]}} {"id":"guide-example/HealthkitBleedingAfterMenopauseExample","input":{"guideExample":{"observation":{"code":{"coding":[{"code":"bleeding-after-menopause","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierBleedingAfterMenopause"}],"id":"HealthkitBleedingAfterMenopauseExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:m4CeQ-P7-jyP4j6PtgUoBvKVyMyXqI6SEa67dqVQv24"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:1LBXMScZn-OnN01-yjllgwWTHRytvLZ6WOEymlI84V4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-bleeding-after-menopause"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"unspecified","display":"Unspecified","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-bleeding-after-menopause"}]}}}},"output":{"graphs":[{"envelope":{"digest":"091a643cd0a0eaa6c584db4da2021e8640fa525436e05b4d81b41722f5bdf512","entries":["Observation","Device","Device","Provenance"],"provenanceTargets":[0]},"outputs":[{"_effectiveDateTime":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/timezone","valueCode":"GMT-0700"}]},"code":{"coding":[{"code":"bleeding-after-menopause","display":"Bleeding after menopause","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierBleedingAfterMenopause"}],"identifier":[{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:BVolEoNtomnpy2FYW922_8nAHGXRDStst3g4n9EObH8"},{"system":"https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test:1:_eroukyKfngx6ZgYLv-xIJMIxakeqxb-weIizqco08c"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-bleeding-after-menopause"]},"resourceType":"Observation","status":"final","subject":{"identifier":{"system":"https://grovealliance.org/fhir/testing/identifiers/patient","value":"example"},"type":"Patient"},"valueCodeableConcept":{"coding":[{"code":"unspecified","display":"Unspecified","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-bleeding-after-menopause"},{"code":"unspecified","display":"Unspecified","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-vaginal-bleeding"}]}}],"warnings":["mobile-omission.unmodeled-metadata@HKSample.metadata"]}]}} diff --git a/Tests/GroveHealthKitFHIRTests/Resources/Goldens/audiogram-test-details.json b/Tests/GroveHealthKitFHIRTests/Resources/Goldens/audiogram-test-details.json new file mode 100644 index 000000000..7f9ec5702 --- /dev/null +++ b/Tests/GroveHealthKitFHIRTests/Resources/Goldens/audiogram-test-details.json @@ -0,0 +1,544 @@ +{ + "entry" : [ + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1", + "type" : { + "coding" : [ + { + "code" : "source-output", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:tu6DO29xCVmxinA6iArukg65GyJGwj7Hjn_iKhlTGu8" + } + } + ], + "fullUrl" : "urn:uuid:88af284d-2ced-559c-850f-ea15c8d8f120", + "resource" : { + "code" : { + "coding" : [ + { + "code" : "89015-2", + "display" : "Pure tone air conduction threshold audiometry panel", + "system" : "http://loinc.org" + } + ] + }, + "component" : [ + { + "code" : { + "text" : "Air conduction threshold, left ear, 125 Hz" + }, + "extension" : [ + { + "extension" : [ + { + "url" : "frequency", + "valueQuantity" : { + "code" : "Hz", + "system" : "http://unitsofmeasure.org", + "unit" : "Hz", + "value" : 125 + } + }, + { + "url" : "ear", + "valueCode" : "left" + }, + { + "url" : "conduction", + "valueCode" : "air" + }, + { + "url" : "masked", + "valueBoolean" : false + } + ], + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + } + ], + "valueQuantity" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 15 + } + }, + { + "code" : { + "coding" : [ + { + "code" : "91375-6", + "system" : "http://loinc.org" + } + ] + }, + "extension" : [ + { + "extension" : [ + { + "url" : "frequency", + "valueQuantity" : { + "code" : "Hz", + "system" : "http://unitsofmeasure.org", + "unit" : "Hz", + "value" : 250 + } + }, + { + "url" : "ear", + "valueCode" : "left" + }, + { + "url" : "conduction", + "valueCode" : "air" + }, + { + "url" : "masked", + "valueBoolean" : true + }, + { + "url" : "clampingRange", + "valueRange" : { + "high" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 80 + }, + "low" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : -10 + } + } + } + ], + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + } + ], + "valueQuantity" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 20 + } + }, + { + "code" : { + "coding" : [ + { + "code" : "91374-9", + "system" : "http://loinc.org" + } + ] + }, + "extension" : [ + { + "extension" : [ + { + "url" : "frequency", + "valueQuantity" : { + "code" : "Hz", + "system" : "http://unitsofmeasure.org", + "unit" : "Hz", + "value" : 250 + } + }, + { + "url" : "ear", + "valueCode" : "right" + }, + { + "url" : "conduction", + "valueCode" : "air" + }, + { + "url" : "masked", + "valueBoolean" : false + }, + { + "url" : "clampingRange", + "valueRange" : { + "high" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 100 + } + } + } + ], + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + } + ], + "valueQuantity" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 25 + } + }, + { + "code" : { + "text" : "Air conduction threshold, right ear, 1250.5 Hz" + }, + "extension" : [ + { + "extension" : [ + { + "url" : "frequency", + "valueQuantity" : { + "code" : "Hz", + "system" : "http://unitsofmeasure.org", + "unit" : "Hz", + "value" : 1250.5 + } + }, + { + "url" : "ear", + "valueCode" : "right" + }, + { + "url" : "conduction", + "valueCode" : "air" + }, + { + "url" : "masked", + "valueBoolean" : false + } + ], + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + } + ], + "valueQuantity" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 30 + } + } + ], + "effectivePeriod" : { + "_end" : { + "extension" : [ + { + "url" : "http://hl7.org/fhir/StructureDefinition/timezone", + "valueCode" : "America/Los_Angeles" + } + ] + }, + "_start" : { + "extension" : [ + { + "url" : "http://hl7.org/fhir/StructureDefinition/timezone", + "valueCode" : "America/Los_Angeles" + } + ] + }, + "end" : "2026-08-19T10:36:00-07:00", + "start" : "2026-08-19T10:30:00-07:00" + }, + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type", + "valueCode" : "HKDataTypeIdentifierAudiogram" + } + ], + "identifier" : [ + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1", + "type" : { + "coding" : [ + { + "code" : "source-record", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:IKCeoLWQqbB93IOxZjkHpdHI3TdU17182I8Opf0hKyA" + }, + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1", + "type" : { + "coding" : [ + { + "code" : "source-output", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:tu6DO29xCVmxinA6iArukg65GyJGwj7Hjn_iKhlTGu8" + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel" + ] + }, + "resourceType" : "Observation", + "status" : "final", + "subject" : { + "identifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/patient", + "value" : "example" + }, + "type" : "Patient" + } + } + }, + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:EtS_H7lbXColnb2cn4p55V4xPSYdwekyIKN1ZxhR1Sc" + } + } + ], + "fullUrl" : "urn:uuid:eecd7aa5-3f56-57dc-85e3-75fb1d7747d6", + "resource" : { + "deviceName" : [ + { + "name" : "Grove Test Host", + "type" : "user-friendly-name" + } + ], + "identifier" : [ + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:EtS_H7lbXColnb2cn4p55V4xPSYdwekyIKN1ZxhR1Sc" + } + ], + "manufacturer" : "Example Device Company", + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-host-device" + ] + }, + "modelNumber" : "Phone One", + "resourceType" : "Device", + "status" : "active", + "version" : [ + { + "type" : { + "coding" : [ + { + "code" : "os-version", + "display" : "Operating system version", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-application-version-type" + } + ] + }, + "value" : "20.1" + } + ] + } + }, + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:aKPfjyYL_z9J-MBwJV2E4tguLthTq_nov6F3vgSwnJY" + } + } + ], + "fullUrl" : "urn:uuid:12f291db-9efc-59f1-95f2-fc43d390ef2b", + "resource" : { + "deviceName" : [ + { + "name" : "Grove Test", + "type" : "user-friendly-name" + } + ], + "identifier" : [ + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:aKPfjyYL_z9J-MBwJV2E4tguLthTq_nov6F3vgSwnJY" + }, + { + "system" : "https://grovealliance.org/fhir/healthkit/NamingSystem/apple-bundle-id", + "type" : { + "coding" : [ + { + "code" : "apple-bundle-id", + "system" : "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-identifier-type" + } + ] + }, + "value" : "org.grovealliance.test" + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-application-device" + ] + }, + "parent" : { + "reference" : "urn:uuid:eecd7aa5-3f56-57dc-85e3-75fb1d7747d6" + }, + "resourceType" : "Device", + "status" : "active", + "version" : [ + { + "type" : { + "coding" : [ + { + "code" : "531975", + "display" : "MDC_ID_PROD_SPEC_SW", + "system" : "urn:iso:std:iso:11073:10101" + } + ] + }, + "value" : "1.0" + } + ] + } + }, + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/record-version/test/1", + "type" : { + "coding" : [ + { + "code" : "record-version", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:R09PD4_nczeUsKoRN9tCK9cJr2qn56Uh81zw_iIgZgw" + } + } + ], + "fullUrl" : "urn:uuid:1066a354-91b7-5d4f-974a-048eb1baa61d", + "resource" : { + "activity" : { + "coding" : [ + { + "code" : "transform", + "display" : "Transform/Translate Record Lifecycle Event", + "system" : "http://terminology.hl7.org/CodeSystem/iso-21089-lifecycle" + } + ] + }, + "agent" : [ + { + "type" : { + "coding" : [ + { + "code" : "assembler", + "display" : "Assembler", + "system" : "http://terminology.hl7.org/CodeSystem/provenance-participant-type" + } + ] + }, + "who" : { + "reference" : "urn:uuid:12f291db-9efc-59f1-95f2-fc43d390ef2b" + } + } + ], + "entity" : [ + { + "role" : "source", + "what" : { + "identifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1", + "type" : { + "coding" : [ + { + "code" : "source-record", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:IKCeoLWQqbB93IOxZjkHpdHI3TdU17182I8Opf0hKyA" + } + } + } + ], + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-record-version", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/record-version/test/1", + "type" : { + "coding" : [ + { + "code" : "record-version", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:R09PD4_nczeUsKoRN9tCK9cJr2qn56Uh81zw_iIgZgw" + } + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-conversion-provenance" + ] + }, + "occurredDateTime" : "2026-08-17T23:30:00Z", + "recorded" : "2026-08-17T23:30:00Z", + "resourceType" : "Provenance", + "target" : [ + { + "reference" : "urn:uuid:88af284d-2ced-559c-850f-ea15c8d8f120" + } + ] + } + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-mobile-exchange-bundle" + ] + }, + "resourceType" : "Bundle", + "timestamp" : "2026-08-17T23:30:00Z", + "type" : "collection" +} \ No newline at end of file diff --git a/Tests/GroveHealthKitFHIRTests/Resources/Goldens/guide-example-audiogram.json b/Tests/GroveHealthKitFHIRTests/Resources/Goldens/guide-example-audiogram.json new file mode 100644 index 000000000..9767e90a7 --- /dev/null +++ b/Tests/GroveHealthKitFHIRTests/Resources/Goldens/guide-example-audiogram.json @@ -0,0 +1,427 @@ +{ + "entry" : [ + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1", + "type" : { + "coding" : [ + { + "code" : "source-output", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:tu6DO29xCVmxinA6iArukg65GyJGwj7Hjn_iKhlTGu8" + } + } + ], + "fullUrl" : "urn:uuid:88af284d-2ced-559c-850f-ea15c8d8f120", + "resource" : { + "_effectiveDateTime" : { + "extension" : [ + { + "url" : "http://hl7.org/fhir/StructureDefinition/timezone", + "valueCode" : "America/Los_Angeles" + } + ] + }, + "code" : { + "coding" : [ + { + "code" : "89015-2", + "display" : "Pure tone air conduction threshold audiometry panel", + "system" : "http://loinc.org" + } + ] + }, + "component" : [ + { + "code" : { + "coding" : [ + { + "code" : "91375-6", + "system" : "http://loinc.org" + } + ] + }, + "extension" : [ + { + "extension" : [ + { + "url" : "frequency", + "valueQuantity" : { + "code" : "Hz", + "system" : "http://unitsofmeasure.org", + "unit" : "Hz", + "value" : 250 + } + }, + { + "url" : "ear", + "valueCode" : "left" + }, + { + "url" : "conduction", + "valueCode" : "air" + }, + { + "url" : "masked", + "valueBoolean" : false + } + ], + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + } + ], + "valueQuantity" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 20 + } + }, + { + "code" : { + "coding" : [ + { + "code" : "91374-9", + "system" : "http://loinc.org" + } + ] + }, + "extension" : [ + { + "extension" : [ + { + "url" : "frequency", + "valueQuantity" : { + "code" : "Hz", + "system" : "http://unitsofmeasure.org", + "unit" : "Hz", + "value" : 250 + } + }, + { + "url" : "ear", + "valueCode" : "right" + }, + { + "url" : "conduction", + "valueCode" : "air" + }, + { + "url" : "masked", + "valueBoolean" : false + } + ], + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test" + } + ], + "valueQuantity" : { + "code" : "dB", + "system" : "http://unitsofmeasure.org", + "unit" : "dB", + "value" : 25 + } + } + ], + "effectiveDateTime" : "2026-08-19T10:30:00-07:00", + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type", + "valueCode" : "HKDataTypeIdentifierAudiogram" + } + ], + "identifier" : [ + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1", + "type" : { + "coding" : [ + { + "code" : "source-record", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:IKCeoLWQqbB93IOxZjkHpdHI3TdU17182I8Opf0hKyA" + }, + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1", + "type" : { + "coding" : [ + { + "code" : "source-output", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:tu6DO29xCVmxinA6iArukg65GyJGwj7Hjn_iKhlTGu8" + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel" + ] + }, + "resourceType" : "Observation", + "status" : "final", + "subject" : { + "identifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/patient", + "value" : "example" + }, + "type" : "Patient" + } + } + }, + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:EtS_H7lbXColnb2cn4p55V4xPSYdwekyIKN1ZxhR1Sc" + } + } + ], + "fullUrl" : "urn:uuid:eecd7aa5-3f56-57dc-85e3-75fb1d7747d6", + "resource" : { + "deviceName" : [ + { + "name" : "Grove Test Host", + "type" : "user-friendly-name" + } + ], + "identifier" : [ + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:EtS_H7lbXColnb2cn4p55V4xPSYdwekyIKN1ZxhR1Sc" + } + ], + "manufacturer" : "Example Device Company", + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-host-device" + ] + }, + "modelNumber" : "Phone One", + "resourceType" : "Device", + "status" : "active", + "version" : [ + { + "type" : { + "coding" : [ + { + "code" : "os-version", + "display" : "Operating system version", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-application-version-type" + } + ] + }, + "value" : "20.1" + } + ] + } + }, + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:aKPfjyYL_z9J-MBwJV2E4tguLthTq_nov6F3vgSwnJY" + } + } + ], + "fullUrl" : "urn:uuid:12f291db-9efc-59f1-95f2-fc43d390ef2b", + "resource" : { + "deviceName" : [ + { + "name" : "Grove Test", + "type" : "user-friendly-name" + } + ], + "identifier" : [ + { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1", + "type" : { + "coding" : [ + { + "code" : "device-snapshot", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:aKPfjyYL_z9J-MBwJV2E4tguLthTq_nov6F3vgSwnJY" + }, + { + "system" : "https://grovealliance.org/fhir/healthkit/NamingSystem/apple-bundle-id", + "type" : { + "coding" : [ + { + "code" : "apple-bundle-id", + "system" : "https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-identifier-type" + } + ] + }, + "value" : "org.grovealliance.test" + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-application-device" + ] + }, + "parent" : { + "reference" : "urn:uuid:eecd7aa5-3f56-57dc-85e3-75fb1d7747d6" + }, + "resourceType" : "Device", + "status" : "active", + "version" : [ + { + "type" : { + "coding" : [ + { + "code" : "531975", + "display" : "MDC_ID_PROD_SPEC_SW", + "system" : "urn:iso:std:iso:11073:10101" + } + ] + }, + "value" : "1.0" + } + ] + } + }, + { + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-exchange-entry-key", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/record-version/test/1", + "type" : { + "coding" : [ + { + "code" : "record-version", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:pYUZWHPY7iQTnu9oF9q_fFmpJ7s8NrM6sSDU-Jt_FfI" + } + } + ], + "fullUrl" : "urn:uuid:bc0898c1-445b-5ea0-bf64-1fd8087808f5", + "resource" : { + "activity" : { + "coding" : [ + { + "code" : "transform", + "display" : "Transform/Translate Record Lifecycle Event", + "system" : "http://terminology.hl7.org/CodeSystem/iso-21089-lifecycle" + } + ] + }, + "agent" : [ + { + "type" : { + "coding" : [ + { + "code" : "assembler", + "display" : "Assembler", + "system" : "http://terminology.hl7.org/CodeSystem/provenance-participant-type" + } + ] + }, + "who" : { + "reference" : "urn:uuid:12f291db-9efc-59f1-95f2-fc43d390ef2b" + } + } + ], + "entity" : [ + { + "role" : "source", + "what" : { + "identifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1", + "type" : { + "coding" : [ + { + "code" : "source-record", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:IKCeoLWQqbB93IOxZjkHpdHI3TdU17182I8Opf0hKyA" + } + } + } + ], + "extension" : [ + { + "url" : "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-record-version", + "valueIdentifier" : { + "system" : "https://grovealliance.org/fhir/testing/identifiers/healthkit/record-version/test/1", + "type" : { + "coding" : [ + { + "code" : "record-version", + "system" : "https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role" + } + ] + }, + "value" : "v0:test:1:pYUZWHPY7iQTnu9oF9q_fFmpJ7s8NrM6sSDU-Jt_FfI" + } + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-conversion-provenance" + ] + }, + "occurredDateTime" : "2026-08-17T23:30:00Z", + "recorded" : "2026-08-17T23:30:00Z", + "resourceType" : "Provenance", + "target" : [ + { + "reference" : "urn:uuid:88af284d-2ced-559c-850f-ea15c8d8f120" + } + ] + } + } + ], + "meta" : { + "profile" : [ + "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-mobile-exchange-bundle" + ] + }, + "resourceType" : "Bundle", + "timestamp" : "2026-08-17T23:30:00Z", + "type" : "collection" +} \ No newline at end of file diff --git a/Tests/GroveHealthKitFHIRTests/Resources/Goldens/outlines.json b/Tests/GroveHealthKitFHIRTests/Resources/Goldens/outlines.json index b26c71b1a..220c0f3c7 100644 --- a/Tests/GroveHealthKitFHIRTests/Resources/Goldens/outlines.json +++ b/Tests/GroveHealthKitFHIRTests/Resources/Goldens/outlines.json @@ -1,4 +1,53 @@ { + "audiogram-test-details" : { + "entries" : [ + { + "extensions" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type" + ], + "fullUrl" : "urn:uuid:88af284d-2ced-559c-850f-ea15c8d8f120", + "identifiers" : [ + "source-record|https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1|v0:test:1:IKCeoLWQqbB93IOxZjkHpdHI3TdU17182I8Opf0hKyA", + "source-output|https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1|v0:test:1:tu6DO29xCVmxinA6iArukg65GyJGwj7Hjn_iKhlTGu8" + ], + "resourceType" : "Observation" + }, + { + "extensions" : [ + + ], + "fullUrl" : "urn:uuid:eecd7aa5-3f56-57dc-85e3-75fb1d7747d6", + "identifiers" : [ + "device-snapshot|https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1|v0:test:1:EtS_H7lbXColnb2cn4p55V4xPSYdwekyIKN1ZxhR1Sc" + ], + "resourceType" : "Device" + }, + { + "extensions" : [ + + ], + "fullUrl" : "urn:uuid:12f291db-9efc-59f1-95f2-fc43d390ef2b", + "identifiers" : [ + "device-snapshot|https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1|v0:test:1:aKPfjyYL_z9J-MBwJV2E4tguLthTq_nov6F3vgSwnJY", + "apple-bundle-id|https://grovealliance.org/fhir/healthkit/NamingSystem/apple-bundle-id|org.grovealliance.test" + ], + "resourceType" : "Device" + }, + { + "extensions" : [ + "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-record-version" + ], + "fullUrl" : "urn:uuid:1066a354-91b7-5d4f-974a-048eb1baa61d", + "identifiers" : [ + + ], + "resourceType" : "Provenance" + } + ], + "warnings" : [ + + ] + }, "blood-pressure-correlation" : { "entries" : [ { @@ -1697,6 +1746,55 @@ ] }, + "guide-example-audiogram" : { + "entries" : [ + { + "extensions" : [ + "https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type" + ], + "fullUrl" : "urn:uuid:88af284d-2ced-559c-850f-ea15c8d8f120", + "identifiers" : [ + "source-record|https://grovealliance.org/fhir/testing/identifiers/healthkit/source-record/test/1|v0:test:1:IKCeoLWQqbB93IOxZjkHpdHI3TdU17182I8Opf0hKyA", + "source-output|https://grovealliance.org/fhir/testing/identifiers/healthkit/source-output/test/1|v0:test:1:tu6DO29xCVmxinA6iArukg65GyJGwj7Hjn_iKhlTGu8" + ], + "resourceType" : "Observation" + }, + { + "extensions" : [ + + ], + "fullUrl" : "urn:uuid:eecd7aa5-3f56-57dc-85e3-75fb1d7747d6", + "identifiers" : [ + "device-snapshot|https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1|v0:test:1:EtS_H7lbXColnb2cn4p55V4xPSYdwekyIKN1ZxhR1Sc" + ], + "resourceType" : "Device" + }, + { + "extensions" : [ + + ], + "fullUrl" : "urn:uuid:12f291db-9efc-59f1-95f2-fc43d390ef2b", + "identifiers" : [ + "device-snapshot|https://grovealliance.org/fhir/testing/identifiers/healthkit/device-snapshot/test/1|v0:test:1:aKPfjyYL_z9J-MBwJV2E4tguLthTq_nov6F3vgSwnJY", + "apple-bundle-id|https://grovealliance.org/fhir/healthkit/NamingSystem/apple-bundle-id|org.grovealliance.test" + ], + "resourceType" : "Device" + }, + { + "extensions" : [ + "https://grovealliance.org/fhir/mobile/StructureDefinition/grove-record-version" + ], + "fullUrl" : "urn:uuid:bc0898c1-445b-5ea0-bf64-1fd8087808f5", + "identifiers" : [ + + ], + "resourceType" : "Provenance" + } + ], + "warnings" : [ + + ] + }, "guide-example-heart-rate" : { "entries" : [ { diff --git a/Tests/GroveHealthKitFHIRTests/Resources/GuideExamples/guide-examples-healthkit.jsonl b/Tests/GroveHealthKitFHIRTests/Resources/GuideExamples/guide-examples-healthkit.jsonl index fbdb74f78..0c6f8df16 100644 --- a/Tests/GroveHealthKitFHIRTests/Resources/GuideExamples/guide-examples-healthkit.jsonl +++ b/Tests/GroveHealthKitFHIRTests/Resources/GuideExamples/guide-examples-healthkit.jsonl @@ -3,7 +3,7 @@ {"code":{"coding":[{"code":"apple-stand-hour","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierAppleStandHour"}],"id":"HealthkitAppleStandHourExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:7v9Ew6YEQt7z6uD-ZfVTNLMuWXYUyZjWQnkkzFPCFlo"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:Sh3-0x_ATHMvEI2s2pisKKmY2lFKk7Dg7npVmd0PTTg"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-apple-stand-hour"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"stood","display":"Stood","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-apple-stand-hour"}]}} {"code":{"coding":[{"code":"apple-stand-time","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierAppleStandTime"}],"id":"HealthkitAppleStandTimeExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:CuC4LLtLAGd_DtyiKlrsLLVF5CUqMNp40xCZcR3Xv5g"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:-JhtKvdVPcj4t7VlNH7STBOF42Sk9IrcA6h7CBgXQ-I"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-apple-stand-time"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueQuantity":{"code":"min","system":"http://unitsofmeasure.org","value":12}} {"code":{"coding":[{"code":"atrial-fibrillation-burden","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectivePeriod":{"end":"2026-08-20T00:00:00-07:00","start":"2026-08-19T00:00:00-07:00"},"extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKQuantityTypeIdentifierAtrialFibrillationBurden"}],"id":"HealthkitAtrialFibrillationBurdenExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:UrrXwtYPzF9Hsv40BxrvwTDxf3CVCfa7lsYDhd-WUEA"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:MZTLTdpfBNqgGCH1s2trcW6VO2RLbODh52Iavn0RvKE"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-atrial-fibrillation-burden"]},"method":{"coding":[{"code":"percentage-of-time","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-aggregation-method"}]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueQuantity":{"code":"%","system":"http://unitsofmeasure.org","value":2}} -{"code":{"coding":[{"code":"89015-2","display":"Pure tone air conduction threshold audiometry panel","system":"http://loinc.org"}]},"component":[{"code":{"coding":[{"code":"91375-6","system":"http://loinc.org"}]},"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":20}},{"code":{"coding":[{"code":"91374-9","system":"http://loinc.org"}]},"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":25}}],"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKDataTypeIdentifierAudiogram"}],"id":"HealthkitAudiogramPanelExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:xRWq80LfUXEp-pfC_99R-9PkqhJ_LIfZ-CVjGDeCZBU"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:bza8NKWu5vBX5kJmd7z7sxz9yE4zq7j3FCcPJXQdVI4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"}} +{"code":{"coding":[{"code":"89015-2","display":"Pure tone air conduction threshold audiometry panel","system":"http://loinc.org"}]},"component":[{"code":{"coding":[{"code":"91375-6","system":"http://loinc.org"}]},"extension":[{"extension":[{"url":"frequency","valueQuantity":{"code":"Hz","system":"http://unitsofmeasure.org","value":250}},{"url":"ear","valueCode":"left"},{"url":"conduction","valueCode":"air"},{"url":"masked","valueBoolean":false}],"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test"}],"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":20}},{"code":{"coding":[{"code":"91374-9","system":"http://loinc.org"}]},"extension":[{"extension":[{"url":"frequency","valueQuantity":{"code":"Hz","system":"http://unitsofmeasure.org","value":250}},{"url":"ear","valueCode":"right"},{"url":"conduction","valueCode":"air"},{"url":"masked","valueBoolean":false}],"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-sensitivity-test"}],"valueQuantity":{"code":"dB","system":"http://unitsofmeasure.org","value":25}}],"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKDataTypeIdentifierAudiogram"}],"id":"HealthkitAudiogramPanelExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:xRWq80LfUXEp-pfC_99R-9PkqhJ_LIfZ-CVjGDeCZBU"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:bza8NKWu5vBX5kJmd7z7sxz9yE4zq7j3FCcPJXQdVI4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-audiogram-panel"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"}} {"code":{"coding":[{"code":"46098-0","display":"Sex","system":"http://loinc.org"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCharacteristicTypeIdentifierBiologicalSex"}],"id":"HealthkitBiologicalSexExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:AXsfNjy29LPpDz56jvON4jU0ixGBu2uAQmrxHAgF2ng"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:a_24qcTu5x_m3VHq1GJ6xWpy84Xi9a0uWEqLqqwjau0"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-biological-sex"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"female","display":"Female","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-biological-sex"}]}} {"code":{"coding":[{"code":"bladder-incontinence","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierBladderIncontinence"}],"id":"HealthkitBladderIncontinenceExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:bge-uIBbA_Mqg8-4kJj0Y4CCtUQE-9M-H6H_qn0kc3s"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:B0_3rqYIZqI-yQe_7-Z2Ah4MmZdos4a1p9pbPL2z6Ww"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-bladder-incontinence"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"not-present","display":"Not present","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/grove-symptom-severity"}]}} {"code":{"coding":[{"code":"bleeding-after-menopause","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-measurement"}]},"effectiveDateTime":"2026-08-19T10:30:00-07:00","extension":[{"url":"https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-source-type","valueCode":"HKCategoryTypeIdentifierBleedingAfterMenopause"}],"id":"HealthkitBleedingAfterMenopauseExample","identifier":[{"system":"https://study.example.org/fhir/NamingSystem/grove-source-record-v0/test-key/1","type":{"coding":[{"code":"source-record","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:m4CeQ-P7-jyP4j6PtgUoBvKVyMyXqI6SEa67dqVQv24"},{"system":"https://study.example.org/fhir/NamingSystem/grove-source-output-v0/test-key/1","type":{"coding":[{"code":"source-output","system":"https://grovealliance.org/fhir/mobile/CodeSystem/grove-identifier-role"}]},"value":"v0:test-key:1:1LBXMScZn-OnN01-yjllgwWTHRytvLZ6WOEymlI84V4"}],"meta":{"profile":["https://grovealliance.org/fhir/healthkit/StructureDefinition/healthkit-bleeding-after-menopause"]},"resourceType":"Observation","status":"final","subject":{"reference":"Patient/HealthKitPatientExample"},"valueCodeableConcept":{"coding":[{"code":"unspecified","display":"Unspecified","system":"https://grovealliance.org/fhir/healthkit/CodeSystem/healthkit-bleeding-after-menopause"}]}}