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

Conditional Resource Templates #508

Open
stueynz opened this issue Sep 12, 2023 · 0 comments
Open

Conditional Resource Templates #508

stueynz opened this issue Sep 12, 2023 · 0 comments

Comments

@stueynz
Copy link

stueynz commented Sep 12, 2023

Sometimes, when dealing with custom HL7 segments the correct FHIR resource for the segment differs
depending upon some value in the segment. For example, in our ZAL custom Alert segment field ZAL.2.1 denotes the Alert Category, and when the value is one of A1, A3, H2 or H4 then the correct FHIR resource is AllergyIntolerance; for all other
alert category values the correct FHIR resource is Flag

Two resources template entries with suitable condition expressions will direct each ZAL segment to its correct resource template.

resources:
    - resourceName: AllergyIntolerance
      segment: ZAL
      resourcePath: resource/AllergyIntoleranceZAL
      repeats: true
      condition: ZAL.2.1 IN [A1, A3, H2, H4]          ## Some of our custom ZAL segments are AllergyIntolerance
      additionalSegments:

    - resourceName: Flag
      segment: ZAL
      resourcePath: resource/FlagZAL
      repeats: true
      condition: ZAL.2.1 NOT_IN [A1, A3, H2, H4]      ## The rest of our custom ZAL segments are more general alert Flags
      additionalSegments:

The tricky bits are:

  1. Existing expressions don't have IN and NOT_IN operators, and we really do need it for this kind of condition
  2. Condition will be evaluated outside of the context of any ResourceTemplate so there will be no vars or constants available either.
  3. Hl7SpecificationParser needed to be fixed to allow custom segments (beginning with Z) to be correctly handled when parsing field specification.
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

No branches or pull requests

1 participant