Merge pull request #364 from hapifhir/gg-v5117

release notes
This commit is contained in:
Grahame Grieve 2020-10-14 22:11:24 +11:00 committed by GitHub
commit 058024f57c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 4 deletions

View File

@ -0,0 +1,12 @@
Validator:
* revise error message when can't connect to the terminology server
* enforce constraints in root slicing definitions as well as in the slices
* Improve messages when no terminology server (-tx n/a)
* Validate Profile on type in profile - must be for the right type
Other Changes:
* Add Search Parameter renderer
* Add text separator system on XhtmlNode
* check supportsCopyright in a JUnit test
* turn off snapshot consistency checking by default

View File

@ -3,23 +3,30 @@ package org.hl7.fhir.convertors.misc;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50; import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50; import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.r5.model.Base; import org.hl7.fhir.r5.model.Base;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.CanonicalResource; import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CodeSystem; import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.Provenance;
import org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent;
import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.ToolingExtensions;
@ -27,6 +34,9 @@ import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage; import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformation; import org.hl7.fhir.utilities.npm.NpmPackage.PackageResourceInformation;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import org.hl7.fhir.utilities.npm.ToolsVersion; import org.hl7.fhir.utilities.npm.ToolsVersion;
public class UTGVersionSorter { public class UTGVersionSorter {
@ -42,14 +52,16 @@ public class UTGVersionSorter {
private String fmm; private String fmm;
private boolean normative; private boolean normative;
private String recommendation; private String recommendation;
private String filename;
public CanonicalResourceAnalysis(CanonicalResource cr) { public CanonicalResourceAnalysis(CanonicalResource cr, String filename) {
this.resource = cr; this.resource = cr;
this.filename = filename;
} }
public String summary() { public String summary() {
// return "Relevant: "+resource.getUrl()+" [r2: "+r2Ver+"/"+r2Fmm+"]"+" [r3: "+r3Ver+"/"+r3Fmm+"]"+" [r4: "+r4Ver+"/"+r4Fmm+"/"+r4Normative+"] ---> "+recommendation; // return "Relevant: "+resource.getUrl()+" [r2: "+r2Ver+"/"+r2Fmm+"]"+" [r3: "+r3Ver+"/"+r3Fmm+"]"+" [r4: "+r4Ver+"/"+r4Fmm+"/"+r4Normative+"] ---> "+recommendation;
return resource.getUrl()+" ---> "+recommendation; return resource.getUrl()+" ---> "+recommendation+" in "+filename;
} }
public void analyse(Map<String, CanonicalResource> r2l, Map<String, CanonicalResource> r3l, Map<String, CanonicalResource> r4l) { public void analyse(Map<String, CanonicalResource> r2l, Map<String, CanonicalResource> r3l, Map<String, CanonicalResource> r4l) {
@ -112,8 +124,18 @@ public class UTGVersionSorter {
return r; return r;
} }
public String getId() {
return resource.getId();
} }
public String fhirType() {
return resource.fhirType();
}
}
private Date runTime = new Date();
public static void main(String[] args) throws FileNotFoundException, FHIRException, IOException, ParseException, URISyntaxException { public static void main(String[] args) throws FileNotFoundException, FHIRException, IOException, ParseException, URISyntaxException {
new UTGVersionSorter().execute("C:\\work\\org.hl7.fhir.igs\\UTG\\input\\sourceOfTruth"); new UTGVersionSorter().execute("C:\\work\\org.hl7.fhir.igs\\UTG\\input\\sourceOfTruth");
} }
@ -132,11 +154,31 @@ public class UTGVersionSorter {
cr.analyse(r2,r3,r4); cr.analyse(r2,r3,r4);
} }
Bundle b = (Bundle) new JsonParser().parse(new FileInputStream("C:\\work\\org.hl7.fhir.igs\\UTG\\input\\sourceOfTruth\\history\\utgrel1hx-1-0-6.json"));
System.out.println("Summary"); System.out.println("Summary");
for (CanonicalResourceAnalysis cr : list) { for (CanonicalResourceAnalysis cr : list) {
System.out.println(cr.summary()); System.out.println(cr.summary());
Provenance p = new Provenance();
b.addEntry().setResource(p).setFullUrl("http://terminology.hl7.org/fhir/Provenance/fhir-1.0.51-"+cr.getId());
p.setId("hx-fhir-1.0.51-"+cr.getId());
p.addTarget().setReference(cr.fhirType()+"/"+cr.getId());
p.getOccurredPeriod().setEnd(runTime, TemporalPrecisionEnum.DAY);
p.setRecorded(runTime);
p.addReason().setText("Reset Version after migration to UTG").addCoding("http://terminology.hl7.org/CodeSystem/v3-ActReason","METAMGT", null);
p.getActivity().addCoding("http://terminology.hl7.org/CodeSystem/v3-DataOperation", "UPDATE", null);
ProvenanceAgentComponent pa = p.addAgent();
pa.getType().addCoding("http://terminology.hl7.org/CodeSystem/provenance-participant-type", "author", null);
pa.getWho().setDisplay("Grahame Grieve");
pa = p.addAgent();
pa.getType().addCoding("http://terminology.hl7.org/CodeSystem/provenance-participant-type", "custodian", null);
pa.getWho().setDisplay("Vocabulary WG");
CanonicalResource res = cr.resource;
res.setVersion(cr.recommendation);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(cr.filename), res);
} }
System.out.println(); System.out.println();
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\work\\org.hl7.fhir.igs\\UTG\\input\\sourceOfTruth\\history\\utgrel1hx-1-0-6.json"), b);
System.out.println("Done"); System.out.println("Done");
} }
@ -193,8 +235,8 @@ public class UTGVersionSorter {
if (r instanceof CanonicalResource) { if (r instanceof CanonicalResource) {
CanonicalResource cr = (CanonicalResource) r; CanonicalResource cr = (CanonicalResource) r;
cr.setUserData("path", f.getAbsolutePath()); cr.setUserData("path", f.getAbsolutePath());
if (cr.hasVersion() && cr.getVersion().startsWith("4.")) { if (cr.hasVersion() && cr.getVersion().startsWith("4.") && !Utilities.existsInList(cr.getId(), "v3-DataOperation", "v3-KnowledgeSubjectObservationValue")) {
list.add(new CanonicalResourceAnalysis(cr)); list.add(new CanonicalResourceAnalysis(cr, f.getAbsolutePath()));
} }
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -399,7 +399,13 @@ public boolean hasCoding(String system, String code) {
} }
return res; return res;
} }
public void addCoding(String system, String code, String display) {
getCoding().add(new Coding(system, code, display));
}
// end addition // end addition
} }