FIx #1649 - Account for LOINC file format changes in 2.67

This commit is contained in:
James Agnew 2020-01-03 14:19:22 -05:00
parent 2f3018c56e
commit ca3b4297e1
2 changed files with 13 additions and 14 deletions

View File

@ -60,3 +60,7 @@
issue: "1603" issue: "1603"
type: "fix" type: "fix"
title: "The client threw a NullPointerException in some circumstances when it received an HTTP 201 No Content response from the server. This has been corrected. Thanks to Petro Mykhailysyn for the pull request!" title: "The client threw a NullPointerException in some circumstances when it received an HTTP 201 No Content response from the server. This has been corrected. Thanks to Petro Mykhailysyn for the pull request!"
- item:
issue: "1649"
type: "add"
title: "Support for LOINC 2.67 file format changes has been added to the JPA Server LOINC uploader. Thanks to Dan Vreeman for reporting!"

View File

@ -21,8 +21,8 @@ package ca.uhn.fhir.jpa.term.loinc;
*/ */
import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConcept;
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
import ca.uhn.fhir.jpa.term.IRecordHandler; import ca.uhn.fhir.jpa.term.IRecordHandler;
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import org.apache.commons.csv.CSVRecord; import org.apache.commons.csv.CSVRecord;
import org.hl7.fhir.r4.model.ConceptMap; import org.hl7.fhir.r4.model.ConceptMap;
@ -40,16 +40,13 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
public static final String LOINC_SCT_PART_MAP_ID = "loinc-parts-to-snomed-ct"; public static final String LOINC_SCT_PART_MAP_ID = "loinc-parts-to-snomed-ct";
public static final String LOINC_SCT_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-snomed-ct"; public static final String LOINC_SCT_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-snomed-ct";
private static final String LOINC_SCT_PART_MAP_NAME = "LOINC Part Map to SNOMED CT";
public static final String LOINC_TERM_TO_RPID_PART_MAP_ID = "loinc-to-rpids"; public static final String LOINC_TERM_TO_RPID_PART_MAP_ID = "loinc-to-rpids";
public static final String LOINC_TERM_TO_RPID_PART_MAP_URI = "http://loinc.org/cm/loinc-to-rpids"; public static final String LOINC_TERM_TO_RPID_PART_MAP_URI = "http://loinc.org/cm/loinc-to-rpids";
public static final String LOINC_TERM_TO_RPID_PART_MAP_NAME = "LOINC Terms to RadLex RPIDs"; public static final String LOINC_TERM_TO_RPID_PART_MAP_NAME = "LOINC Terms to RadLex RPIDs";
public static final String LOINC_PART_TO_RID_PART_MAP_ID = "loinc-part-to-rids"; public static final String LOINC_PART_TO_RID_PART_MAP_ID = "loinc-part-to-rids";
public static final String LOINC_PART_TO_RID_PART_MAP_URI = "http://loinc.org/cm/loinc-part-to-rids"; public static final String LOINC_PART_TO_RID_PART_MAP_URI = "http://loinc.org/cm/loinc-part-to-rids";
public static final String LOINC_PART_TO_RID_PART_MAP_NAME = "LOINC Parts to RadLex RIDs"; public static final String LOINC_PART_TO_RID_PART_MAP_NAME = "LOINC Parts to RadLex RIDs";
private static final String LOINC_SCT_PART_MAP_NAME = "LOINC Part Map to SNOMED CT";
private static final String LOINC_RXNORM_PART_MAP_ID = "loinc-parts-to-rxnorm"; private static final String LOINC_RXNORM_PART_MAP_ID = "loinc-parts-to-rxnorm";
private static final String LOINC_RXNORM_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-rxnorm"; private static final String LOINC_RXNORM_PART_MAP_URI = "http://loinc.org/cm/loinc-parts-to-rxnorm";
private static final String LOINC_RXNORM_PART_MAP_NAME = "LOINC Part Map to RxNORM"; private static final String LOINC_RXNORM_PART_MAP_NAME = "LOINC Part Map to RxNORM";
@ -69,28 +66,26 @@ public class LoincPartRelatedCodeMappingHandler extends BaseLoincHandler impleme
String partNumber = trim(theRecord.get("PartNumber")); String partNumber = trim(theRecord.get("PartNumber"));
String partName = trim(theRecord.get("PartName")); String partName = trim(theRecord.get("PartName"));
String partTypeName = trim(theRecord.get("PartTypeName"));
String extCodeId = trim(theRecord.get("ExtCodeId")); String extCodeId = trim(theRecord.get("ExtCodeId"));
// TODO: use hex code for ascii 160 // TODO: use hex code for ascii 160
extCodeId = extCodeId.replace(" ", ""); extCodeId = extCodeId.replace(" ", "");
String extCodeDisplayName = trim(theRecord.get("ExtCodeDisplayName")); String extCodeDisplayName = trim(theRecord.get("ExtCodeDisplayName"));
String extCodeSystem = trim(theRecord.get("ExtCodeSystem")); String extCodeSystem = trim(theRecord.get("ExtCodeSystem"));
String mapType = trim(theRecord.get("MapType")); String mapType = trim(theRecord.get("Equivalence"));
String contentOrigin = trim(theRecord.get("ContentOrigin"));
String extCodeSystemVersion = trim(theRecord.get("ExtCodeSystemVersion")); String extCodeSystemVersion = trim(theRecord.get("ExtCodeSystemVersion"));
String extCodeSystemCopyrightNotice = trim(theRecord.get("ExtCodeSystemCopyrightNotice")); String extCodeSystemCopyrightNotice = trim(theRecord.get("ExtCodeSystemCopyrightNotice"));
Enumerations.ConceptMapEquivalence equivalence; Enumerations.ConceptMapEquivalence equivalence;
switch (trim(defaultString(mapType))) { switch (trim(defaultString(mapType))) {
case "": case "":
case "Exact": case "equivalent":
// 'equal' is more exact than 'equivalent' in the equivalence codes // 'equal' is more exact than 'equivalent' in the equivalence codes
equivalence = Enumerations.ConceptMapEquivalence.EQUAL; equivalence = Enumerations.ConceptMapEquivalence.EQUAL;
break; break;
case "LOINC broader": case "narrower":
equivalence = Enumerations.ConceptMapEquivalence.NARROWER; equivalence = Enumerations.ConceptMapEquivalence.NARROWER;
break; break;
case "LOINC narrower": case "wider":
equivalence = Enumerations.ConceptMapEquivalence.WIDER; equivalence = Enumerations.ConceptMapEquivalence.WIDER;
break; break;
default: default: