diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 89d68b7..e974981 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -37,3 +37,5 @@ jobs: uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 with: coveragereports: HealthKitOnFHIR.xcresult TestApp.xcresult + secrets: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Scripts/support_table_generator.py b/Scripts/support_table_generator.py index 2cf00aa..da504f9 100644 --- a/Scripts/support_table_generator.py +++ b/Scripts/support_table_generator.py @@ -26,6 +26,7 @@ ALL_QUANTITY_TYPES = [ "HKQuantityTypeIdentifierActiveEnergyBurned", "HKQuantityTypeIdentifierAppleExerciseTime", + "HKQuantityTypeIdentifierAppleWalkingSteadiness", "HKQuantityTypeIdentifierBasalBodyTemperature", "HKQuantityTypeIdentifierBasalEnergyBurned", "HKQuantityTypeIdentifierBloodAlcoholContent", @@ -103,7 +104,8 @@ "HKQuantityTypeIdentifierUVExposure", "HKQuantityTypeIdentifierVO2Max", "HKQuantityTypeIdentifierWaistCircumference", - "HKQuantityTypeIdentifierWalkingHeartRateAverage" + "HKQuantityTypeIdentifierWalkingHeartRateAverage", + "HKQuantityTypeIdentifierWalkingAsymmetryPercentage" ] ALL_CORRELATION_TYPES = [ diff --git a/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/HKSampleSupportTables.md b/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/HKSampleSupportTables.md index 21869cf..fd932a3 100644 --- a/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/HKSampleSupportTables.md +++ b/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/HKSampleSupportTables.md @@ -17,5 +17,5 @@ SPDX-License-Identifier: MIT - [HKClinicalType]() - HealthKitOnFHIR supports 8 of 8 clinical types. - [HKQuantityType]() - - HealthKitOnFHIR supports 82 of 84 quantity types. + - HealthKitOnFHIR supports 85 of 87 quantity types. \ No newline at end of file diff --git a/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/SupportedHKQuantityTypes.md b/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/SupportedHKQuantityTypes.md index a6255f9..f470880 100644 --- a/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/SupportedHKQuantityTypes.md +++ b/Sources/HealthKitOnFHIR/HealthKitOnFHIR.docc/SupportedHKQuantityTypes.md @@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT --> -HealthKitOnFHIR supports 82 of 84 quantity types. +HealthKitOnFHIR supports 85 of 87 quantity types. |HKQuantityType|Supported|Code|Unit| |----|----|----|----| @@ -17,6 +17,7 @@ HealthKitOnFHIR supports 82 of 84 quantity types. |[AppleExerciseTime](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierAppleExerciseTime)|✅|[HKQuantityTypeIdentifierAppleExerciseTime](http://developer.apple.com/documentation/healthkit)|[min](http://unitsofmeasure.org)| |[AppleMoveTime](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierAppleMoveTime)|✅|[HKQuantityTypeIdentifierAppleMoveTime](http://developer.apple.com/documentation/healthkit)|[min](http://unitsofmeasure.org)| |[AppleStandTime](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierAppleStandTime)|✅|[HKQuantityTypeIdentifierAppleStandTime](http://developer.apple.com/documentation/healthkit)|[min](http://unitsofmeasure.org)| +|[AppleWalkingSteadiness](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierAppleWalkingSteadiness)|✅|[HKQuantityTypeIdentifierAppleWalkingSteadiness](http://developer.apple.com/documentation/healthkit)|[%](http://unitsofmeasure.org)| |[BasalBodyTemperature](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierBasalBodyTemperature)|✅|[HKQuantityTypeIdentifierBasalBodyTemperature](http://developer.apple.com/documentation/healthkit)|[C](http://unitsofmeasure.org)| |[BasalEnergyBurned](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierBasalEnergyBurned)|✅|[HKQuantityTypeIdentifierBasalEnergyBurned](http://developer.apple.com/documentation/healthkit)|[kcal](http://unitsofmeasure.org)| |[BloodAlcoholContent](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierBloodAlcoholContent)|✅|[74859-0](http://loinc.org/74859-0)|[%](http://unitsofmeasure.org)| @@ -97,4 +98,5 @@ HealthKitOnFHIR supports 82 of 84 quantity types. |[UVExposure](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierUVExposure)|✅|[HKQuantityTypeIdentifierUVExposure](http://developer.apple.com/documentation/healthkit)|count| |[VO2Max](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierVO2Max)|✅|[HKQuantityTypeIdentifierVO2Max](http://developer.apple.com/documentation/healthkit)|[mL/kg/min](http://unitsofmeasure.org)| |[WaistCircumference](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierWaistCircumference)|✅|[8280-0](http://loinc.org/8280-0)|[in](http://unitsofmeasure.org)| +|[WalkingAsymmetryPercentage](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierWalkingAsymmetryPercentage)|✅|[HKQuantityTypeIdentifierWalkingAsymmetryPercentage](http://developer.apple.com/documentation/healthkit)|[%](http://unitsofmeasure.org)| |[WalkingHeartRateAverage](https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierWalkingHeartRateAverage)|✅|[HKQuantityTypeIdentifierWalkingHeartRateAverage](http://developer.apple.com/documentation/healthkit)|[beats/minute](http://unitsofmeasure.org)| diff --git a/Sources/HealthKitOnFHIR/Resources/HKSampleMapping.json b/Sources/HealthKitOnFHIR/Resources/HKSampleMapping.json index 8f8fa1c..21c6a79 100644 --- a/Sources/HealthKitOnFHIR/Resources/HKSampleMapping.json +++ b/Sources/HealthKitOnFHIR/Resources/HKSampleMapping.json @@ -775,6 +775,21 @@ "unit": "min" } }, + "HKQuantityTypeIdentifierAppleWalkingSteadiness": { + "codings": [ + { + "code": "HKQuantityTypeIdentifierAppleWalkingSteadiness", + "display": "Apple Walking Steadiness", + "system": "http://developer.apple.com/documentation/healthkit" + } + ], + "unit": { + "code": "%", + "hkunit": "%", + "system": "http://unitsofmeasure.org", + "unit": "%" + } + }, "HKQuantityTypeIdentifierBasalBodyTemperature": { "codings": [ { @@ -2061,6 +2076,21 @@ "unit": "in" } }, + "HKQuantityTypeIdentifierWalkingAsymmetryPercentage": { + "codings": [ + { + "code": "HKQuantityTypeIdentifierWalkingAsymmetryPercentage", + "display": "Walking Asymmetry Percentage", + "system": "http://developer.apple.com/documentation/healthkit" + } + ], + "unit": { + "code": "%", + "hkunit": "%", + "system": "http://unitsofmeasure.org", + "unit": "%" + } + }, "HKQuantityTypeIdentifierWalkingHeartRateAverage": { "codings": [ { diff --git a/Tests/HealthKitOnFHIRTests/HKQuantitySampleTests.swift b/Tests/HealthKitOnFHIRTests/HKQuantitySampleTests.swift index 5a36167..5157f14 100644 --- a/Tests/HealthKitOnFHIRTests/HKQuantitySampleTests.swift +++ b/Tests/HealthKitOnFHIRTests/HKQuantitySampleTests.swift @@ -1531,6 +1531,36 @@ class HKQuantitySampleTests: XCTestCase { ) } + func testWalkingAsymmetryPercentage() throws { + let observation = try createObservationFrom( + type: HKQuantityType(.walkingAsymmetryPercentage), + quantity: HKQuantity(unit: .percent(), doubleValue: 50) + ) + + XCTAssertEqual( + observation.code.coding, + [ + createCoding( + code: "HKQuantityTypeIdentifierWalkingAsymmetryPercentage", + display: "Walking Asymmetry Percentage", + system: .apple + ) + ] + ) + + XCTAssertEqual( + observation.value, + .quantity( + Quantity( + code: "%", + system: "http://unitsofmeasure.org".asFHIRURIPrimitive(), + unit: "%", + value: 50.asFHIRDecimalPrimitive() + ) + ) + ) + } + func testHeartRateVariabilitySDNN() throws { let observation = try createObservationFrom( type: HKQuantityType(.heartRateVariabilitySDNN), @@ -2349,6 +2379,36 @@ class HKQuantitySampleTests: XCTestCase { ) } + func testAppleWalkingSteadiness() throws { + let observation = try createObservationFrom( + type: HKQuantityType(.appleWalkingSteadiness), + quantity: HKQuantity(unit: .percent(), doubleValue: 50) + ) + + XCTAssertEqual( + observation.code.coding, + [ + createCoding( + code: "HKQuantityTypeIdentifierAppleWalkingSteadiness", + display: "Apple Walking Steadiness", + system: .apple + ) + ] + ) + + XCTAssertEqual( + observation.value, + .quantity( + Quantity( + code: "%", + system: "http://unitsofmeasure.org".asFHIRURIPrimitive(), + unit: "%", + value: 50.asFHIRDecimalPrimitive() + ) + ) + ) + } + func testDistanceCycling() throws { let observation = try createObservationFrom( type: HKQuantityType(.distanceCycling),