LinuxForHealth / hl7v2-fhir-converter

Converts HL7 v2 Messages to FHIR Resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should CWE's structure to a single array of codings?

cragun47 opened this issue · comments

Why is structure of reasonCode in ORU-RO1 sometimes an array of two codings and sometime one coding with an array of two code/systems. Should it be changed to always be one way or the other?

Investigation:

reasonCode goes through the standard CWE processing. It has one CWE with a primary and secondary code, not two repeating CWE's in the same field.
|042^Human immunodeficiency virus [HIV] disease [42]^I9CDX^HIV^HIV/Aids^L^29^V1|

      "reasonCode": [ {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/ICD-9CM-diagnosiscodes",
          "version": "29",
          "code": "042",
          "display": "Human immunodeficiency virus [HIV] disease [42]"
        }, {
          "system": "urn:id:L",
          "version": "V1",
          "code": "HIV",
          "display": "HIV/Aids"
        } ],
        "text": "Human immunodeficiency virus [HIV] disease [42]"
      } ]

If we switch it up to two ~ delimited codes in the same field:
|042^Human immunodeficiency virus [HIV] disease [42]^I9CDX^^^29^~HIV^HIV/Aids^L^^^^V1|
We get an array of two codings. It is a valid coding:

            "reasonCode": [ {
              "coding": [ {
                "system": "http://terminology.hl7.org/CodeSystem/ICD-9CM-diagnosiscodes",
                "code": "042",
                "display": "Human immunodeficiency virus [HIV] disease [42]"
              } ],
              "text": "Human immunodeficiency virus [HIV] disease [42]"
            }, {
              "coding": [ {
                "system": "urn:id:L",
                "version": "V1",
                "code": "HIV",
                "display": "HIV/Aids"
              } ],
              "text": "HIV/Aids"
            } ]

If a field is created with two CWE's each with a primary and secondary coding.
|042^Human immunodeficiency virus [HIV] disease [42]^I9CDX^HIV^HIV/Aids^L^29^V1~042^Human immunodeficiency virus [HIV] disease [42]^I9CDX^HIV^HIV/Aids^L^29^V1
It yields two Codeable concepts, each with two codings:

      "reasonCode": [ {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/ICD-9CM-diagnosiscodes",
          "version": "29",
          "code": "042",
          "display": "Human immunodeficiency virus [HIV] disease [42]"
        }, {
          "system": "urn:id:L",
          "version": "V1",
          "code": "HIV",
          "display": "HIV/Aids"
        } ],
        "text": "Human immunodeficiency virus [HIV] disease [42]"
      }, {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/ICD-9CM-diagnosiscodes",
          "version": "29",
          "code": "042",
          "display": "Human immunodeficiency virus [HIV] disease [42]"
        }, {
          "system": "urn:id:L",
          "version": "V1",
          "code": "HIV",
          "display": "HIV/Aids"
        } ],
        "text": "Human immunodeficiency virus [HIV] disease [42]"
      } ]

Thus, the two-codes in one is currently driven by the primary / secondary codes, and the repeating Codeable concepts is driven by multiple CWEs.

It might get tricky to put them all in the same list structure. It might be doable with nested expressions. Is it worth it? Do we need it?

Something to consider is you lose information if you split a CWE with primary and secondary into two CodeableConcepts. True you gain the text for each, but you lose the fact that they were paired together and there was a possible summary text in CWE 9. The current method only pairs primary and secondary together, so you naturally get that pairing in the resulting JSON.

The current behavior is documented in test testMultipleCWEsWIthSecondaryCodes

Closing this as working as designed, we can re-visit again later if further considerations arise.