Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pd1-4 mapping to Patient.generalPractitioner #17019

Merged
merged 10 commits into from
Jan 13, 2025
3 changes: 1 addition & 2 deletions prime-router/docs/design/design/HL7v2-FHIR-Inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ implementation differs from what is in the spreadsheets.

### PD1 -> Patient

- PD1.4 is deprecated in the HL7v2.7 and NIST HL7v2.5.1 specs. Further, the HAPI v2.7 model has set both fields to
NULLDT. Thus, this field is not being mapped.
- PD1.4 Backwards compatible in NIST. Needed for ETOR NBS use case. Mapped to Patient.generalPractitioner.

### PV1 -> Patient

Expand Down
21 changes: 15 additions & 6 deletions prime-router/metadata/HL7/catchall/hl7/segments/PID/Patient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resourceType: Patient
# to Patient.link which includes a reference to RelatedPerson


# - PD1.4 Deprecated in NIST, set to NullDT in HAPI. Field not mapped
# - PD1.4 Backwards compatible in NIST. Needed for ETOR NBS use case. Mapped to Patient.generalPractitioner.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a whole heap of context for what this comment is referring to (you can ignore this if you're already aware). The HAPI library will set the object type of some fields to NULLDT (as opposed to String or CE or XCN, etc.) which effectively means values cannot be mapped to those fields. To get around this we have been importing and modifying some of the java classes from HAPI so that we can set field to the most universal types.


id:
type: STRING
Expand Down Expand Up @@ -423,14 +423,23 @@ meta:
expressionType: reference
specs: PID.34

generalPractitioner_Organization:
condition: $pd13 NOT_NULL
generalPractitioner:
expressionType: nested
generateList: true
specs: PD1.3 *
vars:
pd13: STRING_ALL, PD1.3
valueOf: datatypes/XON/Organization
expressionType: reference
pd14: STRING_ALL, PD1.4
expressions:
- condition: $pd13 NOT_NULL
valueOf: datatypes/XON/Organization
expressionType: reference
specs: PD1.3 *
generateList: true
- condition: $pd14 NOT_NULL
valueOf: datatypes/XCN/Practitioner
expressionType: reference
specs: PD1.4 *
generateList: true

extension:
expressionType: nested
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ elements:
constants:
hl7XONField: '%{hl7PD1Field}-3(%{xonIndex})'

- name: patient-primary-provider
resource: '%resource.generalPractitioner.resolve().ofType(Practitioner)'
schema: classpath:/metadata/hl7_mapping/resources/Practitioner/XCN.yml
resourceIndex: xcnIndex
constants:
hl7XCNField: '%{hl7PD1Field}-4(%{xcnIndex})'

- name: student-indicator
condition: '%context.extension(%`rsext-studentStatus`).exists()'
resource: '%resource.extension(%`rsext-studentStatus`).value'
Expand Down
Loading
Loading