Skip to content

Commit

Permalink
Merge branch 'main' into version-iri-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
balhoff authored Apr 2, 2024
2 parents 414c9c7 + b88bc8b commit f8072d1
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "org.hl7.fhir"
version = "1.9.1-SNAPSHOT"
version = "1.9.2-SNAPSHOT"

java {
withJavadocJar()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fhirCoreVersion = 6.2.15-SNAPSHOT
fhirCoreVersion = 6.3.2
apachePoiVersion = 5.2.1
jacksonVersion = 2.16.0
apacheHttpcomponentsVersion = 4.5.13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ else if (name.equals("FHIRAllTypes"))
}
}
} else if (cd.getBinding() == BindingSpecification.BindingMethod.ValueSet) {
if (Utilities.noString(cd.getReference()))
write("??");
else if (cd.getReference().startsWith("valueset-"))
if (Utilities.noString(cd.getReference())) {
System.out.println("no value set for "+cd.getName());
} else if (cd.getReference().startsWith("valueset-"))
write("<a href=\""+prefix+cd.getReference()+".html\">http://hl7.org/fhir/ValueSet/"+cd.getReference().substring(9)+"</a><!-- a -->");
else if (cd.getReference().startsWith("http://hl7.org/fhir")) {
if (cd.getReference().startsWith("http://terminology.hl7.org/ValueSet/v3-")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -651,7 +652,6 @@ else if (SIDUtilities.isKnownSID(url) || Utilities.existsInList(url, "http://hl7
return true;
}


@Override
public IValidatorResourceFetcher setLocale(Locale locale) {
// don't need to do anything here
Expand All @@ -669,7 +669,7 @@ public byte[] fetchRaw(IResourceValidator validator, String source) throws Malfo


@Override
public CanonicalResource fetchCanonicalResource(IResourceValidator validator, String url) throws URISyntaxException {
public CanonicalResource fetchCanonicalResource(IResourceValidator validator, Object appContext, String url) throws URISyntaxException {
for (CanonicalResource t : context.fetchResourcesByType(CanonicalResource.class)) {
if (t.getUrl().equals(url)) {
return t;
Expand Down Expand Up @@ -863,6 +863,11 @@ public boolean paramIsType(String name, int index) {
throw new NotImplementedException();
}

@Override
public Set<String> fetchCanonicalResourceVersions(IResourceValidator validator, Object appContext, String url) {
return new HashSet<>();
}


}

Expand Down
22 changes: 20 additions & 2 deletions src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
import org.hl7.fhir.convertors.SpecDifferenceEvaluator;
import org.hl7.fhir.convertors.TypeLinkProvider;
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
import org.hl7.fhir.convertors.loaders.loaderR5.R5ToR5Loader;
import org.hl7.fhir.definitions.Config;
import org.hl7.fhir.definitions.generators.specification.BaseGenerator;
import org.hl7.fhir.definitions.generators.specification.DataTypeTableGenerator;
Expand Down Expand Up @@ -479,6 +480,7 @@ public int compare(String arg0, String arg1) {
private String webLocation;
private String searchLocation;
private String extensionsLocation;
private long maxMemory = 0;

private String getComputerName()
{
Expand Down Expand Up @@ -10446,10 +10448,10 @@ public void setDefinitions(Definitions definitions) throws Exception {
workerContext.setAllowLoadingDuplicates(true);
log("Load UTG Terminology", LogMessageType.Process);
utg = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.terminology");
workerContext.loadFromPackage(utg, new R4ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new UTGLoader(utg.version()), workerContext.getVersion()));
workerContext.loadFromPackage(utg, new R5ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new UTGLoader(utg.version())));
log("Load Extensions", LogMessageType.Process);
ext = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.fhir.uv.extensions", "current");
workerContext.loadFromPackage(ext, new R4ToR5Loader(BuildWorkerContext.extensionTypesToLoad(), new ExtensionsLoader(ext.version(), extensionsLocation), workerContext.getVersion()));
workerContext.loadFromPackage(ext, new R5ToR5Loader(BuildWorkerContext.extensionTypesToLoad(), new ExtensionsLoader(ext.version(), extensionsLocation)));
log("Load DICOM Terminology", LogMessageType.Process);
dicom = new FilesystemPackageCacheManager.Builder().build().loadPackage("fhir.dicom");
workerContext.loadFromPackage(dicom, new R4ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new DICOMLoader(utg.version()), workerContext.getVersion()));
Expand Down Expand Up @@ -10530,6 +10532,16 @@ public void log(String content, LogMessageType type) {
System.out.println(String.format("%1$-74s", content)+" "+String.format("%1$8s", Float.toString(gap))+" "+String.format("%1$3s", Long.toString(secs))+"sec "+String.format("%1$4s", Long.toString(used))+"MB");
} else
System.out.println(content);


Runtime runtime = Runtime.getRuntime();
long totalMemory = runtime.totalMemory();
long freeMemory = runtime.freeMemory();
long usedMemory = totalMemory - freeMemory;
if (usedMemory > maxMemory) {
maxMemory = usedMemory;
}

}

// public void logNoEoln(String content) {
Expand Down Expand Up @@ -12442,4 +12454,10 @@ public String processMarkdown(String location, String text) throws FHIRException
throw new FHIRException(e);
}
}

public long getMaxMemory() {
return maxMemory;
}


}
24 changes: 14 additions & 10 deletions src/main/java/org/hl7/fhir/tools/publisher/Publisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ public void execute(String folder, String[] args) throws IOException {
if (isGenerate && buildFlags.get("all"))
produceQA();

page.log("Max Memory Used = "+Utilities.describeSize(page.getMaxMemory()), LogMessageType.Process);
if (!buildFlags.get("all")) {
page.log("This was a Partial Build", LogMessageType.Process);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
Expand Down Expand Up @@ -1871,13 +1872,13 @@ private void addTypes(CodeSystem cs, StructureDefinition sd, List<ConceptDefinit
cd.setDisplay(sd.getType());
cd.setDefinition(sd.getDescription());
if (!sd.getType().equals("Base")) {
CodeSystemUtilities.setProperty(cs, cd, "kind", new CodeType(codeForKind(sd)));
CodeSystemUtilities.setProperty(cs, cd, "http://hl7.org/fhir/type-properties#kind", "kind", new CodeType(codeForKind(sd)));
}
if (sd.getAbstract()) {
CodeSystemUtilities.setProperty(cs, cd, "abstract-type", new BooleanType(true));
CodeSystemUtilities.setProperty(cs, cd, "http://hl7.org/fhir/type-properties#abstract-type", "abstract-type", new BooleanType(true));
}
if (sd.hasExtension(ToolingExtensions.EXT_RESOURCE_INTERFACE)) {
CodeSystemUtilities.setProperty(cs, cd, "interface", new BooleanType(true));
CodeSystemUtilities.setProperty(cs, cd, "http://hl7.org/fhir/type-properties#interface", "interface", new BooleanType(true));
}
list.add(cd);
for (StructureDefinition t : types) {
Expand Down Expand Up @@ -5269,21 +5270,24 @@ private void processExample(Example e, ResourceDefn resn, StructureDefinition pr
}
}
}
if (e.getResource() == null && e.getElement() == null) {
String xml = XMLUtil.elementToString(e.getXml().getDocumentElement()).replace("<?xml version=\"1.0\" encoding=\"UTF-16\"?>", "").trim();
e.setElement(new Manager().parseSingle(page.getWorkerContext(), new StringInputStream(xml), FhirFormat.XML));
e.setResource(new XmlParser().parse(xml));
}
} catch (Throwable ex) {
StringWriter errors = new StringWriter();
System.out.println("Error generating narrative for example "+e.getName()+": "+ex.getMessage());
// ex.printStackTrace();
ex.printStackTrace();
XhtmlNode xhtml = new XhtmlNode(NodeType.Element, "div");
xhtml.addTag("p").setAttribute("style", "color: maroon").addText("Error processing narrative: " + ex.getMessage());
xhtml.addTag("p").setAttribute("style", "color: maroon").addText(errors.toString());
narrative = new XhtmlComposer(XhtmlComposer.HTML).compose(xhtml);
}

try {
if (e.getResource() == null && e.getElement() == null) {
String xml = XMLUtil.elementToString(e.getXml().getDocumentElement()).replace("<?xml version=\"1.0\" encoding=\"UTF-16\"?>", "").trim();
e.setElement(new Manager().parseSingle(page.getWorkerContext(), new StringInputStream(xml), FhirFormat.XML));
e.setResource(new XmlParser().parse(xml));
}
} catch (Throwable ex) {
System.out.println("Error reparsing example "+e.getName()+": "+ex.getMessage());
}
if (rt.equals("ValueSet")) {
try {
ValueSet vs = (ValueSet) loadExample(file);
Expand Down

0 comments on commit f8072d1

Please sign in to comment.