Merge pull request #741 from hapifhir/gg-202202-rendering-plus
Gg 202202 rendering plus
This commit is contained in:
commit
223d4b5ea7
|
@ -38,6 +38,11 @@ public abstract class BaseLoaderR5 implements IContextResourceLoader {
|
|||
|
||||
public void setPath(Resource r) {
|
||||
String path = lkp.getResourcePath(r);
|
||||
if (lkp.getWebRoot() != null) {
|
||||
r.setUserData("webroot", lkp.getWebRoot());
|
||||
} else {
|
||||
r.setUserData("webroot", "");
|
||||
}
|
||||
if (path != null) {
|
||||
r.setUserData("path", path);
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ public interface ILoaderKnowledgeProviderR5 {
|
|||
String getResourcePath(Resource resource);
|
||||
|
||||
ILoaderKnowledgeProviderR5 forNewPackage(NpmPackage npm) throws JsonSyntaxException, IOException;
|
||||
|
||||
String getWebRoot();
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@ public class NullLoaderKnowledgeProviderR5 implements ILoaderKnowledgeProviderR5
|
|||
public ILoaderKnowledgeProviderR5 forNewPackage(NpmPackage npm) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebRoot() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class NPMPackageGenerator {
|
|||
p.remove("name");
|
||||
p.addProperty("name", id);
|
||||
p.remove("type");
|
||||
p.addProperty("type", PackageType.SUBSET.getCode());
|
||||
p.addProperty("type", PackageType.CONFORMANCE.getCode());
|
||||
p.remove("title");
|
||||
p.addProperty("title", name);
|
||||
return new NPMPackageGenerator(destFile, p);
|
||||
|
|
|
@ -120,7 +120,7 @@ public class NPMPackageGenerator {
|
|||
p.remove("name");
|
||||
p.addProperty("name", id);
|
||||
p.remove("type");
|
||||
p.addProperty("type", PackageType.SUBSET.getCode());
|
||||
p.addProperty("type", PackageType.CONFORMANCE.getCode());
|
||||
p.remove("title");
|
||||
p.addProperty("title", name);
|
||||
if (notForPublication) {
|
||||
|
|
|
@ -104,6 +104,7 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingCompo
|
|||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||
import org.hl7.fhir.r5.model.UriType;
|
||||
import org.hl7.fhir.r5.model.UsageContext;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
|
@ -2480,19 +2481,19 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (webUrl != null) {
|
||||
// also, must touch up the markdown
|
||||
if (element.hasDefinition())
|
||||
element.setDefinition(processRelativeUrls(element.getDefinition(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
element.setDefinition(processRelativeUrls(element.getDefinition(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames, true));
|
||||
if (element.hasComment())
|
||||
element.setComment(processRelativeUrls(element.getComment(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
element.setComment(processRelativeUrls(element.getComment(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames, true));
|
||||
if (element.hasRequirements())
|
||||
element.setRequirements(processRelativeUrls(element.getRequirements(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
element.setRequirements(processRelativeUrls(element.getRequirements(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames, true));
|
||||
if (element.hasMeaningWhenMissing())
|
||||
element.setMeaningWhenMissing(processRelativeUrls(element.getMeaningWhenMissing(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
element.setMeaningWhenMissing(processRelativeUrls(element.getMeaningWhenMissing(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames, true));
|
||||
}
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public static String processRelativeUrls(String markdown, String webUrl, String basePath, List<String> resourceNames, Set<String> filenames) {
|
||||
public static String processRelativeUrls(String markdown, String webUrl, String basePath, List<String> resourceNames, Set<String> filenames, boolean processRelatives) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
int i = 0;
|
||||
while (i < markdown.length()) {
|
||||
|
@ -2520,7 +2521,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
} else {
|
||||
b.append("](");
|
||||
// disabled 7-Dec 2021 GDG - we don't want to fool with relative URLs at all?
|
||||
// b.append(webUrl);
|
||||
// re-enabled 11-Feb 2022 GDG - we do want to do this. At least, $assemble in davinci-dtr, where the markdown comes from the SDC IG, and an SDC local reference must be changed to point to SDC. in this case, it's called when generating snapshots
|
||||
// added processRelatives parameter to deal with this (well, to try)
|
||||
if (processRelatives) {
|
||||
b.append(webUrl);
|
||||
} else {
|
||||
System.out.println("Not making "+url+" relative to '"+webUrl+"'");
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
} else
|
||||
|
@ -2778,7 +2785,9 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
profile = source.getType().size() == 1 && source.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, source.getTypeFirstRep().getProfile().get(0).getValue()) : null;
|
||||
if (profile != null) {
|
||||
ElementDefinition e = profile.getSnapshot().getElement().get(0);
|
||||
base.setDefinition(e.getDefinition());
|
||||
String webroot = profile.getUserString("webroot");
|
||||
|
||||
base.setDefinition(processRelativeUrls(e.getDefinition(), webroot, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames, true));
|
||||
base.setShort(e.getShort());
|
||||
if (e.hasCommentElement())
|
||||
base.setCommentElement(e.getCommentElement());
|
||||
|
@ -4688,6 +4697,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
c.getPieces().add(gen.new Piece(null, ": ", null));
|
||||
c.addMarkdownNoPara(PublicationHacker.fixBindingDescriptions(context, binding.getDescriptionElement()).asStringValue(), checkForNoChange(PublicationHacker.fixBindingDescriptions(context, binding.getDescriptionElement())));
|
||||
}
|
||||
if (binding.hasExtension(ToolingExtensions.EXT_BINDING_ADDITIONAL)) {
|
||||
c.addPiece(gen.new Piece("br"));
|
||||
c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, translate("sd.table", "Additional Bindings")+": ", null).addStyle("font-weight:bold")));
|
||||
for (Extension ext : binding.getExtensionsByUrl(ToolingExtensions.EXT_BINDING_ADDITIONAL)) {
|
||||
renderAdditionalBinding(gen, c, ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
|
||||
if (!inv.hasSource() || profile == null || inv.getSource().equals(profile.getUrl()) || allInvariants) {
|
||||
|
@ -4767,6 +4783,23 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
return c;
|
||||
}
|
||||
|
||||
private void renderAdditionalBinding(HierarchicalTableGenerator gen, Cell c, Extension ext) {
|
||||
// <nsbp>2 <sp> purpose <sp> value-set-link ([context]) {documentation}
|
||||
// String purpose = ext.getExtensionString("purpose");
|
||||
// String valueSet = ext.getExtensionString("valueSet");
|
||||
// String doco = ext.getExtensionString("documentation");
|
||||
// UsageContext usage = (ext.hasExtension("usage")) ? ext.getExtensionByUrl("usage").getValueUsageContext() : null;
|
||||
//
|
||||
// purpose: code - defines how the binding is used
|
||||
// usage : UsageContext - defines the contexts in which this binding is used for it's purpose
|
||||
// valueSet : canonical(ValueSet)
|
||||
// documentation : markdown
|
||||
// !!
|
||||
// c.getPieces().add(checkForNoChange(inv, gen.new Piece(null, inv.getKey()+": ", null).addStyle("font-weight:bold")));
|
||||
// c.getPieces().add(checkForNoChange(inv, gen.new Piece(null, gt(inv.getHumanElement()), null)));
|
||||
|
||||
}
|
||||
|
||||
private BindingResolution makeNullBr(ElementDefinitionBindingComponent binding) {
|
||||
BindingResolution br = new BindingResolution();
|
||||
br.url = "http://none.none/none";
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package org.hl7.fhir.r5.renderers;
|
||||
|
||||
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
|
||||
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
|
||||
import static java.time.temporal.ChronoField.YEAR;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -9,8 +13,12 @@ import java.text.SimpleDateFormat;
|
|||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.chrono.IsoChronology;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.format.FormatStyle;
|
||||
import java.time.format.ResolverStyle;
|
||||
import java.time.format.SignStyle;
|
||||
import java.util.Currency;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
@ -39,6 +47,7 @@ import org.hl7.fhir.r5.model.DataRequirement.SortDirection;
|
|||
import org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
import org.hl7.fhir.r5.model.DateTimeType;
|
||||
import org.hl7.fhir.r5.model.DateType;
|
||||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.model.Expression;
|
||||
import org.hl7.fhir.r5.model.Extension;
|
||||
|
@ -413,15 +422,8 @@ public class DataRenderer extends Renderer {
|
|||
// mode - if rendering mode is technical, format defaults to XML format
|
||||
// locale - otherwise, format defaults to SHORT for the Locale (which defaults to default Locale)
|
||||
if (isOnlyDate(type.getPrecision())) {
|
||||
DateTimeFormatter fmt = context.getDateFormat();
|
||||
if (fmt == null) {
|
||||
if (context.isTechnicalMode()) {
|
||||
fmt = DateTimeFormatter.ISO_DATE;
|
||||
} else {
|
||||
fmt = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(context.getLocale());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DateTimeFormatter fmt = getDateFormatForPrecision(type);
|
||||
LocalDate date = LocalDate.of(type.getYear(), type.getMonth()+1, type.getDay());
|
||||
return fmt.format(date);
|
||||
}
|
||||
|
@ -440,6 +442,43 @@ public class DataRenderer extends Renderer {
|
|||
zdt = zdt.withZoneSameInstant(zone);
|
||||
}
|
||||
return fmt.format(zdt);
|
||||
}
|
||||
|
||||
private DateTimeFormatter getDateFormatForPrecision(BaseDateTimeType type) {
|
||||
DateTimeFormatter fmt = getContextDateFormat(type);
|
||||
if (fmt != null) {
|
||||
return fmt;
|
||||
}
|
||||
if (context.isTechnicalMode()) {
|
||||
switch (type.getPrecision()) {
|
||||
case YEAR:
|
||||
return new DateTimeFormatterBuilder().appendValue(YEAR, 4, 10, SignStyle.EXCEEDS_PAD).toFormatter();
|
||||
case MONTH:
|
||||
return new DateTimeFormatterBuilder().appendValue(YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-').appendValue(MONTH_OF_YEAR, 2).toFormatter();
|
||||
default:
|
||||
return DateTimeFormatter.ISO_DATE;
|
||||
}
|
||||
} else {
|
||||
switch (type.getPrecision()) {
|
||||
case YEAR:
|
||||
return DateTimeFormatter.ofPattern("uuuu");
|
||||
case MONTH:
|
||||
return DateTimeFormatter.ofPattern("MMM uuuu");
|
||||
default:
|
||||
return DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(context.getLocale());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DateTimeFormatter getContextDateFormat(BaseDateTimeType type) {
|
||||
switch (type.getPrecision()) {
|
||||
case YEAR:
|
||||
return context.getDateYearFormat();
|
||||
case MONTH:
|
||||
return context.getDateYearMonthFormat();
|
||||
default:
|
||||
return context.getDateFormat();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOnlyDate(TemporalPrecisionEnum temporalPrecisionEnum) {
|
||||
|
@ -533,6 +572,12 @@ public class DataRenderer extends Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
public void renderDate(XhtmlNode x, Base e) {
|
||||
if (e.hasPrimitiveValue()) {
|
||||
x.addText(displayDateTime((DateType) e));
|
||||
}
|
||||
}
|
||||
|
||||
public void renderDateTime(XhtmlNode x, String s) {
|
||||
if (s != null) {
|
||||
DateTimeType dt = new DateTimeType(s);
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.io.IOException;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.apache.poi.hssf.record.chart.DatRecord;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.model.DateTimeType;
|
||||
import org.hl7.fhir.r5.model.DateType;
|
||||
import org.hl7.fhir.r5.model.DomainResource;
|
||||
|
@ -176,7 +178,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
b.append(display(name));
|
||||
b.append(" ");
|
||||
if (dob == null) {
|
||||
b.append("??");
|
||||
b.append("(no stated gender)");
|
||||
} else {
|
||||
b.append(gender);
|
||||
}
|
||||
|
@ -196,13 +198,13 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
|
||||
public void describe(XhtmlNode x, HumanName name, String gender, DateType dob, Identifier id) throws UnsupportedEncodingException, IOException {
|
||||
if (name == null) {
|
||||
x.b().tx("Unnamed Patient"); // todo: is this appropriate?
|
||||
x.b().tx("Anonymous Patient"); // todo: is this appropriate?
|
||||
} else {
|
||||
render(x.b(), name);
|
||||
}
|
||||
x.tx(" ");
|
||||
if (gender == null) {
|
||||
x.tx("??");
|
||||
x.tx("(no stated gender)");
|
||||
} else {
|
||||
x.tx(gender);
|
||||
}
|
||||
|
@ -219,5 +221,9 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean render(XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException {
|
||||
describe(x, r);
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -312,9 +312,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
x.addText(new Base64().encodeAsString(((Base64BinaryType) e).getValue()));
|
||||
else if (e instanceof org.hl7.fhir.r5.model.DateType) {
|
||||
org.hl7.fhir.r5.model.DateType dt = ((org.hl7.fhir.r5.model.DateType) e);
|
||||
if (((org.hl7.fhir.r5.model.DateType) e).hasValue()) {
|
||||
x.addText(((org.hl7.fhir.r5.model.DateType) e).toHumanDisplay());
|
||||
}
|
||||
renderDate(x, dt);
|
||||
} else if (e instanceof Enumeration) {
|
||||
Object ev = ((Enumeration<?>) e).getValue();
|
||||
x.addText(ev == null ? "" : ev.toString()); // todo: look up a display name if there is one
|
||||
|
|
|
@ -712,7 +712,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
XhtmlNode ans = item(ul, "Answers");
|
||||
if (!Utilities.noString(i.getAnswerValueSet()) && i.getAnswerValueSet().startsWith("#")) {
|
||||
ValueSet vs = (ValueSet) q.getContained(i.getAnswerValueSet().substring(1));
|
||||
if (vs == null) {
|
||||
if (vs == null || !vs.hasUserData("path")) {
|
||||
ans.tx(i.getAnswerValueSet());
|
||||
} else {
|
||||
ans.ah(vs.getUserString("path")).tx(vs.present());
|
||||
|
|
|
@ -114,6 +114,9 @@ public class RendererFactory {
|
|||
if ("Library".equals(resource.getName())) {
|
||||
return new LibraryRenderer(context);
|
||||
}
|
||||
if ("Patient".equals(resource.getName())) {
|
||||
return new PatientRenderer(context);
|
||||
}
|
||||
if ("DiagnosticReport".equals(resource.getName())) {
|
||||
return new DiagnosticReportRenderer(context);
|
||||
}
|
||||
|
|
|
@ -127,6 +127,8 @@ public class RenderingContext {
|
|||
private ZoneId timeZoneId;
|
||||
private DateTimeFormatter dateTimeFormat;
|
||||
private DateTimeFormatter dateFormat;
|
||||
private DateTimeFormatter dateYearFormat;
|
||||
private DateTimeFormatter dateYearMonthFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -359,7 +361,16 @@ public class RenderingContext {
|
|||
res.definitionsTarget = definitionsTarget;
|
||||
res.destDir = destDir;
|
||||
res.addGeneratedNarrativeHeader = addGeneratedNarrativeHeader;
|
||||
|
||||
res.questionnaireMode = questionnaireMode;
|
||||
res.header = header;
|
||||
res.selfLink = selfLink;
|
||||
res.inlineGraphics = inlineGraphics;
|
||||
res.timeZoneId = timeZoneId;
|
||||
res.dateTimeFormat = dateTimeFormat;
|
||||
res.dateFormat = dateFormat;
|
||||
res.dateYearFormat = dateYearFormat;
|
||||
res.dateYearMonthFormat = dateYearMonthFormat;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -514,6 +525,30 @@ public class RenderingContext {
|
|||
this.dateFormat = DateTimeFormatter.ofPattern(dateFormat);
|
||||
}
|
||||
|
||||
public DateTimeFormatter getDateYearFormat() {
|
||||
return dateYearFormat;
|
||||
}
|
||||
|
||||
public void setDateYearFormat(DateTimeFormatter dateYearFormat) {
|
||||
this.dateYearFormat = dateYearFormat;
|
||||
}
|
||||
|
||||
public void setDateYearFormatString(String dateYearFormat) {
|
||||
this.dateYearFormat = DateTimeFormatter.ofPattern(dateYearFormat);
|
||||
}
|
||||
|
||||
public DateTimeFormatter getDateYearMonthFormat() {
|
||||
return dateYearMonthFormat;
|
||||
}
|
||||
|
||||
public void setDateYearMonthFormat(DateTimeFormatter dateYearMonthFormat) {
|
||||
this.dateYearMonthFormat = dateYearMonthFormat;
|
||||
}
|
||||
|
||||
public void setDateYearMonthFormatString(String dateYearMonthFormat) {
|
||||
this.dateYearMonthFormat = DateTimeFormatter.ofPattern(dateYearMonthFormat);
|
||||
}
|
||||
|
||||
public ResourceRendererMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.hl7.fhir.r5.context.TerminologyCache;
|
|||
import org.hl7.fhir.r5.model.Parameters;
|
||||
import org.hl7.fhir.utilities.CSFile;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.ToolGlobalSettings;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
|
@ -164,14 +165,10 @@ public class TestingUtilities extends BaseTestingUtilities {
|
|||
public static String checkXMLIsSame(String f1, String f2) throws Exception {
|
||||
String result = compareXml(f1, f2);
|
||||
if (result != null && SHOW_DIFF) {
|
||||
String diff = Utilities.path(System.getenv("ProgramFiles"), "WinMerge", "WinMergeU.exe");
|
||||
if (new File(diff).exists()) {
|
||||
String diff = ToolGlobalSettings.hasComparePath() ? ToolGlobalSettings.getComparePath() : Utilities.path(System.getenv("ProgramFiles"), "WinMerge", "WinMergeU.exe");
|
||||
if (new File(diff).exists() || Utilities.isToken(diff)) {
|
||||
List<String> command = new ArrayList<String>();
|
||||
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
|
||||
|
||||
ProcessBuilder builder = new ProcessBuilder(command);
|
||||
builder.directory(new CSFile("c:\\temp"));
|
||||
builder.start();
|
||||
Process p = Runtime.getRuntime().exec(new String[]{diff, f1, f2});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -490,6 +487,8 @@ public class TestingUtilities extends BaseTestingUtilities {
|
|||
String path = Utilities.path("C:\\temp", name);
|
||||
Utilities.createDirectory(path);
|
||||
return path;
|
||||
} else if (ToolGlobalSettings.hasTempPath()) {
|
||||
return ToolGlobalSettings.getTempPath();
|
||||
} else if (new File("/tmp").exists()) {
|
||||
String path = Utilities.path("/tmp", name);
|
||||
Utilities.createDirectory(path);
|
||||
|
|
|
@ -120,7 +120,7 @@ public class NPMPackageGenerator {
|
|||
p.remove("name");
|
||||
p.addProperty("name", id);
|
||||
p.remove("type");
|
||||
p.addProperty("type", PackageType.SUBSET.getCode());
|
||||
p.addProperty("type", PackageType.CONFORMANCE.getCode());
|
||||
p.remove("title");
|
||||
p.addProperty("title", name);
|
||||
if (notForPublication) {
|
||||
|
|
|
@ -200,6 +200,7 @@ public class ToolingExtensions {
|
|||
public static final String EXT_VALUESET_SYSTEM = "http://hl7.org/fhir/StructureDefinition/valueset-system";
|
||||
public static final String EXT_EXPAND_RULES = "http://hl7.org/fhir/StructureDefinition/valueset-expand-rules";
|
||||
public static final String EXT_EXPAND_GROUP = "http://hl7.org/fhir/StructureDefinition/valueset-expand-group";
|
||||
public static final String EXT_BINDING_ADDITIONAL = "http://hl7.org/fhir/tools/StructureDefinition/additional-binding";
|
||||
|
||||
// specific extension helpers
|
||||
|
||||
|
|
|
@ -67,6 +67,9 @@ public class XVerExtensionManager {
|
|||
}
|
||||
JsonObject root = lists.get(v);
|
||||
JsonObject path = root.getAsJsonObject(e);
|
||||
if (path == null) {
|
||||
path = root.getAsJsonObject(e+"[x]");
|
||||
}
|
||||
if (path == null) {
|
||||
return XVerExtensionStatus.Unknown;
|
||||
}
|
||||
|
@ -90,6 +93,9 @@ public class XVerExtensionManager {
|
|||
String e = url.substring(54);
|
||||
JsonObject root = lists.get(verSource);
|
||||
JsonObject path = root.getAsJsonObject(e);
|
||||
if (path == null) {
|
||||
path = root.getAsJsonObject(e+"[x]");
|
||||
}
|
||||
|
||||
StructureDefinition sd = new StructureDefinition();
|
||||
sd.setUserData(XVER_EXT_MARKER, "true");
|
||||
|
|
|
@ -111,15 +111,7 @@ public class NarrativeGenerationTests {
|
|||
List<Arguments> objects = new ArrayList<>();
|
||||
while (test != null && test.getNodeName().equals("test")) {
|
||||
TestDetails t = new TestDetails(test);
|
||||
if (t.getId().equals("sdc")) {
|
||||
if (SystemUtils.OS_NAME.contains(WINDOWS)) {
|
||||
objects.add(Arguments.of(t.getId(), t));
|
||||
} else {
|
||||
System.out.println("sdc test not being adding because the current OS will not pass the test...");
|
||||
}
|
||||
} else {
|
||||
objects.add(Arguments.of(t.getId(), t));
|
||||
}
|
||||
objects.add(Arguments.of(t.getId(), t));
|
||||
test = XMLUtil.getNextSibling(test);
|
||||
}
|
||||
return objects.stream();
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
-------------------------------------------------------------------------------------
|
||||
{"hierarchical" : false, "valueSet" :{
|
||||
"resourceType" : "ValueSet",
|
||||
"compose" : {
|
||||
"include" : [{
|
||||
"system" : "http://loinc.org",
|
||||
"concept" : [{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "A."
|
||||
}],
|
||||
"code" : "LA20752-4",
|
||||
"display" : "Within 24 hours"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "B."
|
||||
}],
|
||||
"code" : "LA20753-2",
|
||||
"display" : "After 24 hours but before 3 days"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "C."
|
||||
}],
|
||||
"code" : "LA20754-0",
|
||||
"display" : "Three days or later"
|
||||
},
|
||||
{
|
||||
"extension" : [{
|
||||
"url" : "http://hl7.org/fhir/StructureDefinition/valueset-label",
|
||||
"valueString" : "D."
|
||||
}],
|
||||
"code" : "LA4489-6",
|
||||
"display" : "Unknown"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}}####
|
||||
e: {
|
||||
"error" : "Cannot invoke \"org.hl7.fhir.r5.terminologies.TerminologyClient.expandValueset(org.hl7.fhir.r5.model.ValueSet, org.hl7.fhir.r5.model.Parameters, java.util.Map)\" because \"this.txClient\" is null"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
|
@ -1512,9 +1512,11 @@ public final class IniFile
|
|||
}
|
||||
|
||||
public boolean hasSection(String sectionName) {
|
||||
for (String s : getAllSectionNames()) {
|
||||
if (s.equalsIgnoreCase(sectionName)) {
|
||||
return true;
|
||||
if (getAllSectionNames() != null) {
|
||||
for (String s : getAllSectionNames()) {
|
||||
if (s.equalsIgnoreCase(sectionName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package org.hl7.fhir.utilities;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ToolGlobalSettings {
|
||||
|
||||
private static boolean inited = false;
|
||||
|
||||
private static String npmPath;
|
||||
private static String rubyPath;
|
||||
private static String testsPath;
|
||||
private static String comparePath;
|
||||
private static String tempPath;
|
||||
|
||||
public static String getNpmPath() {
|
||||
init();
|
||||
return npmPath;
|
||||
}
|
||||
public static String getRubyPath() {
|
||||
init();
|
||||
return rubyPath;
|
||||
}
|
||||
public static String getTestsPath() {
|
||||
init();
|
||||
return testsPath;
|
||||
}
|
||||
|
||||
public static boolean hasNpmPath() {
|
||||
init();
|
||||
return npmPath != null;
|
||||
}
|
||||
public static boolean hasRubyPath() {
|
||||
init();
|
||||
return rubyPath != null;
|
||||
}
|
||||
public static boolean hasTestsPath() {
|
||||
init();
|
||||
return testsPath != null;
|
||||
}
|
||||
|
||||
public static String getComparePath() {
|
||||
return comparePath;
|
||||
}
|
||||
public static boolean hasComparePath() {
|
||||
return comparePath != null;
|
||||
}
|
||||
public static String getTempPath() {
|
||||
return tempPath;
|
||||
}
|
||||
public static boolean hasTempPath() {
|
||||
return tempPath != null;
|
||||
}
|
||||
private static void init() {
|
||||
if (!inited) {
|
||||
inited = true;
|
||||
IniFile ini;
|
||||
try {
|
||||
ini = new IniFile(Utilities.path(Utilities.path(System.getProperty("user.home"), ".fhir", "fhir-tool-settings.conf")));
|
||||
if (ini.hasSection("paths")) {
|
||||
npmPath = ini.getStringProperty("paths", "npm");
|
||||
rubyPath = ini.getStringProperty("paths", "ruby");
|
||||
testsPath = ini.getStringProperty("paths", "tests");
|
||||
comparePath = ini.getStringProperty("paths", "compare");
|
||||
tempPath = ini.getStringProperty("paths", "temp");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -596,6 +596,8 @@ public class Utilities {
|
|||
if ("[tmp]".equals(a)) {
|
||||
if (hasCTempDir()) {
|
||||
a = "c:\\temp";
|
||||
} else if (ToolGlobalSettings.hasTempPath()) {
|
||||
a = ToolGlobalSettings.getTempPath();
|
||||
} else {
|
||||
a = System.getProperty("java.io.tmpdir");
|
||||
}
|
||||
|
|
|
@ -626,12 +626,12 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
JsonObject json = JsonTrackingParser.fetchJson(Utilities.pathURL(url, "package.manifest.json"));
|
||||
String currDate = JSONUtil.str(json, "date");
|
||||
String packDate = p.date();
|
||||
if (!currDate.equals(packDate))
|
||||
if (!currDate.equals(packDate)) {
|
||||
return null; // nup, we need a new copy
|
||||
return p;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return p;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private boolean checkBuildLoaded() {
|
||||
|
|
|
@ -769,7 +769,7 @@ public class NpmPackage {
|
|||
}
|
||||
|
||||
public boolean isType(PackageType template) {
|
||||
return template.getCode().equals(type());
|
||||
return template.getCode().equals(type()) || template.getOldCode().equals(type()) ;
|
||||
}
|
||||
|
||||
public String type() {
|
||||
|
|
|
@ -52,15 +52,31 @@ import com.google.gson.JsonSyntaxException;
|
|||
public class PackageGenerator {
|
||||
|
||||
public enum PackageType {
|
||||
CORE, IG, TOOL, TEMPLATE, SUBSET;
|
||||
CONFORMANCE, IG, CORE, EXAMPLES, GROUP, TOOL, IG_TEMPLATE;
|
||||
// CORE, IG, TOOL, TEMPLATE, SUBSET;
|
||||
|
||||
public String getCode() {
|
||||
switch (this) {
|
||||
case CORE: return "fhir.core";
|
||||
case CONFORMANCE: return "Conformance";
|
||||
case IG: return "IG";
|
||||
case CORE: return "Core";
|
||||
case EXAMPLES: return "Examples";
|
||||
case GROUP: return "Group";
|
||||
case TOOL: return "Tool";
|
||||
case IG_TEMPLATE: return "IG-Template";
|
||||
}
|
||||
throw new Error("Unknown Type");
|
||||
}
|
||||
|
||||
String getOldCode() {
|
||||
switch (this) {
|
||||
case CONFORMANCE: return "xxx";
|
||||
case IG: return "fhir.ig";
|
||||
case CORE: return "fhir.core";
|
||||
case EXAMPLES: return "fhir.examples";
|
||||
case GROUP: return "fhir.group";
|
||||
case TOOL: return "fhir.tool";
|
||||
case TEMPLATE: return "fhir.template";
|
||||
case SUBSET: return "fhir.subset";
|
||||
case IG_TEMPLATE: return "fhir.template";
|
||||
}
|
||||
throw new Error("Unknown Type");
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.hl7.fhir.utilities.tests;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.utilities.CSFile;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.ToolGlobalSettings;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
import java.io.*;
|
||||
|
@ -22,7 +23,11 @@ public class BaseTestingUtilities {
|
|||
* the name of the project directory to something other than 'fhir-test-cases', or move it to another location, not
|
||||
* at the same directory level as the core project.
|
||||
*/
|
||||
|
||||
String dir = System.getenv("FHIR-TEST-CASES");
|
||||
if (dir == null && ToolGlobalSettings.hasTestsPath()) {
|
||||
dir = ToolGlobalSettings.getTestsPath();
|
||||
}
|
||||
if (dir != null && new CSFile(dir).exists()) {
|
||||
String n = Utilities.path(dir, Utilities.path(paths));
|
||||
// ok, we'll resolve this locally
|
||||
|
@ -44,6 +49,9 @@ public class BaseTestingUtilities {
|
|||
|
||||
public static InputStream loadTestResourceStream(String... paths) throws IOException {
|
||||
String dir = System.getenv("FHIR-TEST-CASES");
|
||||
if (dir == null && ToolGlobalSettings.hasTestsPath()) {
|
||||
dir = ToolGlobalSettings.getTestsPath();
|
||||
}
|
||||
if (dir != null && new File(dir).exists()) {
|
||||
String n = Utilities.path(dir, Utilities.path(paths));
|
||||
return new FileInputStream(n);
|
||||
|
@ -59,6 +67,9 @@ public class BaseTestingUtilities {
|
|||
|
||||
public static byte[] loadTestResourceBytes(String... paths) throws IOException {
|
||||
String dir = System.getenv("FHIR-TEST-CASES");
|
||||
if (dir == null && ToolGlobalSettings.hasTestsPath()) {
|
||||
dir = ToolGlobalSettings.getTestsPath();
|
||||
}
|
||||
if (dir != null && new File(dir).exists()) {
|
||||
String n = Utilities.path(dir, Utilities.path(paths));
|
||||
return TextFile.fileToBytes(n);
|
||||
|
@ -74,6 +85,9 @@ public class BaseTestingUtilities {
|
|||
|
||||
public static boolean findTestResource(String... paths) throws IOException {
|
||||
String dir = System.getenv("FHIR-TEST-CASES");
|
||||
if (dir == null && ToolGlobalSettings.hasTestsPath()) {
|
||||
dir = ToolGlobalSettings.getTestsPath();
|
||||
}
|
||||
if (dir != null && new File(dir).exists()) {
|
||||
String n = Utilities.path(dir, Utilities.path(paths));
|
||||
return new File(n).exists();
|
||||
|
|
|
@ -1591,3 +1591,11 @@ v: {
|
|||
"error" : "Unable to find code 10821000202101 in http://snomed.info/sct (version http://snomed.info/sct/900000000000207008/version/20210731); The code \"10821000202101\" is not valid in the system http://snomed.info/sct; The code provided (http://snomed.info/sct#10821000202101) is not valid in the value set 'no-colonoscopy-sedation-level' (from http://tx.fhir.org/r4)"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
{"code" : {
|
||||
"code" : "pdf"
|
||||
}, "url": "http://hl7.org/fhir/ValueSet/mimetypes", "version": "4.0.1", "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"true", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}####
|
||||
v: {
|
||||
"severity" : "error",
|
||||
"error" : "The code \"pdf\" is not valid in the system urn:ietf:bcp:13; The code provided (urn:ietf:bcp:13#pdf) is not valid in the value set 'Mime Types' (from http://tx.fhir.org/r4)"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.4.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.88</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.89-SNAPSHOT</validator_test_case_version>
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||
|
|
Loading…
Reference in New Issue