MHV / Add interpretation to mobile response#27587
Merged
Conversation
14 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Moves lab observation interpretation mapping into the UHD labs adapter so API consumers receive a human-readable interpretation string, and updates Mobile Labs & Tests documentation accordingly.
Changes:
- Add
INTERPRETATION_MAPand updateextract_interpretationto return mapped display strings (with fallback). - Update adapter specs to assert mapped interpretation values (e.g.,
Highinstead ofH). - Update Mobile Labs & Tests V1 OpenAPI schema/docs to reflect the current Labs & Tests response structure and include
interpretationon observations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| lib/unified_health_data/adapters/lab_or_test_adapter.rb | Adds interpretation mapping and changes interpretation extraction behavior returned to consumers. |
| spec/lib/unified_health_data/adapters/lab_or_test_adapter_spec.rb | Updates unit tests for the new mapped interpretation behavior. |
| modules/mobile/docs/schemas/v1/LabsAndTestsV1.yml | Updates the documented response schema for Mobile Labs & Tests V1 (including interpretation). |
| modules/mobile/docs/openapi.json | Updates generated OpenAPI output to match the updated Labs & Tests V1 schema. |
Comments suppressed due to low confidence (2)
spec/lib/unified_health_data/adapters/lab_or_test_adapter_spec.rb:2863
extract_interpretationnow maps HL7 v3 codes via INTERPRETATION_MAP and falls back when the HL7 code is present but unmapped. There’s no spec covering the case where an HL7 v3 coding exists but the code is not in the map; add a unit test to assert it returns CodeableConcept text/coding display in that scenario.
it 'falls back to interpretation text when no HL7 v3 coding is present' do
obs = {
'code' => { 'text' => 'LDL' },
'interpretation' => [
{
'coding' => [
{
'system' => 'https://fhir.cerner.com/some-id/codeSet/52',
'code' => '212',
'display' => 'NA',
'userSelected' => true
}
],
'text' => 'N/A'
}
]
}
result = adapter.send(:extract_interpretation, obs)
expect(result).to eq('N/A')
end
modules/mobile/docs/schemas/v1/LabsAndTestsV1.yml:168
- The Labs & Tests mobile controllers render
UnifiedHealthData::LabOrTestSerializer.new(labs)without supplyingmeta, which (with JSONAPI::Serializer) typically produces a top-level{ data: [...] }without ameta.paginationobject. This schema requiresmetawith pagination; either update the controller/serializer options to actually include pagination metadata, or relax the schema (and openapi.json) sometaisn’t required for this response.
meta:
type: object
additionalProperties: false
required:
- pagination
properties:
pagination:
type: object
additionalProperties: false
required:
- currentPage
- perPage
- totalPages
- totalEntries
properties:
…ion-to-mobile-response
GovNapoleon
approved these changes
Apr 14, 2026
ryan-mcneil
approved these changes
Apr 15, 2026
nichia
approved these changes
Apr 15, 2026
mdewey
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related issue(s)
Testing done
Screenshots
Note: Optional
What areas of the site does it impact?
(Describe what parts of the site are impacted andifcode touched other areas)
lib/unified_health_data/labs adapter
related tests
modules/mobile/docs (to update the expected response)
related tests
Acceptance criteria