Skip to content

Commit

Permalink
compile fixes and fixes for David
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Jan 16, 2025
1 parent f5081ae commit 3d0a3c4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1710,9 +1710,6 @@ public ValidationResult validateCode(ValidationOptions options, CodeableConcept
}
}
Set<String> unknownSystems = new HashSet<>();
if ("8517006".equals(code.getCodingFirstRep().getCode())) {
DebugUtilities.breakpoint();
}

List<OperationOutcomeIssueComponent> issues = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,7 @@ public static File file(String path, String filepath) throws IOException {
}

public static File file(File root, String filepath) throws IOException {
switch (accessPolicy) {
case DIRECT:
if (!inAllowedPaths(root.getAbsolutePath())) {
throw new IOException("The path '"+root.getAbsolutePath()+"' cannot be accessed by policy");
}
return new File(root.getAbsolutePath(), filepath);
case MANAGED:
return accessor.file(Utilities.path(root.getAbsolutePath(), filepath));
case PROHIBITED:
throw new IOException("Access to files is not allowed by local security policy");
default:
throw new IOException("Internal Error");
}
return file(root.getAbsolutePath(), filepath);
}
/**
* Open a FileInputStream, conforming to local security policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class ValidationTimeTracker {
private long loadTime = 0;
private long fpeTime = 0;
private long specTime = 0;
private long aiTime = 0;

public long getOverall() {
return overall;
Expand All @@ -28,13 +29,19 @@ public long getSpecTime() {
return specTime;
}

public long getAiTime() {
return aiTime;
}
public void load(long start) {
loadTime = loadTime + (System.nanoTime() - start);
}

public void overall(long start) {
overall = overall + (System.nanoTime() - start);
}
public void ai(long start) {
aiTime = aiTime + (System.nanoTime() - start);
}

public void tx(long start, String s) {
long ms = (System.nanoTime() - start) / 1000000;
Expand All @@ -61,5 +68,6 @@ public void reset() {
loadTime = 0;
fpeTime = 0;
specTime = 0;
aiTime = 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ public void validate(Object appContext, List<ValidationMessage> errors, String p
errors.removeAll(messagesToRemove);
timeTracker.overall(t);
if (aiService != null && !textsToCheck.isEmpty()) {
t = System.nanoTime();
CodeAndTextValidator ctv = new CodeAndTextValidator(cacheFolder, aiService);
List<CodeAndTextValidationResult> results = null;
try {
Expand All @@ -1045,6 +1046,7 @@ public void validate(Object appContext, List<ValidationMessage> errors, String p
}
}
}
timeTracker.ai(t);
}

if (DEBUG_ELEMENT) {
Expand Down Expand Up @@ -7815,7 +7817,9 @@ public long timeNoTX() {
return (timeTracker.getOverall() - timeTracker.getTxTime()) / 1000000;
}
public String reportTimes() {
String s = String.format("Times (ms): overall = %d:4, tx = %d, sd = %d, load = %d, fpe = %d, spec = %d", timeTracker.getOverall() / 1000000, timeTracker.getTxTime() / 1000000, timeTracker.getSdTime() / 1000000, timeTracker.getLoadTime() / 1000000, timeTracker.getFpeTime() / 1000000, timeTracker.getSpecTime() / 1000000);
String s = String.format("Times (ms): overall = %d:4, tx = %d, sd = %d, load = %d, fpe = %d, spec = %d, ai = %d",
timeTracker.getOverall() / 1000000, timeTracker.getTxTime() / 1000000, timeTracker.getSdTime() / 1000000,
timeTracker.getLoadTime() / 1000000, timeTracker.getFpeTime() / 1000000, timeTracker.getSpecTime() / 1000000, timeTracker.getAiTime() / 1000000);
timeTracker.reset();
return s;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public void testResolveRelativeFileInvalid() throws Exception {
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Observation.json")));
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Patient.json")));
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "resolution", "relative-url-invalid.json"), null);
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileValid", op,
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileInvalid", op,
"Observation.subject null error/structure: Unable to find a profile match for Patient/example-newborn among choices: http://hl7.org/fhir/test/StructureDefinition/PatientRule\n"+
"Observation.subject null information/structure: Details for Patient/example-newborn matching against profile http://hl7.org/fhir/test/StructureDefinition/PatientRule|0.1.0\n"+
"Observation null warning/invalid: Best Practice Recommendation: In general, all observations should have a performer\n"+
Expand All @@ -359,7 +359,7 @@ public void testResolveRelativeFileError() throws Exception {
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Observation.json")));
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Patient.json")));
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "resolution", "relative-url-error.json"), null);
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileValid", op,
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileError", op,
"Observation.subject null error/structure: Unable to resolve resource with reference 'patient/example-newborn-x'\n"+
"Observation null warning/invalid: Best Practice Recommendation: In general, all observations should have a performer\n"+
"Observation null warning/invalid: Best Practice Recommendation: In general, all observations should have an effective[x] ()\n"+
Expand All @@ -383,7 +383,7 @@ public void testResolveAbsoluteValid() throws Exception {
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Observation.json")));
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Patient.json")));
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "resolution", "absolute-url-valid.json"), null);
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileValid", op,
Assertions.assertTrue(checkOutcomes("testResolveAbsoluteValid", op,
"Observation.subject.resolve().ofType(Patient).managingOrganization null error/structure: Unable to resolve resource with reference 'Organization/1'\n"+
"Observation.subject.resolve().ofType(Patient).managingOrganization null information/informational: Fetching 'Organization/1' failed. System details: org.hl7.fhir.exceptions.FHIRException: The URL 'Organization/1' is not known to the FHIR validator, and a resolution context has not been provided as part of the setup / parameters\n"+
"Observation null warning/invalid: Best Practice Recommendation: In general, all observations should have a performer\n"+
Expand All @@ -402,7 +402,7 @@ public void testResolveAbsoluteInvalid() throws Exception {
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Observation.json")));
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Patient.json")));
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "resolution", "absolute-url-invalid.json"), null);
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileValid", op,
Assertions.assertTrue(checkOutcomes("testResolveAbsoluteInvalid", op,
"Observation.subject null error/structure: Unable to find a profile match for https://hl7.org/fhir/R4/patient-example-newborn.json among choices: http://hl7.org/fhir/test/StructureDefinition/PatientRule\n"+
"Observation.subject null information/structure: Details for https://hl7.org/fhir/R4/patient-example-newborn.json matching against profile http://hl7.org/fhir/test/StructureDefinition/PatientRule|0.1.0\n"+
"Observation null warning/invalid: Best Practice Recommendation: In general, all observations should have a performer\n"+
Expand All @@ -421,7 +421,7 @@ public void testResolveAbsoluteError() throws Exception {
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Observation.json")));
ve.seeResource(new JsonParser().parse(TestingUtilities.loadTestResourceStream("validator", "resolution", "StructureDefinition-Patient.json")));
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "resolution", "absolute-url-error.json"), null);
Assertions.assertTrue(checkOutcomes("testResolveRelativeFileValid", op,
Assertions.assertTrue(checkOutcomes("testResolveAbsoluteError", op,
"Observation.subject null error/structure: Unable to resolve resource with reference 'http://hl7x.org/fhir/R4/Patient/Patient/example-newborn'\n"+
"Observation.subject null information/informational: Fetching 'http://hl7x.org/fhir/R4/Patient/Patient/example-newborn' failed. System details: java.net.UnknownHostException: hl7x.org\n"+
"Observation null warning/invalid: Best Practice Recommendation: In general, all observations should have a performer\n"+
Expand Down

0 comments on commit 3d0a3c4

Please sign in to comment.