commit
54494d699e
|
@ -1,7 +1,7 @@
|
||||||
## Validator Changes
|
## Validator Changes
|
||||||
|
|
||||||
* no changes
|
* Handle invalid HTTP responses better when accessing packages
|
||||||
|
|
||||||
## Other code changes
|
## Other code changes
|
||||||
|
|
||||||
* no changes
|
* Fix various rendering NPEs
|
|
@ -422,7 +422,7 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
|
||||||
ConceptPropertyComponent cp = null;
|
ConceptPropertyComponent cp = null;
|
||||||
if (cd != null) {
|
if (cd != null) {
|
||||||
for (ConceptPropertyComponent t : cd.getProperty()) {
|
for (ConceptPropertyComponent t : cd.getProperty()) {
|
||||||
if (t.getCode().equals(c)) {
|
if (t.hasCode() && t.getCode().equals(c)) {
|
||||||
cp = t;
|
cp = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3800,6 +3800,9 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
if (contentReference.contains("#")) {
|
if (contentReference.contains("#")) {
|
||||||
String url = contentReference.substring(0, contentReference.indexOf("#"));
|
String url = contentReference.substring(0, contentReference.indexOf("#"));
|
||||||
contentReference = contentReference.substring(contentReference.indexOf("#"));
|
contentReference = contentReference.substring(contentReference.indexOf("#"));
|
||||||
|
if (Utilities.noString(url)) {
|
||||||
|
url = source.getUrl();
|
||||||
|
}
|
||||||
if (!url.equals(source.getUrl())) {
|
if (!url.equals(source.getUrl())) {
|
||||||
source = context.fetchResource(StructureDefinition.class, url);
|
source = context.fetchResource(StructureDefinition.class, url);
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
|
|
|
@ -490,11 +490,13 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
||||||
types = new String[] { "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem", "Measures" };
|
types = new String[] { "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem", "Measures" };
|
||||||
}
|
}
|
||||||
for (PackageResourceInformation pri : pi.listIndexedResources(types)) {
|
for (PackageResourceInformation pri : pi.listIndexedResources(types)) {
|
||||||
try {
|
if (!pri.getFilename().contains("ig-r4")) {
|
||||||
registerResourceFromPackage(new PackageResourceLoader(pri, loader), new PackageVersion(pi.id(), pi.version(), pi.dateAsDate()));
|
try {
|
||||||
t++;
|
registerResourceFromPackage(new PackageResourceLoader(pri, loader), new PackageVersion(pi.id(), pi.version(), pi.dateAsDate()));
|
||||||
} catch (FHIRException e) {
|
t++;
|
||||||
throw new FHIRException(formatMessage(I18nConstants.ERROR_READING__FROM_PACKAGE__, pri.getFilename(), pi.name(), pi.version(), e.getMessage()), e);
|
} catch (FHIRException e) {
|
||||||
|
throw new FHIRException(formatMessage(I18nConstants.ERROR_READING__FROM_PACKAGE__, pri.getFilename(), pi.name(), pi.version(), e.getMessage()), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,12 @@ public class SimpleHTTPClient {
|
||||||
public void checkThrowException() throws IOException {
|
public void checkThrowException() throws IOException {
|
||||||
if (code >= 300) {
|
if (code >= 300) {
|
||||||
String filename = Utilities.path("[tmp]", "fhir-http-"+(++counter)+".log");
|
String filename = Utilities.path("[tmp]", "fhir-http-"+(++counter)+".log");
|
||||||
TextFile.bytesToFile(content, filename);
|
if (content.length == 0) {
|
||||||
throw new IOException("Invalid HTTP response "+code+" from "+source+" ("+message+") (content in "+filename+")");
|
throw new IOException("Invalid HTTP response "+code+" from "+source+" ("+message+") (no content)");
|
||||||
|
} else {
|
||||||
|
TextFile.bytesToFile(content, filename);
|
||||||
|
throw new IOException("Invalid HTTP response "+code+" from "+source+" ("+message+") (content in "+filename+")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class PackageHacker {
|
||||||
private static boolean useSecureReferences = false;
|
private static boolean useSecureReferences = false;
|
||||||
|
|
||||||
public static void main(String[] args) throws FileNotFoundException, IOException {
|
public static void main(String[] args) throws FileNotFoundException, IOException {
|
||||||
new PackageHacker().edit("M:\\web\\hl7.org\\fhir\\5.0.0-snapshot1\\hl7.fhir.r5.examples.tgz");
|
new PackageHacker().edit("/Users/grahamegrieve/work/test-cases/validator/swiss.mednet.fhir#0.5.0.tgz");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void edit(String name) throws FileNotFoundException, IOException {
|
private void edit(String name) throws FileNotFoundException, IOException {
|
||||||
|
@ -59,7 +59,7 @@ public class PackageHacker {
|
||||||
|
|
||||||
private void change(JsonObject npm, Map<String, byte[]> content) throws FileNotFoundException, IOException {
|
private void change(JsonObject npm, Map<String, byte[]> content) throws FileNotFoundException, IOException {
|
||||||
fixVersions(npm);
|
fixVersions(npm);
|
||||||
npm.remove("notForPublication");
|
// npm.remove("notForPublication");
|
||||||
// npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1");
|
// npm.addProperty("url", "http://hl7.org/fhir/us/carin-rtpbc/STU1");
|
||||||
// npm.remove("name");
|
// npm.remove("name");
|
||||||
// npm.addProperty("name", "hl7.fhir.uv.smart-app-launch");
|
// npm.addProperty("name", "hl7.fhir.uv.smart-app-launch");
|
||||||
|
@ -69,10 +69,14 @@ public class PackageHacker {
|
||||||
//// npm.addProperty("description", "Group Wrapper that includes all the R4 packages");
|
//// npm.addProperty("description", "Group Wrapper that includes all the R4 packages");
|
||||||
// npm.remove("url");
|
// npm.remove("url");
|
||||||
// npm.addProperty("url", "https://terminology.hl7.org/1.0.0/");
|
// npm.addProperty("url", "https://terminology.hl7.org/1.0.0/");
|
||||||
// npm.remove("dependencies");
|
npm.remove("dependencies");
|
||||||
// JsonObject dep = new JsonObject();
|
JsonObject dep = new JsonObject();
|
||||||
// npm.add("dependencies", dep);
|
npm.add("dependencies", dep);
|
||||||
// dep.addProperty("hl7.fhir.r3.core", "3.0.1");
|
dep.addProperty("hl7.fhir.r4.core", "4.0.1");
|
||||||
|
dep.addProperty("ch.fhir.ig.ch-core", "2.0.0");
|
||||||
|
dep.addProperty("ch.fhir.ig.ch-epr-term", "2.0.4");
|
||||||
|
dep.addProperty("ch.fhir.ig.ch-emed","2.0.0");
|
||||||
|
|
||||||
// dep.addProperty("hl7.fhir.r4.examples", "4.0.1");
|
// dep.addProperty("hl7.fhir.r4.examples", "4.0.1");
|
||||||
// dep.addProperty("hl7.fhir.r4.expansions", "4.0.1");
|
// dep.addProperty("hl7.fhir.r4.expansions", "4.0.1");
|
||||||
// dep.addProperty("hl7.fhir.r4.elements", "4.0.1");
|
// dep.addProperty("hl7.fhir.r4.elements", "4.0.1");
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.hl7.fhir.validation.ipa;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
|
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You give this validator three parameters:
|
||||||
|
* URL of server
|
||||||
|
* access token for the server (most be already logged in)
|
||||||
|
* patient ID - the patient ID that was authorised by the log in
|
||||||
|
*
|
||||||
|
* @author grahamegrieve
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IPAValidator {
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
private String token;
|
||||||
|
private String urn;
|
||||||
|
private InstanceValidator validator;
|
||||||
|
|
||||||
|
public IPAValidator(String address, String token, String urn, InstanceValidator validator) {
|
||||||
|
super();
|
||||||
|
this.address = address;
|
||||||
|
this.token = token;
|
||||||
|
this.urn = urn;
|
||||||
|
this.validator = validator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
public String getUrn() {
|
||||||
|
return urn;
|
||||||
|
}
|
||||||
|
public void setUrn(String urn) {
|
||||||
|
this.urn = urn;
|
||||||
|
}
|
||||||
|
public InstanceValidator getValidator() {
|
||||||
|
return validator;
|
||||||
|
}
|
||||||
|
public void setValidator(InstanceValidator validator) {
|
||||||
|
this.validator = validator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validate() {
|
||||||
|
List<Patient> patients = searchPatients();
|
||||||
|
// check list of patients that have access to
|
||||||
|
// require that at least one of the patients matches the URL
|
||||||
|
// validate all resources and links
|
||||||
|
// validate search parameters
|
||||||
|
// check self links
|
||||||
|
|
||||||
|
// AllergyIntolerance patient patient+clinical-status
|
||||||
|
// Condition patient patient+category, patient+clinical-status, patient+code, patient+onset-date, patient+category+clinical_status
|
||||||
|
// DocumentReference _id, patient, patient+category, patient+type patient+category+date, patient+status, patient+type+period
|
||||||
|
// Immunization patient patient+date, patient+status
|
||||||
|
// MedicationRequest patient patient+intent, patient+intent+authoredon, patient+intent+status
|
||||||
|
// MedicationStatement subject subject+status
|
||||||
|
// Observation patient+category, patient+code, patient+category+date patient+category+status, patient+code+date
|
||||||
|
// Patient _id, identifier birthdate, family, gender, given, name, family+gender, birthdate+family, birthdate+name, gender+name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Patient> searchPatients() {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue