Skip to content

fix: assign Location.physicalType codes to the correct PL/LA2 components - #53

Merged
austinmoody merged 3 commits into
developfrom
IGDD-3285_ehex-physicaltype
Aug 26, 2026
Merged

fix: assign Location.physicalType codes to the correct PL/LA2 components#53
austinmoody merged 3 commits into
developfrom
IGDD-3285_ehex-physicaltype

Conversation

@austinmoody

@austinmoody austinmoody commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

toLocationFromComposite declared the IG's component order but never used it:

int[] c = { 2, 1, 0, 7, 6, 3 };            // the IG mapping
for (int i = 0; i < c.length; i++) {
    Type t1 = ParserUtils.getComponent(comp, i);   // i, not c[i]

Loop walked components 1–6 in order, handed out codes in mapped order. Result: wrong physicalType on nearly every Location, PL-5/PL-6 could become bogus Locations, and Building/Floor (components 7–8) were never read at all.

Found by eHealth Exchange pilot conformance review of a Nevada Z42: "extra data not returned in the Z42: physicalType: BD Bed, lvl Level".

Before / after

Reviewed RXA-11, converted through the Transformation Service:

Component Before After
LA2-1 Point of Care bd/Bed + duplicate description no physicalType (IG maps none; R4 has no code for it)
LA2-7 Building dropped bu/Building
LA2-4 Facility lvl/Level si/Site

Changes

  • Mapping lives in class constants (LOC_COMPONENTS, LOC_CODES, LOC_DISPLAYS); loop indexes by it.
  • Point of Care emits no physicalType — IG cell unresolved, physicalType is 0..1, omitting is conformant. Old wa/Ward had no basis in the IG.
  • Components 9–10 read per datatype: PL gets description (PL-9) and identifier (PL-10); LA1/LA2 get neither (theirs are the address, already on Location.address).
  • New LocationCompositeTests — 12 tests incl. the reviewed RXA-11. Location had zero coverage before.

Sources

Testing

mvn clean install — 24529 tests, 0 failures (baseline 24517; delta = the 12 new tests). Verified end to end via izgw-transform on the reviewed Nevada Z42. Carried on 2.5.2-SNAPSHOT, releases as 2.6.0. OpenSpec: openspec/changes/fix-pilot-fhir-conformance-defects/.

toLocationFromComposite held the IG's component mapping in an array it never
read, so every physical-type code landed on the wrong component: a Point of
Care came out bd/Bed, a Facility lvl/Level, and Building and Floor were never
read at all. The eHealth Exchange review caught it on a Nevada Z42 -- codes we
invented, plus a Building the message did send that never appeared.

Each component now gets its IG code (bd Bed, ro Room, si Facility, bu Building,
lvl Floor). Point of Care gets none: R4's location-physical-type has no code for
one, and the old wa/Ward was a guess. Components 9 and 10 are read per datatype,
so a PL keeps PL-9 as description instead of PL-10's identifier text, and an
LA1/LA2 stops copying its street address there.

BREAKING for Location consumers. 2.5.2-SNAPSHOT for pilot testing, releasing as
2.6.0. Adds LocationCompositeTests, 12 tests where Location had no coverage.
The design and the location-composite-conversion spec said `wa`/Ward was
invented data. `wa` is a real code in FHIR R4's location-physical-type
code system; what has no basis is assigning it to PL/LA1/LA2-1 Point of
Care, which the v2-to-FHIR IG leaves unresolved by naming an extension
rather than a code. Emitting it asserts a physical type the sending
system never sent, which is the actual defect the eHealth Exchange
review reported.

Both files now lead with the IG's unresolved cell, then note that no
concept in location-physical-type describes a point of care, and record
that Location.physicalType is 0..1 so a Location without one is
conformant. The spec scenario is retitled from "invented" to
"substituted" to match.

Wording only; no behavior, no code, no test changes.
Move the change to openspec/changes/archive/2026-08-17-fix-pilot-fhir-conformance-defects
and promote its location-composite-conversion delta to a main spec. The spec contracts how
PL, LA1 and LA2 become Location: which component names each Location, the physicalType code
per component from the IG's datatype-pl-to-location ConceptMap, no code for Point of Care,
the partOf nesting order, Location Status and Person Location Type as operationalStatus and
type, and which element components 9 and beyond supply per datatype.

All 22 tasks complete; 24529 tests pass.
@austinmoody austinmoody changed the title fix: Location.physicalType comes from the component the v2-to-FHIR IG maps fix: assign Location.physicalType codes to the correct PL/LA2 components Aug 18, 2026
@austinmoody
austinmoody marked this pull request as ready for review August 18, 2026 01:23
@sonarqubecloud

Copy link
Copy Markdown

@austinmoody
austinmoody merged commit dd42e32 into develop Aug 26, 2026
2 checks passed
@austinmoody
austinmoody deleted the IGDD-3285_ehex-physicaltype branch August 26, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant