more work on cache management

This commit is contained in:
Grahame Grieve 2019-11-07 12:04:24 +11:00
parent a0ece162e7
commit 7099f904f5
28 changed files with 195 additions and 30 deletions

View File

@ -46,12 +46,15 @@ import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Condition;
import org.hl7.fhir.r4.model.DateTimeType;
import org.hl7.fhir.r4.model.DateType;
import org.hl7.fhir.r4.model.DocumentReference;
import org.hl7.fhir.r4.model.Encounter;
import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus;
import org.hl7.fhir.r4.model.MedicationRequest;
import org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Observation.ObservationComponentComponent;
import org.hl7.fhir.r4.model.Observation.ObservationStatus;
@ -123,6 +126,8 @@ public class Mimic14Importer {
processLabEvents(Utilities.path(src, "labevents.csv"), Utilities.path(dest, "lab-observations.json"));
processMicroEvents(Utilities.path(src, "microbiologyevents.csv"), Utilities.path(dest, "micro-observations.json"));
processNoteEvents(Utilities.path(src, "noteevents.csv"), Utilities.path(dest, "notes.json"));
processDiagnoses(Utilities.path(src, "diagnoses_icd.csv"), Utilities.path(dest, "diagnoses.json"));
processPrescriptions(Utilities.path(src, "prescriptions.csv"), Utilities.path(dest, "prescriptions.json"));
System.out.println("saving");
@ -132,6 +137,7 @@ public class Mimic14Importer {
System.out.println("done");
}
private void loadItems(String src) throws NumberFormatException, FHIRException, IOException {
System.out.print("Processing Items... ");
CSVReader csv = new CSVReader(new FileInputStream(src));
@ -312,6 +318,20 @@ public class Mimic14Importer {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("630-4").setDisplay("Bacteria identified in Urine by Culture");
} else if ("70064".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("625-4").setDisplay("Bacteria identified in Stool by Culture");
} else if ("70005".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("43411-8").setDisplay("Bacteria identified in Aspirate by Culture");
} else if ("70045".equals(csv.cell("spec_itemid"))) {
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("16718-9").setDisplay("Cytomegalovirus Ag [Presence] in Blood");
} else if ("70088".equals(csv.cell("spec_itemid"))) {
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("5002-1").setDisplay("Epstein Barr virus DNA [Presence] in Blood by NAA with probe detection");
} else if ("70087".equals(csv.cell("spec_itemid"))) {
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("16712-2").setDisplay("Cytomegalovirus Ab [Units/volume] in Body fluid");
} else if ("70093".equals(csv.cell("spec_itemid"))) {
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("49447-6").setDisplay("Toxoplasma gondii DNA [#/volume] in Blood by NAA with probe detection");
} else if ("70053".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("619-7").setDisplay("Bacteria identified in Peritoneal fluid by Culture");
// } else if ("70013".equals(csv.cell("spec_itemid"))) {
@ -324,17 +344,68 @@ public class Mimic14Importer {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("20447-9").setDisplay("HIV 1 RNA [#/volume] (viral load) in Serum or Plasma by NAA with probe detection");
} else if ("70051".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6463-4").setDisplay("Bacteria identified in Unspecified specimen by Culture");
} else if ("70069".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6463-4").setDisplay("Bacteria identified in Unspecified specimen by Culture");
} else if ("70040".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6463-4").setDisplay("Bacteria identified in Unspecified specimen by Culture");
} else if ("70057".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6463-4").setDisplay("Bacteria identified in Unspecified specimen by Culture");
} else if ("70027".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("88142-5").setDisplay("Bacteria identified in Cornea or Conjunctiva by Aerobe culture");
} else if ("70062".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6460-0").setDisplay("Bacteria identified in Sputum by Culture");
} else if ("70054".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("618-9").setDisplay("Bacteria identified in Pleural fluid by Culture");
} else if ("70067".equals(csv.cell("spec_itemid"))) {
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6462-6").setDisplay("Bacteria identified in Wound by Culture");
} else if ("70028".equals(csv.cell("spec_itemid"))) {
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("62873-5").setDisplay("PhenX - assay herpes simplex virus types 1 - 2 protocol");
} else if ("70070".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6462-6").setDisplay("Bacteria identified in Wound by Culture");
} else if ("70091".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("13317-3").setDisplay("Methicillin resistant Staphylococcus aureus [Presence] in Unspecified specimen by Organism specific culture");
} else if ("70061".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("620-5").setDisplay("Bacteria identified in Skin by Aerobe culture");
} else if ("70030".equals(csv.cell("spec_itemid"))) { // check...
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("31982-2").setDisplay("Varicella zoster virus Ag [Presence] in Unspecified specimen");
} else if ("70013".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("611-4").setDisplay("Bacteria identified in Body fluid by Culture");
} else if ("70011".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("533-0").setDisplay("Mycobacterium sp identified in Blood by Organism specific culture");
} else if ("70009".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("53911-4").setDisplay("Bacteria identified in Bile fluid by Culture");
} else if ("70019".equals(csv.cell("spec_itemid"))) { // check...
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("50659-2").setDisplay("Chromosome analysis.interphase [Interpretation] in Bone marrow by FISH Narrative");
} else if ("70026".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("606-4").setDisplay("Bacteria identified in Cerebral spinal fluid by Culture");
} else if ("70081".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("630-4").setDisplay("Bacteria identified in Urine by Culture");
} else if ("70075".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("626-2").setDisplay("Bacteria identified in Throat by Culture");
} else if ("70069".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("626-2").setDisplay("Bacteria identified in Throat by Culture");
} else if ("70021".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("88683-8").setDisplay("Bacteria identified in Bronchoalveolar lavage by Anaerobe culture");
} else if ("70076".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("43408-4").setDisplay("Bacteria identified in Tissue by Culture");
} else if ("70037".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("43408-4").setDisplay("Bacteria identified in Tissue by Culture");
} else if ("70090".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("88683-8").setDisplay("Bacteria identified in Bronchoalveolar lavage by Anaerobe culture");
} else if ("70047".equals(csv.cell("spec_itemid"))) { // check...
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("621-3").setDisplay("Bacteria identified in Synovial fluid by Culture");
} else if ("70017".equals(csv.cell("spec_itemid"))) { // check...
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("56874-1").setDisplay("Serology and blood bank studies (set)");
} else if ("70042".equals(csv.cell("spec_itemid"))) { // check...
isCulture = false;
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("6438-6").setDisplay("Influenza virus A+B Ag [Presence] in Unspecified specimen by Immunofluorescence");
} else
throw new Error("Not coded yet: "+csv.cell("spec_itemid"));
obs.getCode().addCoding().setSystem("http://mimic.physionet.org/fhir/TestType").setCode(csv.cell("spec_itemid"));
// obs.getCode().addCoding().setSystem("http://mimic.physionet.org/fhir/TestType").setCode(csv.cell("spec_itemid"));
}
if (pat != null) {
@ -405,6 +476,14 @@ public class Mimic14Importer {
oc.setCode(new CodeableConcept(new Coding().setSystem("http://loinc.org").setCode("18943-1").setDisplay("Meropenem [Susceptibility]")).setText(csv.cell("ab_name")));
} else if ("90031".equals(csv.cell("ab_itemid"))) {
oc.setCode(new CodeableConcept(new Coding().setSystem("http://loinc.org").setCode("29258-1").setDisplay("Linezolid [Susceptibility]")).setText(csv.cell("ab_name")));
} else if ("90027".equals(csv.cell("ab_itemid"))) {
oc.setCode(new CodeableConcept(new Coding().setSystem("http://loinc.org").setCode("18974-6").setDisplay("rifAMPin [Susceptibility]")).setText(csv.cell("ab_name")));
} else if ("90009".equals(csv.cell("ab_itemid"))) {
oc.setCode(new CodeableConcept(new Coding().setSystem("http://loinc.org").setCode("18903-5").setDisplay("Chloramphenicol [Susceptibility]")).setText(csv.cell("ab_name")));
} else if ("90003".equals(csv.cell("ab_itemid"))) {
oc.setCode(new CodeableConcept(new Coding().setSystem("http://loinc.org").setCode("18965-4").setDisplay("Penicillin G [Susceptibility]")).setText(csv.cell("ab_name")));
} else if ("90014".equals(csv.cell("ab_itemid"))) {
oc.setCode(new CodeableConcept(new Coding().setSystem("http://loinc.org").setCode("18860-7").setDisplay("Amikacin [Susceptibility]")).setText(csv.cell("ab_name")));
} else
throw new Error("Not coded yet: "+csv.cell("ab_itemid"));
if (csv.has("dilution_text")) {
@ -481,6 +560,77 @@ public class Mimic14Importer {
}
private void processDiagnoses(String src, String dest) throws FileNotFoundException, IOException {
System.out.print("Processing Diagnoses... ");
CSVReader csv = new CSVReader(new FileInputStream(src));
Bundle bnd = new Bundle();
bnd.setId("diagnoses");
bnd.setType(BundleType.COLLECTION);
bnd.setTimestamp(date);
csv.readHeaders();
int t = 0;
while (csv.line()) {
Condition cnd = new Condition();
t++;
Patient pat = patients.get(csv.cell("subject_id"));
Encounter enc = encounters.get(csv.cell("hadm_id"));
cnd.setId(csv.cell("row_id"));
cnd.setVerificationStatus(new CodeableConcept(new Coding().setSystem("http://terminology.hl7.org/CodeSystem/condition-ver-status").setCode("confirmed")));
if (pat != null) {
cnd.setSubject(new Reference("Patient/"+pat.getId()));
}
if (enc != null) {
cnd.setEncounter(new Reference("Encounter/"+enc.getId()));
enc.addDiagnosis().setCondition(new Reference("Condition/"+cnd.getId())).setRank(Integer.parseInt(csv.cell("seq_num")));
}
cnd.setCode(new CodeableConcept(new Coding().setCode(csv.cell("icd9_code")).setSystem("http://hl7.org/fhir/sid/icd-9-cm")));
bnd.addEntry().setResource(cnd);
}
System.out.println(Integer.toString(t)+" found");
csv.close();
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(dest), bnd);
}
private void processPrescriptions(String src, String dest) throws FHIRException, FileNotFoundException, IOException {
System.out.print("Processing Prescriptions... ");
CSVReader csv = new CSVReader(new FileInputStream(src));
Bundle bnd = new Bundle();
bnd.setId("prescriptions");
bnd.setType(BundleType.COLLECTION);
bnd.setTimestamp(date);
csv.readHeaders();
int t = 0;
while (csv.line()) {
MedicationRequest med = new MedicationRequest();
t++;
Patient pat = patients.get(csv.cell("subject_id"));
Encounter enc = encounters.get(csv.cell("hadm_id"));
med.setId(csv.cell("row_id"));
med.setStatus(MedicationRequestStatus.COMPLETED);
if (pat != null) {
med.setSubject(new Reference("Patient/"+pat.getId()));
}
if (enc != null) {
med.setEncounter(new Reference("Encounter/"+enc.getId()));
}
// cnd.setCode(new CodeableConcept(new Coding().setCode(csv.cell("icd9_code")).setSystem("http://hl7.org/fhir/sid/icd-9-cm")));
bnd.addEntry().setResource(med);
}
System.out.println(Integer.toString(t)+" found");
csv.close();
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(dest), bnd);
}
private Type parseQuantity(String cell) {
if (cell.startsWith("<=")) {
return new Quantity().setComparator(QuantityComparator.LESS_OR_EQUAL).setValue(new BigDecimal(cell.substring(2)));

View File

@ -3906,6 +3906,8 @@ public class NarrativeGenerator implements INarrativeGenerator {
}
private String describe(FilterOperator op) {
if (op == null)
return " null ";
switch (op) {
case EQUAL: return " = ";
case ISA: return " is-a ";

View File

@ -17,7 +17,6 @@ import org.hl7.fhir.r5.elementmodel.Element;
import org.hl7.fhir.r5.elementmodel.Manager;
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.utilities.cache.PackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;

View File

@ -26,7 +26,6 @@ import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r5.model.StructureMap;
import org.hl7.fhir.r5.terminologies.ConceptMapEngine;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices;
import org.hl7.fhir.utilities.TextFile;

View File

@ -25,7 +25,6 @@ import org.hl7.fhir.r5.model.Quantity;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.TypeDetails;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
import org.hl7.fhir.utilities.Utilities;

View File

@ -11,7 +11,6 @@ import org.hl7.fhir.r5.model.Bundle.BundleLinkComponent;
import org.hl7.fhir.r5.model.Bundle.SearchEntryMode;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.GraphQLEngine;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;

View File

@ -7,7 +7,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.graphql.EGraphEngine;

View File

@ -14,7 +14,6 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.LiquidEngine;
import org.hl7.fhir.r5.utils.LiquidEngine.ILiquidEngineIcludeResolver;
import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument;

View File

@ -11,7 +11,6 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.r5.utils.NarrativeGenerator;
import org.hl7.fhir.utilities.Utilities;

View File

@ -11,7 +11,6 @@ import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.model.CapabilityStatement;
import org.hl7.fhir.r5.openapi.OpenApiGenerator;
import org.hl7.fhir.r5.openapi.Writer;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.junit.Test;
import org.w3c.dom.Document;

View File

@ -16,7 +16,6 @@ import org.hl7.fhir.r5.model.Base;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.utilities.CSFile;
import org.hl7.fhir.utilities.Utilities;

View File

@ -19,7 +19,6 @@ import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.r5.utils.NarrativeGenerator;
import org.hl7.fhir.utilities.Utilities;

View File

@ -12,7 +12,6 @@ import org.hl7.fhir.r5.conformance.ShExGenerator;
import org.hl7.fhir.r5.conformance.ShExGenerator.HTMLLinkPolicy;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.junit.Test;

View File

@ -43,7 +43,6 @@ import org.hl7.fhir.r5.model.TestScript.TestActionComponent;
import org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent;
import org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent;
import org.hl7.fhir.r5.test.SnapShotGenerationTests.TestFetchMode;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.model.TypeDetails;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.utils.CodingUtilities;

View File

@ -12,7 +12,6 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.model.Base;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.StructureMap;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.r5.utils.StructureMapUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.r5.test.utils;
package org.hl7.fhir.r5.test;
/*-
* #%L

View File

@ -3,7 +3,6 @@ package org.hl7.fhir.r5.test;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.formats.Turtle;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;

View File

@ -44,7 +44,7 @@ import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.test.TestingUtilities;
public class ResourceTest {

View File

@ -12,7 +12,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.model.StructureMap;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.test.TestingUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;

View File

@ -1517,4 +1517,13 @@ public final class IniFile
return strRet;
}
}
public boolean hasSection(String sectionName) {
for (String s : getAllSectionNames()) {
if (s.equalsIgnoreCase(sectionName)) {
return true;
}
}
return false;
}
}

View File

@ -347,7 +347,7 @@ import com.google.gson.JsonObject;
public String fhirVersion() {
if ("hl7.fhir.core".equals(npm.get("name").getAsString()))
return npm.get("version").getAsString();
else if (npm.get("name").getAsString().startsWith("hl7.fhir.r2.") || npm.get("name").getAsString().startsWith("hl7.fhir.r2b.") || npm.get("name").getAsString().startsWith("hl7.fhir.r3.") || npm.get("name").getAsString().startsWith("hl7.fhir.r4."))
else if (npm.get("name").getAsString().startsWith("hl7.fhir.r2.") || npm.get("name").getAsString().startsWith("hl7.fhir.r2b.") || npm.get("name").getAsString().startsWith("hl7.fhir.r3.") || npm.get("name").getAsString().startsWith("hl7.fhir.r4.") || npm.get("name").getAsString().startsWith("hl7.fhir.r5."))
return npm.get("version").getAsString();
else {
JsonObject dep = npm.getAsJsonObject("dependencies");

View File

@ -48,6 +48,7 @@ import org.hl7.fhir.utilities.IniFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@ -565,6 +566,20 @@ public class PackageCacheManager {
//todo: load dependencies
NpmPackage pck = loadPackageInfo(packRoot);
if (!id.equals(npm.getNpm().get("name").getAsString()) || !version.equals(npm.getNpm().get("version").getAsString())) {
if (!id.equals(npm.getNpm().get("name").getAsString())) {
npm.getNpm().addProperty("original-name", npm.getNpm().get("name").getAsString());
npm.getNpm().remove("name");
npm.getNpm().addProperty("name", id);
}
if (!version.equals(npm.getNpm().get("version").getAsString())) {
npm.getNpm().addProperty("original-version", npm.getNpm().get("version").getAsString());
npm.getNpm().remove("version");
npm.getNpm().addProperty("version", version);
}
TextFile.stringToFile(new GsonBuilder().setPrettyPrinting().create().toJson(npm.getNpm()), Utilities.path(cacheFolder, id+"#"+version, "package", "package.json"), false);
}
return pck;
}

View File

@ -22,6 +22,7 @@ import com.google.gson.JsonObject;
public class PackageHacker {
public static void main(String[] args) throws FileNotFoundException, IOException {
new PackageHacker().edit("C:\\web\\hl7.org\\fhir\\us\\qicore\\STU2\\package.tgz");
}
private void edit(String name) throws FileNotFoundException, IOException {
@ -53,12 +54,14 @@ public class PackageHacker {
}
private void change(JsonObject npm, Map<String, byte[]> content) {
JsonArray fhirVersions = new JsonArray();
fhirVersions.add("1.9.0");
npm.add("fhirVersions", fhirVersions);
JsonObject dependencies = new JsonObject();
dependencies.addProperty("hl7.fhir.r3.core", "3.0.2");
npm.remove("dependencies");
npm.remove("version");
npm.addProperty("version", "2.0.0");
// JsonArray fhirVersions = new JsonArray();
// fhirVersions.add("1.9.0");
// npm.add("fhirVersions", fhirVersions);
// JsonObject dependencies = new JsonObject();
// dependencies.addProperty("hl7.fhir.r3.core", "3.0.2");
// npm.remove("dependencies");
// npm.add("dependencies", dependencies);
}

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.validation.tests;
import org.hl7.fhir.r4.context.SimpleWorkerContext;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.test.TestingUtilities;
import org.hl7.fhir.r5.validation.Validator;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.junit.Test;

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.validation.tests;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.test.TestingUtilities;
import org.hl7.fhir.r5.validation.NativeHostServices;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;

View File

@ -8,9 +8,9 @@ import org.hl7.fhir.r5.conformance.ProfileComparer;
import org.hl7.fhir.r5.model.FhirPublication;
import org.hl7.fhir.r5.model.OperationOutcome;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.KeyGenerator;
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r5.test.TestingUtilities;
import org.hl7.fhir.r5.validation.ValidationEngine;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.junit.Assert;

View File

@ -9,7 +9,7 @@ import org.hl7.fhir.r5.model.FhirPublication;
import org.hl7.fhir.r5.model.OperationOutcome;
import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.test.TestingUtilities;
import org.hl7.fhir.r5.validation.ValidationEngine;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;

View File

@ -21,7 +21,7 @@ import org.hl7.fhir.r5.elementmodel.ObjectConverter;
import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.test.TestingUtilities;
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher;