Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 08 gg updates #934

Merged
merged 3 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ private NodeChangeType checkLinks(LoadedFile lf, String s, String path, XhtmlNod
if (nSelfChanged) {
XhtmlNode a = new XhtmlNode(NodeType.Element);
a.setName("a").setAttribute("name", nuid).addText("\u200B");
x.getChildNodes().add(0, a);
x.addChildNode(0, a);
}
if (changed)
return NodeChangeType.SELF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ public String getRelativePath() {
}

public void execute() throws Exception {
XhtmlNode.setCheckParaGeneral(true);

tt = new TimeTracker();
initialize();
if (isBuildingTemplate) {
Expand Down Expand Up @@ -2123,7 +2125,7 @@ private void generateNarratives() throws Exception {
boolean regen = false;
for (Locale lang : langs) {
boolean first = true;
RenderingContext lrc = rc.copy().setDefinitionsTarget(igpkp.getDefinitionsName(r));
RenderingContext lrc = rc.copy(false).setDefinitionsTarget(igpkp.getDefinitionsName(r));
lrc.setLocale(lang);
lrc.setRules(GenerationRules.VALID_RESOURCE);
lrc.setDefinitionsTarget(igpkp.getDefinitionsName(r));
Expand Down Expand Up @@ -2151,7 +2153,8 @@ private void generateNarratives() throws Exception {
} else {
boolean first = true;
for (Locale lang : langs) {
RenderingContext lrc = rc.copy().setParser(getTypeLoader(f,r));
RenderingContext lrc = rc.copy(false).setParser(getTypeLoader(f,r));
lrc.clearAnchors();
lrc.setLocale(lang);
lrc.setRules(GenerationRules.VALID_RESOURCE);
lrc.setSecondaryLang(!first);
Expand Down Expand Up @@ -4373,7 +4376,7 @@ private boolean load() throws Exception {
throw new Error("The version "+publishedIg.getVersion()+" is not a valid semantic version so cannot be published in the ci-build");
} else {
log("The version "+publishedIg.getVersion()+" is not a valid semantic version so cannot be published in the ci-build");
igf.getErrors().add(new ValidationMessage(Source.Publisher, IssueType.EXCEPTION, "ImplementationGuide.version", "The version "+publishedIg.getVersion()+" is not a valid semantic version and will not be acceptible to the ci-build", IssueSeverity.ERROR));
igf.getErrors().add(new ValidationMessage(Source.Publisher, IssueType.EXCEPTION, "ImplementationGuide.version", "The version "+publishedIg.getVersion()+" is not a valid semantic version and will not be acceptible to the ci-build, nor will it be a valid vesion in the NPM package system", IssueSeverity.WARNING));
}
}
String id = npmName;
Expand Down Expand Up @@ -8608,7 +8611,7 @@ private void generateSummaryOutputs(DBBuilder db) throws Exception {

generateCanonicalSummary();

CrossViewRenderer cvr = new CrossViewRenderer(igpkp.getCanonical(), altCanonical, context, igpkp.specPath(), rc.copy());
CrossViewRenderer cvr = new CrossViewRenderer(igpkp.getCanonical(), altCanonical, context, igpkp.specPath(), rc.copy(false));
for (FetchedFile f : fileList) {
for (FetchedResource r : f.getResources()) {
if (r.getResource() != null && r.getResource() instanceof CanonicalResource) {
Expand Down Expand Up @@ -11403,7 +11406,7 @@ private void saveDirectResourceOutputs(FetchedFile f, FetchedResource r, Resourc
long start = System.currentTimeMillis();
XhtmlNode xhtml = getXhtml(f, r);
if (xhtml == null && HistoryGenerator.allEntriesAreHistoryProvenance(r.getElement())) {
RenderingContext ctxt = rc.copy().setParser(getTypeLoader(f, r));
RenderingContext ctxt = rc.copy(false).setParser(getTypeLoader(f, r));
List<ProvenanceDetails> entries = loadProvenanceForBundle(igpkp.getLinkFor(r, true), r.getElement(), f);
xhtml = new HistoryGenerator(ctxt).generateForBundle(entries);
fragment(r.fhirType()+"-"+r.getId()+"-html", new XhtmlComposer(XhtmlComposer.XML).compose(xhtml), f.getOutputNames(), r, vars, null, start, "html", "Resource");
Expand Down Expand Up @@ -11432,7 +11435,7 @@ private void saveDirectResourceOutputs(FetchedFile f, FetchedResource r, Resourc
fragment(r.fhirType()+"-"+r.getId()+"-html", html, f.getOutputNames(), r, vars, null, start, "html", "Resource");
} else {
if (xhtml == null) {
RenderingContext lrc = rc.copy();
RenderingContext lrc = rc.copy(false);
if (r.getResource() != null && r.getResource() instanceof DomainResource) {
xhtml = RendererFactory.factory(r.fhirType(), lrc).buildNarrative(ResourceWrapper.forResource(lrc, r.getResource()));
} else {
Expand Down Expand Up @@ -11499,7 +11502,7 @@ private String saveDirectResourceOutputsContained(FetchedFile f, FetchedResource
long start = System.currentTimeMillis();
XhtmlNode xhtml = getXhtml(f, r, res);
if (xhtml == null && HistoryGenerator.allEntriesAreHistoryProvenance(r.getElement())) {
RenderingContext ctxt = rc.copy().setParser(getTypeLoader(f, r));
RenderingContext ctxt = rc.copy(false).setParser(getTypeLoader(f, r));
List<ProvenanceDetails> entries = loadProvenanceForBundle(igpkp.getLinkFor(r, true), r.getElement(), f);
xhtml = new HistoryGenerator(ctxt).generateForBundle(entries);
fragment(res.fhirType()+"-"+prefixForContained+res.getId()+"-html", new XhtmlComposer(XhtmlComposer.XML).compose(xhtml), f.getOutputNames(), r, vars, prefixForContained, start, "html", "Resource");
Expand Down Expand Up @@ -12247,7 +12250,7 @@ private void generateOutputsLibrary(FetchedFile f, FetchedResource r, Library li
}

private void generateOutputsExampleScenario(FetchedFile f, FetchedResource r, ExampleScenario scen, Map<String,String> vars, String prefixForContainer) throws Exception {
ExampleScenarioRenderer er = new ExampleScenarioRenderer(context, checkAppendSlash(specPath), scen, Utilities.path(tempDir), igpkp, specMaps, pageTargets(), markdownEngine, packge, rc.copy().setDefinitionsTarget(igpkp.getDefinitionsName(r)), versionToAnnotate);
ExampleScenarioRenderer er = new ExampleScenarioRenderer(context, checkAppendSlash(specPath), scen, Utilities.path(tempDir), igpkp, specMaps, pageTargets(), markdownEngine, packge, rc.copy(false).setDefinitionsTarget(igpkp.getDefinitionsName(r)), versionToAnnotate);
if (igpkp.wantGen(r, "actor-table")) {
long start = System.currentTimeMillis();
fragment("ExampleScenario-"+prefixForContainer+scen.getId()+"-actor-table", er.render(ExampleScenarioRendererMode.ACTORS), f.getOutputNames(), r, vars, null, start, "actor-table", "ExampleScenario");
Expand All @@ -12267,7 +12270,7 @@ private void generateOutputsExampleScenario(FetchedFile f, FetchedResource r, Ex
}

private void generateOutputsQuestionnaire(FetchedFile f, FetchedResource r, Questionnaire q, Map<String,String> vars, String prefixForContainer) throws Exception {
QuestionnaireRenderer qr = new QuestionnaireRenderer(context, checkAppendSlash(specPath), q, Utilities.path(tempDir), igpkp, specMaps, pageTargets(), markdownEngine, packge, rc.copy().setDefinitionsTarget(igpkp.getDefinitionsName(r)), versionToAnnotate);
QuestionnaireRenderer qr = new QuestionnaireRenderer(context, checkAppendSlash(specPath), q, Utilities.path(tempDir), igpkp, specMaps, pageTargets(), markdownEngine, packge, rc.copy(false).setDefinitionsTarget(igpkp.getDefinitionsName(r)), versionToAnnotate);
if (igpkp.wantGen(r, "summary")) {
long start = System.currentTimeMillis();
fragment("Questionnaire-"+prefixForContainer+q.getId()+"-summary", qr.summaryTable(r, igpkp.wantGen(r, "xml"), igpkp.wantGen(r, "json"), igpkp.wantGen(r, "ttl"), igpkp.summaryRows()), f.getOutputNames(), r, vars, null, start, "summary", "Questionnaire");
Expand Down Expand Up @@ -12330,7 +12333,7 @@ private String responsesForQuestionnaire(Questionnaire q) {
}

private void generateOutputsQuestionnaireResponse(FetchedFile f, FetchedResource r, Map<String,String> vars, String prefixForContainer) throws Exception {
RenderingContext lrc = rc.copy().setParser(getTypeLoader(f, r));
RenderingContext lrc = rc.copy(false).setParser(getTypeLoader(f, r));
String qu = getQuestionnaireURL(r);
if (qu != null) {
Questionnaire q = context.fetchResource(Questionnaire.class, qu);
Expand Down Expand Up @@ -12387,7 +12390,7 @@ private XhtmlNode getXhtml(FetchedFile f, FetchedResource r) throws Exception {
// return new BundleRenderer(lrc).render(ResourceElement.forResource(lrc, r.getElement()));
// }
if (r.getResource() != null && r.getResource() instanceof Bundle) {
RenderingContext lrc = rc.copy().setParser(getTypeLoader(f, r));
RenderingContext lrc = rc.copy(false).setParser(getTypeLoader(f, r));
Bundle b = (Bundle) r.getResource();
BundleRenderer br = new BundleRenderer(lrc);
if (br.canRender(b)) {
Expand All @@ -12405,7 +12408,7 @@ private XhtmlNode getXhtml(FetchedFile f, FetchedResource r) throws Exception {
return new ParametersRenderer(rc).buildNarrative(ResourceWrapper.forResource(rc, p));
}
if (r.fhirType().equals("Parameters")) {
RenderingContext lrc = rc.copy().setParser(getTypeLoader(f, r));
RenderingContext lrc = rc.copy(false).setParser(getTypeLoader(f, r));
return new ParametersRenderer(lrc).buildNarrative(ResourceWrapper.forResource(lrc, r.getElement()));
} else {
return getHtmlForResource(r.getElement());
Expand All @@ -12426,7 +12429,7 @@ private XhtmlNode getXhtml(FetchedFile f, FetchedResource r, Resource resource)
Parameters p = (Parameters) resource;
return new ParametersRenderer(rc).buildNarrative(ResourceWrapper.forResource(rc, p));
}
RenderingContext lrc = rc.copy().setParser(getTypeLoader(f, r));
RenderingContext lrc = rc.copy(false).setParser(getTypeLoader(f, r));
return RendererFactory.factory(resource, lrc).buildNarrative(ResourceWrapper.forResource(rc, resource));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.hl7.fhir.igtools.publisher.utils;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.npm.NpmPackage;

public class PackagePacker {

public static void main(String[] args) throws FileNotFoundException, IOException {
new PackagePacker().process("/Users/grahamegrieve/web/hl7.org/fhir/extensions/5.1.0-snapshot1/package-new");
}

private void process(String path) throws IOException {

System.out.println("Build Package");
NpmPackage npm = NpmPackage.fromFolder(path);
npm.loadAllFiles();
npm.save(new FileOutputStream("/Users/grahamegrieve/web/hl7.org/fhir/extensions/5.1.0-snapshot1/package.tgz"));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.hl7.fhir.r5.model.PackageInformation;
import org.hl7.fhir.r5.model.PrimitiveType;
import org.hl7.fhir.r5.model.Quantity;
import org.hl7.fhir.r5.model.SearchParameter;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent;
Expand Down Expand Up @@ -2031,6 +2032,7 @@ public String references() throws FHIRFormatError, IOException {
Map<String, String> refs = new HashMap<>();
Map<String, String> trefs = new HashMap<>();
Map<String, String> examples = new HashMap<>();
Map<String, String> searches = new HashMap<>();
for (StructureDefinition sdt : context.fetchResourcesByType(StructureDefinition.class)) {
if (refersToThisSD(sdt.getBaseDefinition())) {
base.put(sdt.getWebPath(), sdt.present());
Expand Down Expand Up @@ -2084,6 +2086,13 @@ public String references() throws FHIRFormatError, IOException {
for (FetchedFile f : files) {
for (FetchedResource r : f.getResources()) {
if (!r.fhirType().equals("ImplementationGuide")) {
if (r.fhirType().equals("SearchParameter")) {
SearchParameter sp = (SearchParameter) r.getResource();
String exp = sp.getExpression();
if (exp.contains("extension('"+sd.getUrl()+"')")) {
searches.put(igp.getLinkFor(r, true), r.getTitle());
}
}
if (usesSD(r.getElement())) {
String p = igp.getLinkFor(r, true);
if (p != null) {
Expand Down Expand Up @@ -2123,12 +2132,18 @@ public String references() throws FHIRFormatError, IOException {
if (!compliedWith.isEmpty()) {
b.append(" <li>Comply with this profile " + type + ": " + refList(compliedWith, "compliedWith") + "</li>\r\n");
}
if (!refs.isEmpty())
if (!refs.isEmpty()) {
b.append(" <li>Use this " + type + ": " + refList(refs, "ref") + "</li>\r\n");
if (!trefs.isEmpty())
}
if (!trefs.isEmpty()) {
b.append(" <li>Refer to this " + type + ": " + refList(trefs, "tref") + "</li>\r\n");
if (!examples.isEmpty())
}
if (!examples.isEmpty()) {
b.append(" <li>Examples for this " + type + ": " + refList(examples, "ex") + "</li>\r\n");
}
if (!searches.isEmpty()) {
b.append(" <li>Search Parameters using this " + type + ": " + refList(searches, "sp") + "</li>\r\n");
}
if (base.isEmpty() && refs.isEmpty() && trefs.isEmpty() && examples.isEmpty() & invoked.isEmpty() && imposed.isEmpty() && compliedWith.isEmpty()) {
b.append(" <li>This " + type + " is not used by any profiles in this Implementation Guide</li>\r\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ private void testIg(String id, String path) throws Exception {
pub.execute();

System.out.println("===== Analysis ======================================================================");
System.out.println("-- output in "+Utilities.path(FhirSettings.getTestIgsPath(), "actual", id+".json")+" --");

// to make diff programs easy to run
IOUtils.copy(new FileInputStream(Utilities.path(FhirSettings.getTestIgsPath(), id, "output", "qa.json")), new FileOutputStream(Utilities.path(FhirSettings.getTestIgsPath(), "actual", id+".json")));
IOUtils.copy(new FileInputStream(Utilities.path(FhirSettings.getTestIgsPath(), id, "output", "qa.compare.txt")), new FileOutputStream(Utilities.path(FhirSettings.getTestIgsPath(), "actual", id+".txt")));
Expand Down Expand Up @@ -172,7 +174,7 @@ private void writeMem(String name) {
System.out.println(name+": "+usedMemory);
}

//---- todo: this class is only run by Grahame, so these ahts are hard-coded
//---- todo: this class is only run by Grahame, so these paths are hard-coded

private File syncDateFile() {
return new File("/Users/grahamegrieve/work/test-igs/date.txt");
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<version>1.6.19-SNAPSHOT</version> <!-- See the note above -->

<properties>
<core_version>6.3.18</core_version>
<core_version>6.3.19-SNAPSHOT</core_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
<apache_poi_version>5.2.1</apache_poi_version>
<okhttp.version>4.11.0</okhttp.version>
Expand Down
1 change: 1 addition & 0 deletions test-statistics.csv
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ Version,example.fhir.uv.myig,fhir.base.template.ig,hl7.base.template.ig,hl7.cda.
1.6.14,71441,955,83,223167,614957,3717,1754846,1025347,,40427,106638,636638,890027,141549,293706
1.6.15,63766,1083,103,122252,279932,1204,1339037,579431,675157,33625,85427,578334,516740,62492,201274
1.6.17,68693,949,96,121108,280290,893,1300165,600615,688971,37985,86649,592377,535137,69995,202884
1.6.19,64172,942,95,113448,297926,1716,714801,595112,655001,32330,98325,476742,398608,59608,190433
109 changes: 109 additions & 0 deletions test-statistics.json
Original file line number Diff line number Diff line change
Expand Up @@ -2823,5 +2823,114 @@
"time" : 688971,
"memory" : 6002722160
}
},
"1.6.19" : {
"sync-date" : "2024-06-30",
"date" : "2024-08-04",
"hl7.fhir.template.ig" : {
"errors" : 0,
"warnings" : 0,
"hints" : 0,
"time" : 1716,
"memory" : 17503264
},
"hl7.cda.uv.core" : {
"errors" : 0,
"warnings" : 140,
"hints" : 0,
"time" : 113448,
"memory" : 3593127096
},
"hl7.fhir.us.ecr" : {
"errors" : 4596,
"warnings" : 330,
"hints" : 113,
"time" : 595112,
"memory" : 8621362000
},
"hl7.fhir.uv.ipa" : {
"errors" : 24,
"warnings" : 8,
"hints" : 38,
"time" : 98325,
"memory" : 2780264320
},
"hl7.fhir.uv.ips" : {
"errors" : 0,
"warnings" : 12,
"hints" : 47,
"time" : 476742,
"memory" : 2348868008
},
"ihe.mhd.fhir" : {
"errors" : 0,
"warnings" : 0,
"hints" : 2,
"time" : 190433,
"memory" : 2439781224
},
"hl7.base.template.ig" : {
"errors" : 0,
"warnings" : 0,
"hints" : 0,
"time" : 95,
"memory" : 4055888
},
"hl7.fhir.uv.howto" : {
"errors" : 1,
"warnings" : 2,
"hints" : 1,
"time" : 32330,
"memory" : 1450879784
},
"fhir.base.template.ig" : {
"errors" : 0,
"warnings" : 0,
"hints" : 0,
"time" : 942,
"memory" : 183851704
},
"hl7.fhir.au.base" : {
"errors" : 1,
"warnings" : 123,
"hints" : 57,
"time" : 297926,
"memory" : 2962810728
},
"example.fhir.uv.myig" : {
"errors" : 21,
"warnings" : 19,
"hints" : 4,
"time" : 64172,
"memory" : 1796660992
},
"hl7.fhir.uv.extensions" : {
"errors" : 1094,
"warnings" : 772,
"hints" : 1606,
"time" : 655001,
"memory" : 8339311752
},
"hl7.fhir.us.core" : {
"errors" : 56,
"warnings" : 3,
"hints" : 3,
"time" : 714801,
"memory" : 14458910008
},
"hl7.fhir.uv.sdc" : {
"errors" : 45,
"warnings" : 67,
"hints" : 368,
"time" : 398608,
"memory" : 2522271816
},
"hl7.fhir.uv.tools" : {
"errors" : 0,
"warnings" : 2,
"hints" : 0,
"time" : 59608,
"memory" : 3115180560
}
}
}
Loading