Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
0e36d2a3c6
|
@ -307,3 +307,5 @@ local.properties
|
|||
/org.hl7.fhir.r4b.new
|
||||
|
||||
org.hl7.fhir.r5/var/lib/.fhir/packages/
|
||||
|
||||
org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/DebugUtilities.java
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -318,8 +318,10 @@ public class ImplementationGuide40_50 {
|
|||
tgt.setDescriptionElement(String40_50.convertStringToMarkdown(src.getDescriptionElement()));
|
||||
if (src.hasExampleBooleanType())
|
||||
tgt.setIsExampleElement(Boolean40_50.convertBoolean(src.getExampleBooleanType()));
|
||||
if (src.hasExampleCanonicalType())
|
||||
if (src.hasExampleCanonicalType()) {
|
||||
tgt.setIsExample(true);
|
||||
tgt.getProfile().add(Canonical40_50.convertCanonical(src.getExampleCanonicalType()));
|
||||
}
|
||||
if (src.hasGroupingId())
|
||||
tgt.setGroupingIdElement(Id40_50.convertId(src.getGroupingIdElement()));
|
||||
return tgt;
|
||||
|
|
|
@ -300,7 +300,6 @@ public class NpmPackageVersionConverter {
|
|||
}
|
||||
throw new Error("Unknown version " + currentVersion + " -> " + version);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
errors.add("Error converting " + n + ": " + ex.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
@ -336,6 +335,7 @@ public class NpmPackageVersionConverter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void convertResourceR5(Resource res) {
|
||||
if (res instanceof ImplementationGuide) {
|
||||
ImplementationGuide ig = (ImplementationGuide) res;
|
||||
|
|
|
@ -0,0 +1,308 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||
import org.hl7.fhir.utilities.IniFile;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
|
||||
public class OIDAssigner {
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new OIDAssigner().execute(args[0], args[1], args[2]);
|
||||
}
|
||||
|
||||
private void execute(String oidSource, String folder, String version) {
|
||||
IniFile oids = new IniFile(oidSource);
|
||||
File f = new File(folder);
|
||||
process(oids, f, version);
|
||||
}
|
||||
|
||||
private void process(IniFile oids, File folder, String version) {
|
||||
for (File f : folder.listFiles()) {
|
||||
if (f.isDirectory()) {
|
||||
process(oids, f, version);
|
||||
} else if (f.getName().endsWith(".xml")) {
|
||||
processFile(oids, f, version, FhirFormat.XML);
|
||||
} else if (f.getName().endsWith(".json")) {
|
||||
processFile(oids, f, version, FhirFormat.JSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processFile(IniFile oids, File f, String version, FhirFormat fmt) {
|
||||
switch (VersionUtilities.getMajMin(version)) {
|
||||
case "1.0" : processFileR2(oids, f, fmt);
|
||||
case "3.0" : processFileR3(oids, f, fmt);
|
||||
case "4.0" : processFileR4(oids, f, fmt);
|
||||
case "4.3" : processFileR4B(oids, f, fmt);
|
||||
case "5.0" : processFileR5(oids, f, fmt);
|
||||
}
|
||||
}
|
||||
|
||||
private void processFileR2(IniFile oids, File f, FhirFormat fmt) {
|
||||
org.hl7.fhir.dstu2.formats.IParser parser = fmt == FhirFormat.JSON ? new org.hl7.fhir.dstu2.formats.JsonParser() : new org.hl7.fhir.dstu2.formats.XmlParser();
|
||||
try {
|
||||
boolean save = false;
|
||||
org.hl7.fhir.dstu2.model.Resource r = parser.parse(new FileInputStream(f));
|
||||
if (r instanceof org.hl7.fhir.dstu2.model.ValueSet) {
|
||||
org.hl7.fhir.dstu2.model.ValueSet vs = (org.hl7.fhir.dstu2.model.ValueSet) r;
|
||||
boolean hasOid = isOid(vs.getIdentifier());
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "ValueSet", vs.getUrl());
|
||||
vs.setIdentifier(new org.hl7.fhir.dstu2.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.dstu2.model.ConceptMap) {
|
||||
org.hl7.fhir.dstu2.model.ConceptMap cm = (org.hl7.fhir.dstu2.model.ConceptMap) r;
|
||||
boolean hasOid = isOid(cm.getIdentifier());
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "ConceptMap", cm.getUrl());
|
||||
cm.setIdentifier(new org.hl7.fhir.dstu2.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.dstu2.model.StructureDefinition) {
|
||||
org.hl7.fhir.dstu2.model.StructureDefinition sd = (org.hl7.fhir.dstu2.model.StructureDefinition) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.dstu2.model.Identifier id : sd.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "StructureDefinition", sd.getUrl());
|
||||
sd.getIdentifier().add(new org.hl7.fhir.dstu2.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
parser.setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(new FileOutputStream(f), r);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Erro processing "+f.getAbsolutePath()+": "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void processFileR3(IniFile oids, File f, FhirFormat fmt) {
|
||||
org.hl7.fhir.dstu3.formats.IParser parser = fmt == FhirFormat.JSON ? new org.hl7.fhir.dstu3.formats.JsonParser() : new org.hl7.fhir.dstu3.formats.XmlParser();
|
||||
try {
|
||||
boolean save = false;
|
||||
org.hl7.fhir.dstu3.model.Resource r = parser.parse(new FileInputStream(f));
|
||||
if (r instanceof org.hl7.fhir.dstu3.model.CodeSystem) {
|
||||
org.hl7.fhir.dstu3.model.CodeSystem cs = (org.hl7.fhir.dstu3.model.CodeSystem) r;
|
||||
boolean hasOid = isOid(cs.getIdentifier());
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "CodeSystem", cs.getUrl());
|
||||
cs.setIdentifier(new org.hl7.fhir.dstu3.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.dstu3.model.ValueSet) {
|
||||
org.hl7.fhir.dstu3.model.ValueSet vs = (org.hl7.fhir.dstu3.model.ValueSet) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.dstu3.model.Identifier id : vs.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "ValueSet", vs.getUrl());
|
||||
vs.getIdentifier().add(new org.hl7.fhir.dstu3.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.dstu3.model.ConceptMap) {
|
||||
org.hl7.fhir.dstu3.model.ConceptMap cm = (org.hl7.fhir.dstu3.model.ConceptMap) r;
|
||||
boolean hasOid = isOid(cm.getIdentifier());
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "ConceptMap", cm.getUrl());
|
||||
cm.setIdentifier(new org.hl7.fhir.dstu3.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.dstu3.model.StructureDefinition) {
|
||||
org.hl7.fhir.dstu3.model.StructureDefinition sd = (org.hl7.fhir.dstu3.model.StructureDefinition) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.dstu3.model.Identifier id : sd.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "StructureDefinition", sd.getUrl());
|
||||
sd.getIdentifier().add(new org.hl7.fhir.dstu3.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
parser.setOutputStyle(org.hl7.fhir.dstu3.formats.IParser.OutputStyle.PRETTY).compose(new FileOutputStream(f), r);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Erro processing "+f.getAbsolutePath()+": "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void processFileR4(IniFile oids, File f, FhirFormat fmt) {
|
||||
org.hl7.fhir.r4.formats.IParser parser = fmt == FhirFormat.JSON ? new org.hl7.fhir.r4.formats.JsonParser() : new org.hl7.fhir.r4.formats.XmlParser();
|
||||
try {
|
||||
boolean save = false;
|
||||
org.hl7.fhir.r4.model.Resource r = parser.parse(new FileInputStream(f));
|
||||
if (r instanceof org.hl7.fhir.r4.model.CodeSystem) {
|
||||
org.hl7.fhir.r4.model.CodeSystem cs = (org.hl7.fhir.r4.model.CodeSystem) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.r4.model.Identifier id : cs.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "CodeSystem", cs.getUrl());
|
||||
cs.getIdentifier().add(new org.hl7.fhir.r4.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.r4.model.ValueSet) {
|
||||
org.hl7.fhir.r4.model.ValueSet vs = (org.hl7.fhir.r4.model.ValueSet) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.r4.model.Identifier id : vs.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "ValueSet", vs.getUrl());
|
||||
vs.getIdentifier().add(new org.hl7.fhir.r4.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.r4.model.ConceptMap) {
|
||||
org.hl7.fhir.r4.model.ConceptMap cm = (org.hl7.fhir.r4.model.ConceptMap) r;
|
||||
boolean hasOid = isOid(cm.getIdentifier());
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "ConceptMap", cm.getUrl());
|
||||
cm.setIdentifier(new org.hl7.fhir.r4.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (r instanceof org.hl7.fhir.r4.model.StructureDefinition) {
|
||||
org.hl7.fhir.r4.model.StructureDefinition sd = (org.hl7.fhir.r4.model.StructureDefinition) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.r4.model.Identifier id : sd.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, "StructureDefinition", sd.getUrl());
|
||||
sd.getIdentifier().add(new org.hl7.fhir.r4.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
parser.setOutputStyle(org.hl7.fhir.r4.formats.IParser.OutputStyle.PRETTY).compose(new FileOutputStream(f), r);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Erro processing "+f.getAbsolutePath()+": "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void processFileR4B(IniFile oids, File f, FhirFormat fmt) {
|
||||
org.hl7.fhir.r4b.formats.IParser parser = fmt == FhirFormat.JSON ? new org.hl7.fhir.r4b.formats.JsonParser() : new org.hl7.fhir.r4b.formats.XmlParser();
|
||||
try {
|
||||
boolean save = false;
|
||||
org.hl7.fhir.r4b.model.Resource r = parser.parse(new FileInputStream(f));
|
||||
if (r instanceof org.hl7.fhir.r4b.model.CanonicalResource) {
|
||||
org.hl7.fhir.r4b.model.CanonicalResource cs = (org.hl7.fhir.r4b.model.CanonicalResource) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.r4b.model.Identifier id : cs.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, r.fhirType(), cs.getUrl());
|
||||
cs.getIdentifier().add(new org.hl7.fhir.r4b.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
parser.setOutputStyle(org.hl7.fhir.r4b.formats.IParser.OutputStyle.PRETTY).compose(new FileOutputStream(f), r);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Erro processing "+f.getAbsolutePath()+": "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void processFileR5(IniFile oids, File f, FhirFormat fmt) {
|
||||
org.hl7.fhir.r5.formats.IParser parser = fmt == FhirFormat.JSON ? new org.hl7.fhir.r5.formats.JsonParser() : new org.hl7.fhir.r5.formats.XmlParser();
|
||||
try {
|
||||
boolean save = false;
|
||||
org.hl7.fhir.r5.model.Resource r = parser.parse(new FileInputStream(f));
|
||||
if (r instanceof org.hl7.fhir.r5.model.CanonicalResource) {
|
||||
org.hl7.fhir.r5.model.CanonicalResource cs = (org.hl7.fhir.r5.model.CanonicalResource) r;
|
||||
boolean hasOid = false;
|
||||
for (org.hl7.fhir.r5.model.Identifier id : cs.getIdentifier()) {
|
||||
if (isOid(id)) {
|
||||
hasOid = true;
|
||||
}
|
||||
}
|
||||
if (!hasOid) {
|
||||
String oid = getOid(oids, r.fhirType(), cs.getUrl());
|
||||
cs.getIdentifier().add(new org.hl7.fhir.r5.model.Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:"+oid));
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
parser.setOutputStyle(org.hl7.fhir.r5.formats.IParser.OutputStyle.PRETTY).compose(new FileOutputStream(f), r);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Erro processing "+f.getAbsolutePath()+": "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOid(org.hl7.fhir.dstu2.model.Identifier id) {
|
||||
return "urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:");
|
||||
}
|
||||
|
||||
private boolean isOid(org.hl7.fhir.dstu3.model.Identifier id) {
|
||||
return "urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:");
|
||||
}
|
||||
|
||||
private boolean isOid(org.hl7.fhir.r4.model.Identifier id) {
|
||||
return "urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:");
|
||||
}
|
||||
|
||||
private boolean isOid(org.hl7.fhir.r4b.model.Identifier id) {
|
||||
return "urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:");
|
||||
}
|
||||
|
||||
private boolean isOid(org.hl7.fhir.r5.model.Identifier id) {
|
||||
return "urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:");
|
||||
}
|
||||
|
||||
private String getOid(IniFile oids, String rt, String url) {
|
||||
String root = oids.getStringProperty("Roots", rt);
|
||||
if (root == null) {
|
||||
throw new Error("no OID.ini entry for "+rt);
|
||||
}
|
||||
String oid = oids.getStringProperty(rt, url);
|
||||
if (oid != null) {
|
||||
return oid;
|
||||
}
|
||||
int key = oids.getIntegerProperty("Key", rt);
|
||||
key++;
|
||||
oid = root+"."+key;
|
||||
oids.setIntegerProperty("Key", rt, key, null);
|
||||
oids.setStringProperty(rt, url, oid, null);
|
||||
oids.save();
|
||||
return oid;
|
||||
}
|
||||
}
|
|
@ -118,6 +118,13 @@ public class TerminologyClientR2 implements ITerminologyClient {
|
|||
return (Parameters) VersionConvertorFactory_10_50.convertResource(p2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parameters subsumes(Parameters pin) throws FHIRException {
|
||||
org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertorFactory_10_50.convertResource(pin);
|
||||
p2 = client.operateType(org.hl7.fhir.dstu2.model.ValueSet.class, "subsumes", p2);
|
||||
return (Parameters) VersionConvertorFactory_10_50.convertResource(p2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parameters validateVS(Parameters pin) throws FHIRException {
|
||||
org.hl7.fhir.dstu2.model.Parameters p2 = (org.hl7.fhir.dstu2.model.Parameters) VersionConvertorFactory_10_50.convertResource(pin);
|
||||
|
@ -238,4 +245,5 @@ public class TerminologyClientR2 implements ITerminologyClient {
|
|||
org.hl7.fhir.dstu2.model.Bundle result = client.search(type, criteria);
|
||||
return result == null ? null : (Bundle) VersionConvertorFactory_10_50.convertResource(result);
|
||||
}
|
||||
|
||||
}
|
|
@ -242,4 +242,11 @@ public class TerminologyClientR3 implements ITerminologyClient {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parameters subsumes(Parameters pin) throws FHIRException {
|
||||
org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertorFactory_30_50.convertResource(pin);
|
||||
p2 = client.operateType(org.hl7.fhir.dstu3.model.CodeSystem.class, "subsumes", p2);
|
||||
return (Parameters) VersionConvertorFactory_30_50.convertResource(p2);
|
||||
}
|
||||
|
||||
}
|
|
@ -111,6 +111,25 @@ public class TerminologyClientR4 implements ITerminologyClient {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Parameters subsumes(Parameters pin) throws FHIRException {
|
||||
try {
|
||||
org.hl7.fhir.r4.model.Parameters p2 = (org.hl7.fhir.r4.model.Parameters) VersionConvertorFactory_40_50.convertResource(pin);
|
||||
p2 = client.operateType(org.hl7.fhir.r4.model.CodeSystem.class, "subsumes", p2);
|
||||
return (Parameters) VersionConvertorFactory_40_50.convertResource(p2);
|
||||
} catch (EFhirClientException e) {
|
||||
if (e.getServerErrors().size() == 1) {
|
||||
OperationOutcome op = (OperationOutcome) VersionConvertorFactory_40_50.convertResource(e.getServerErrors().get(0));
|
||||
throw new org.hl7.fhir.r5.utils.client.EFhirClientException(e.getMessage(), op, e);
|
||||
} else {
|
||||
throw new org.hl7.fhir.r5.utils.client.EFhirClientException(e.getMessage(), e);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new FHIRException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parameters validateVS(Parameters pin) throws FHIRException {
|
||||
try {
|
||||
|
@ -250,5 +269,4 @@ public class TerminologyClientR4 implements ITerminologyClient {
|
|||
return result == null ? null : (Bundle) VersionConvertorFactory_40_50.convertResource(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -66,14 +66,14 @@ class Convertor_Factory_40_50Test {
|
|||
StructureMapUtilities smu5 = new StructureMapUtilities(context, mock(org.hl7.fhir.r5.utils.structuremap.ITransformerServices.class));
|
||||
org.hl7.fhir.r5.model.StructureMap mapR5 = smu5.parse(CONTENT, "map");
|
||||
|
||||
assertEquals("tgt", mapR5.getGroup().get(0).getRule().get(0).getTarget().get(0).getParameter().get(0).getValueIdType().getValue());
|
||||
assertEquals("tgt", mapR5.getGroup().get(0).getRule().get(0).getTarget().get(0).getContext());
|
||||
assertEquals("item.answer.valueString", mapR5.getGroup().get(1).getRule().get(0).getTarget().get(0).getParameter().get(0).getValueStringType().getValue());
|
||||
assertEquals("item", mapR5.getGroup().get(0).getRule().get(0).getDependent().get(0).getParameter().get(0).getValueIdType().getValueAsString());
|
||||
assertEquals("patient", mapR5.getGroup().get(0).getRule().get(0).getDependent().get(0).getParameter().get(1).getValueIdType().getValueAsString());
|
||||
|
||||
|
||||
org.hl7.fhir.r4.model.StructureMap mapR4 = (org.hl7.fhir.r4.model.StructureMap) VersionConvertorFactory_40_50.convertResource(mapR5);
|
||||
assertEquals("tgt", mapR4.getGroup().get(0).getRule().get(0).getTarget().get(0).getParameter().get(0).getValueIdType().getValue());
|
||||
assertEquals("tgt", mapR4.getGroup().get(0).getRule().get(0).getTarget().get(0).getContext());
|
||||
assertEquals("item.answer.valueString", mapR4.getGroup().get(1).getRule().get(0).getTarget().get(0).getParameter().get(0).getValueStringType().getValue());
|
||||
assertEquals("item", mapR4.getGroup().get(0).getRule().get(0).getDependent().get(0).getVariable().get(0).getValueAsString());
|
||||
assertEquals("patient", mapR4.getGroup().get(0).getRule().get(0).getDependent().get(0).getVariable().get(1).getValueAsString());
|
||||
|
@ -87,7 +87,7 @@ class Convertor_Factory_40_50Test {
|
|||
|
||||
|
||||
StructureMap mapR5Back = (StructureMap) VersionConvertorFactory_40_50.convertResource(mapR4);
|
||||
assertEquals("tgt", mapR5Back.getGroup().get(0).getRule().get(0).getTarget().get(0).getParameter().get(0).getValueIdType().getValue());
|
||||
assertEquals("tgt", mapR5Back.getGroup().get(0).getRule().get(0).getTarget().get(0).getContext());
|
||||
assertEquals("item.answer.valueString", mapR5Back.getGroup().get(1).getRule().get(0).getTarget().get(0).getParameter().get(0).getValueStringType().getValue());
|
||||
assertEquals("item", mapR5Back.getGroup().get(0).getRule().get(0).getDependent().get(0).getParameter().get(0).getValueIdType().getValueAsString());
|
||||
assertEquals("patient", mapR5Back.getGroup().get(0).getRule().get(0).getDependent().get(0).getParameter().get(1).getValueIdType().getValueAsString());
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
|||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -1281,7 +1282,7 @@ public class ProfileUtilities {
|
|||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder,
|
||||
boolean inlineGraphics, boolean full, String corePath, Set<String> outputTracker)
|
||||
throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML);
|
||||
|
||||
boolean deep = false;
|
||||
|
@ -1566,7 +1567,7 @@ public class ProfileUtilities {
|
|||
boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, Set<String> outputTracker)
|
||||
throws IOException, FHIRException {
|
||||
assert (diff != snapshot);// check it's ok to get rid of one of these
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), false,
|
||||
TableGenerationMode.XML);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ResourceAddress {
|
|||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
|||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -1283,7 +1284,7 @@ public class ProfileUtilities {
|
|||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder,
|
||||
boolean inlineGraphics, boolean full, String corePath, Set<String> outputTracker)
|
||||
throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML);
|
||||
|
||||
boolean deep = false;
|
||||
|
@ -1565,7 +1566,7 @@ public class ProfileUtilities {
|
|||
boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, boolean logicalModel,
|
||||
Set<String> outputTracker) throws IOException, FHIRException {
|
||||
assert (diff != snapshot);// check it's ok to get rid of one of these
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), false,
|
||||
TableGenerationMode.XML);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ResourceAddress {
|
|||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
|
@ -1620,8 +1621,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML);
|
||||
|
||||
boolean deep = false;
|
||||
|
@ -1989,8 +1989,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
|
||||
public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
assert(diff != snapshot);// check it's ok to get rid of one of these
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s"), false, TableGenerationMode.XML);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
|
@ -2005,8 +2004,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
|
||||
|
||||
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initGridTable(corePath, profile.getId());
|
||||
List<ElementDefinition> list = profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
|
@ -3482,8 +3480,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, false);
|
||||
TableModel model = initSpanningTable(gen, "", false, profile.getId());
|
||||
Set<String> processed = new HashSet<String>();
|
||||
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
|
||||
|
|
|
@ -85,13 +85,13 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue())
|
||||
if (t.getSeverity() == IssueSeverity.ERROR)
|
||||
b.append("Error:" +gen(t.getDetails())+"\r\n");
|
||||
b.append("Error: " +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.FATAL)
|
||||
b.append("Fatal:" +gen(t.getDetails())+"\r\n");
|
||||
b.append("Fatal: " +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.WARNING)
|
||||
b.append("Warning:" +gen(t.getDetails())+"\r\n");
|
||||
b.append("Warning: " +gen(t.getDetails())+"\r\n");
|
||||
else if (t.getSeverity() == IssueSeverity.INFORMATION)
|
||||
b.append("Information:" +gen(t.getDetails())+"\r\n");
|
||||
b.append("Information: " +gen(t.getDetails())+"\r\n");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ResourceAddress {
|
|||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"/"+opName);
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+opName);
|
||||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName, Map<String,String> parameters) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ import org.hl7.fhir.utilities.FhirPublication;
|
|||
import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
|
@ -2386,8 +2387,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder,
|
||||
boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker)
|
||||
throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML);
|
||||
|
||||
boolean deep = false;
|
||||
|
@ -2792,8 +2792,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath,
|
||||
boolean logicalModel, boolean allInvariants, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
assert (diff != snapshot);// check it's ok to get rid of one of these
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), false,
|
||||
TableGenerationMode.XML);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
|
@ -2817,8 +2816,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics,
|
||||
String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker)
|
||||
throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true);
|
||||
TableModel model = gen.initGridTable(corePath, profile.getId());
|
||||
List<ElementDefinition> list = profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
|
@ -4969,8 +4967,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
|
||||
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints,
|
||||
String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, false, true);
|
||||
TableModel model = initSpanningTable(gen, "", false, profile.getId());
|
||||
Set<String> processed = new HashSet<String>();
|
||||
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
|
||||
|
|
|
@ -81,13 +81,13 @@ public class ResourceUtilities {
|
|||
if (first) first = false; else b.append("\r\n");
|
||||
String txt = t.hasDiagnostics() ? t.getDiagnostics() : gen(t.getDetails());
|
||||
if (t.getSeverity() == IssueSeverity.ERROR)
|
||||
b.append("Error:" + txt);
|
||||
b.append("Error: " + txt);
|
||||
else if (t.getSeverity() == IssueSeverity.FATAL)
|
||||
b.append("Fatal:" + txt);
|
||||
b.append("Fatal: " + txt);
|
||||
else if (t.getSeverity() == IssueSeverity.WARNING)
|
||||
b.append("Warning:" + txt);
|
||||
b.append("Warning: " + txt);
|
||||
else if (t.getSeverity() == IssueSeverity.INFORMATION)
|
||||
b.append("Information:" + txt);
|
||||
b.append("Information: " + txt);
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ResourceAddress {
|
|||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||
}
|
||||
|
||||
public <T extends Resource> URI resolveGetResource(Class<T> resourceClass, String id) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hl7.fhir.r4b.model.Coding;
|
|||
import org.hl7.fhir.r4b.model.PrimitiveType;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -291,7 +292,7 @@ public abstract class CanonicalResourceComparer extends ResourceComparer {
|
|||
public XhtmlNode renderMetadata(CanonicalResourceComparison<? extends CanonicalResource> comparison, String id,
|
||||
String prefix) throws FHIRException, IOException {
|
||||
// columns: code, display (left|right), properties (left|right)
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Name", "Property Name", null, 100));
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.hl7.fhir.r4b.model.PrimitiveType;
|
|||
import org.hl7.fhir.r4b.model.Resource;
|
||||
import org.hl7.fhir.r4b.model.StructureDefinition;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -867,7 +868,7 @@ public class CapabilityStatementComparer extends CanonicalResourceComparer {
|
|||
// comments
|
||||
public XhtmlNode renderStatements(CapabilityStatementComparison comparison, String id, String prefix)
|
||||
throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Type", "The type of item", null, 100));
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent;
|
|||
import org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent;
|
||||
import org.hl7.fhir.r4b.model.CodeSystem.PropertyComponent;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -348,7 +349,7 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
|
|||
public XhtmlNode renderConcepts(CodeSystemComparison comparison, String id, String prefix)
|
||||
throws FHIRException, IOException {
|
||||
// columns: code, display (left|right), properties (left|right)
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Code", "The code for the concept", null, 100));
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.hl7.fhir.r4b.model.ValueSet;
|
|||
import org.hl7.fhir.r4b.utils.DefinitionNavigator;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
|
@ -1027,8 +1028,7 @@ public class ProfileComparer extends CanonicalResourceComparer {
|
|||
|
||||
public XhtmlNode renderStructure(ProfileComparison comp, String id, String prefix, String corePath)
|
||||
throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false, true);
|
||||
gen.setTranslator(session.getContextRight().translator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false, true);
|
||||
TableModel model = gen.initComparisonTable(corePath, id);
|
||||
genElementComp(null /* oome back to this later */, gen, model.getRows(), comp.combined, corePath, prefix, null,
|
||||
true);
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hl7.fhir.r4b.model.ValueSet.ValueSetComposeComponent;
|
|||
import org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -577,7 +578,7 @@ public class ValueSetComparer extends CanonicalResourceComparer {
|
|||
}
|
||||
|
||||
public XhtmlNode renderCompose(ValueSetComparison csc, String id, String prefix) throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Item", "The type of item being compared", null, 100));
|
||||
|
@ -778,7 +779,7 @@ public class ValueSetComparer extends CanonicalResourceComparer {
|
|||
boolean hasAbstract = findAbstract(csc.getExpansion());
|
||||
boolean hasInactive = findInactive(csc.getExpansion());
|
||||
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
if (hasSystem) {
|
||||
|
|
|
@ -121,6 +121,7 @@ import org.hl7.fhir.utilities.MarkDownProcessor;
|
|||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -3874,8 +3875,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder,
|
||||
boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker,
|
||||
RenderingContext rc) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, ed.getId() + (full ? "f" : "n"), true,
|
||||
TableGenerationMode.XHTML);
|
||||
|
||||
|
@ -4443,8 +4443,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean active, boolean mustSupport,
|
||||
RenderingContext rc) throws IOException, FHIRException {
|
||||
assert (diff != snapshot);// check it's ok to get rid of one of these
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), active,
|
||||
active ? TableGenerationMode.XHTML : TableGenerationMode.XML);
|
||||
List<ElementDefinition> list = new ArrayList<>();
|
||||
|
@ -4545,8 +4544,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics,
|
||||
String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker)
|
||||
throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true);
|
||||
TableModel model = gen.initGridTable(corePath, profile.getId());
|
||||
List<ElementDefinition> list = profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
|
@ -7116,8 +7114,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
|
||||
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints,
|
||||
String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, false, true);
|
||||
TableModel model = initSpanningTable(gen, "", false, profile.getId());
|
||||
Set<String> processed = new HashSet<String>();
|
||||
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.hl7.fhir.r4b.renderers.utils.RenderingContext;
|
|||
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell;
|
||||
|
@ -74,7 +75,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
if (doOpts) {
|
||||
x.b().tx("Structure");
|
||||
}
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(),
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(),
|
||||
true);
|
||||
TableModel model = gen.new TableModel("qtree=" + q.getId(), !forResource);
|
||||
model.setAlternating(true);
|
||||
|
@ -511,7 +512,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
|
||||
private boolean renderLogic(XhtmlNode x, Questionnaire q) throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(),
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(),
|
||||
true);
|
||||
TableModel model = gen.new TableModel("qtree=" + q.getId(), true);
|
||||
model.setAlternating(true);
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.hl7.fhir.r4b.renderers.utils.RenderingContext;
|
|||
import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell;
|
||||
|
@ -79,7 +80,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public boolean renderTree(XhtmlNode x, ResourceWrapper qr) throws UnsupportedEncodingException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(),
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(),
|
||||
true);
|
||||
TableModel model = gen.new TableModel("qtree=" + qr.getId(), false);
|
||||
model.setAlternating(true);
|
||||
|
@ -107,7 +108,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public boolean renderTree(XhtmlNode x, QuestionnaireResponse q) throws UnsupportedEncodingException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(),
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(),
|
||||
true);
|
||||
TableModel model = gen.new TableModel("qtree=" + q.getId(), true);
|
||||
model.setAlternating(true);
|
||||
|
|
|
@ -79,13 +79,13 @@ public class ResourceUtilities {
|
|||
StringBuilder b = new StringBuilder();
|
||||
for (OperationOutcomeIssueComponent t : error.getIssue()) {
|
||||
if (t.getSeverity() == IssueSeverity.ERROR) {
|
||||
b.append("Error:" + gen(t.getDetails()) + "\r\n");
|
||||
b.append("Error: " + gen(t.getDetails()) + "\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.FATAL) {
|
||||
b.append("Fatal:" + gen(t.getDetails()) + "\r\n");
|
||||
b.append("Fatal: " + gen(t.getDetails()) + "\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.WARNING) {
|
||||
b.append("Warning:" + gen(t.getDetails()) + "\r\n");
|
||||
b.append("Warning: " + gen(t.getDetails()) + "\r\n");
|
||||
} else if (t.getSeverity() == IssueSeverity.INFORMATION) {
|
||||
b.append("Information:" + gen(t.getDetails()) + "\r\n");
|
||||
b.append("Information: " + gen(t.getDetails()) + "\r\n");
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ResourceAddress {
|
|||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "/" + opName);
|
||||
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) + "$" + opName);
|
||||
}
|
||||
|
||||
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName,
|
||||
|
|
|
@ -63,7 +63,7 @@ public class StructureMapUtilitiesTest implements ITransformerServices {
|
|||
@Test
|
||||
public void testSyntax() throws IOException, FHIRException {
|
||||
StructureMapUtilities scu = new StructureMapUtilities(context, this);
|
||||
String fileMap = TestingUtilities.loadTestResource("r5", "structure-mapping", "syntax.map");
|
||||
String fileMap = TestingUtilities.loadTestResource("r4b", "structure-mapping", "syntax.map");
|
||||
System.out.println(fileMap);
|
||||
|
||||
StructureMap structureMap = scu.parse(fileMap, "Syntax");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>6.2.14-SNAPSHOT</version>
|
||||
<version>6.3.4-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hl7.fhir.r5.model.DataType;
|
|||
import org.hl7.fhir.r5.model.PrimitiveType;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -591,7 +592,7 @@ public abstract class CanonicalResourceComparer extends ResourceComparer {
|
|||
|
||||
public XhtmlNode renderMetadata(CanonicalResourceComparison<? extends CanonicalResource> comparison, String id, String prefix) throws FHIRException, IOException {
|
||||
// columns: code, display (left|right), properties (left|right)
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Name", "Property Name", null, 100));
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.hl7.fhir.r5.model.Resource;
|
|||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -742,7 +743,7 @@ public class CapabilityStatementComparer extends CanonicalResourceComparer {
|
|||
|
||||
// 6 columns: path | left value | left doco | right value | right doco | comments
|
||||
public XhtmlNode renderStatements(CapabilityStatementComparison comparison, String id, String prefix) throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Type", "The type of item", null, 100));
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent;
|
|||
import org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.PropertyComponent;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -519,7 +520,7 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
|
|||
|
||||
public XhtmlNode renderConcepts(CodeSystemComparison comparison, String id, String prefix) throws FHIRException, IOException {
|
||||
// columns: code, display (left|right), properties (left|right)
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Code", "The code for the concept", null, 100));
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
|||
import org.hl7.fhir.r5.utils.DefinitionNavigator;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
|
@ -1251,8 +1252,7 @@ public class StructureDefinitionComparer extends CanonicalResourceComparer imple
|
|||
}
|
||||
|
||||
public XhtmlNode renderStructure(ProfileComparison comp, String id, String prefix, String corePath) throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false, true);
|
||||
gen.setTranslator(session.getContextRight().translator());
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false, true);
|
||||
TableModel model = gen.initComparisonTable(corePath, id);
|
||||
genElementComp(null /* come back to this later */, gen, model.getRows(), comp.combined, corePath, prefix, null, true);
|
||||
return gen.generate(model, prefix, 0, null);
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
@ -588,7 +589,7 @@ public class ValueSetComparer extends CanonicalResourceComparer {
|
|||
}
|
||||
|
||||
public XhtmlNode renderCompose(ValueSetComparison csc, String id, String prefix) throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
model.getTitles().add(gen.new Title(null, null, "Item", "The type of item being compared", null, 100));
|
||||
|
@ -779,7 +780,7 @@ public class ValueSetComparer extends CanonicalResourceComparer {
|
|||
boolean hasAbstract = findAbstract(csc.getExpansion());
|
||||
boolean hasInactive = findInactive(csc.getExpansion());
|
||||
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false);
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
model.setAlternating(true);
|
||||
if (hasSystem) {
|
||||
|
|
|
@ -190,7 +190,10 @@ public class R5ExtensionsLoader {
|
|||
context.cacheResourceFromPackage(vs, vs.getSourcePackage());
|
||||
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
|
||||
for (CanonicalType t : inc.getValueSet()) {
|
||||
loadValueSet(t.asStringValue(), context, valueSets, codeSystems);
|
||||
ValueSet vsi = context.fetchResource(ValueSet.class, t.getValue());
|
||||
if (vsi == null) {
|
||||
loadValueSet(t.asStringValue(), context, valueSets, codeSystems);
|
||||
}
|
||||
}
|
||||
if (inc.hasSystem()) {
|
||||
if (!inc.hasVersion()) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent
|
|||
import org.hl7.fhir.r5.model.ElementDefinition.SlicingRules;
|
||||
import org.hl7.fhir.r5.model.OperationOutcome.IssueType;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -170,6 +171,7 @@ public class ProfilePathProcessor {
|
|||
ElementDefinition currentBase = cursors.base.getElement().get(cursors.baseCursor);
|
||||
String currentBasePath = profileUtilities.fixedPathSource(getContextPathSource(), currentBase.getPath(), getRedirector());
|
||||
debugProcessPathsIteration(cursors, currentBasePath);
|
||||
checkDiffAssignedAndCursor(cursors);
|
||||
List<ElementDefinition> diffMatches = profileUtilities.getDiffMatches(getDifferential(), currentBasePath, cursors.diffCursor, getDiffLimit(), getProfileName()); // get a list of matching elements in scope
|
||||
|
||||
// in the simple case, source is not sliced.
|
||||
|
@ -194,6 +196,25 @@ public class ProfilePathProcessor {
|
|||
return res;
|
||||
}
|
||||
|
||||
private void checkDiffAssignedAndCursor(ProfilePathProcessorState cursors) {
|
||||
// int i = 0;
|
||||
// List<ElementDefinition> list = getDifferential().getElement();
|
||||
// for (ElementDefinition ed : list) {
|
||||
// boolean assigned = ed.hasUserData("derived.pointer");
|
||||
// if (i < cursors.diffCursor) {
|
||||
// if (!assigned) {
|
||||
// throw new Error("what?");
|
||||
// }
|
||||
// } else if (i > cursors.diffCursor) {
|
||||
// if (assigned) {
|
||||
// throw new Error("what!?");
|
||||
// }
|
||||
// }
|
||||
// i++;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private void debugProcessPathsIteration(ProfilePathProcessorState cursors, String currentBasePath) {
|
||||
if (profileUtilities.isDebug()) {
|
||||
System.out.println(getDebugIndent() + " - " + currentBasePath + ": "+
|
||||
|
@ -621,7 +642,12 @@ public class ProfilePathProcessor {
|
|||
if (firstTypeStructureDefinition.getSnapshot().getElement().isEmpty()) {
|
||||
throw new FHIRException(profileUtilities.getContext().formatMessage(I18nConstants.SNAPSHOT_IS_EMPTY, firstTypeStructureDefinition.getVersionedUrl(), "Source for first element"));
|
||||
} else {
|
||||
src = firstTypeStructureDefinition.getSnapshot().getElement().get(0);
|
||||
src = firstTypeStructureDefinition.getSnapshot().getElement().get(0).copy();
|
||||
if (!src.getPath().contains(".") && firstTypeStructureDefinition.getKind() == StructureDefinitionKind.RESOURCE) {
|
||||
// we can't migrate the constraints in this case, because the sense of %resource changes when the root resource
|
||||
// is treated as an element. The validator will enforce the constraint
|
||||
src.getConstraint().clear(); //
|
||||
}
|
||||
}
|
||||
}
|
||||
template = src.copy().setPath(currentBase.getPath());
|
||||
|
@ -1063,7 +1089,7 @@ public class ProfilePathProcessor {
|
|||
}
|
||||
// throw new Error("Not done yet");
|
||||
// } else if (currentBase.getType().get(0).getCode().equals("BackboneElement") && diffMatches.size() > 0 && diffMatches.get(0).hasSliceName()) {
|
||||
} else if (currentBase.getType().get(0).getCode().equals("BackboneElement")) {
|
||||
} else if (!currentBase.getType().isEmpty() && currentBase.getType().get(0).getCode().equals("BackboneElement")) {
|
||||
// We need to copy children of the backbone element before we start messing around with slices
|
||||
int newBaseLimit = profileUtilities.findEndOfElement(cursors.base, cursors.baseCursor);
|
||||
for (int i = cursors.baseCursor + 1; i <= newBaseLimit; i++) {
|
||||
|
|
|
@ -99,7 +99,6 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
|||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.terminologies.utilities.ValidationResult;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.TranslatingUtilities;
|
||||
import org.hl7.fhir.r5.utils.XVerExtensionManager;
|
||||
import org.hl7.fhir.r5.utils.XVerExtensionManager.XVerExtensionStatus;
|
||||
import org.hl7.fhir.r5.utils.formats.CSVWriter;
|
||||
|
@ -136,7 +135,7 @@ import org.hl7.fhir.utilities.xml.SchematronWriter.Section;
|
|||
* @author Grahame
|
||||
*
|
||||
*/
|
||||
public class ProfileUtilities extends TranslatingUtilities {
|
||||
public class ProfileUtilities {
|
||||
|
||||
private static boolean suppressIgnorableExceptions;
|
||||
|
||||
|
@ -433,7 +432,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
private boolean wantFixDifferentialFirstElementType;
|
||||
private Set<String> masterSourceFileNames;
|
||||
private Set<String> localFileNames;
|
||||
private Map<ElementDefinition, SourcedChildDefinitions> childMapCache = new HashMap<>();
|
||||
private Map<String, SourcedChildDefinitions> childMapCache = new HashMap<>();
|
||||
private AllowUnknownProfile allowUnknownProfile = AllowUnknownProfile.ALL_TYPES;
|
||||
private MappingMergeModeOption mappingMergeMode = MappingMergeModeOption.APPEND;
|
||||
private boolean forPublication;
|
||||
|
@ -479,8 +478,9 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
public SourcedChildDefinitions getChildMap(StructureDefinition profile, ElementDefinition element) throws DefinitionException {
|
||||
if (childMapCache.containsKey(element)) {
|
||||
return childMapCache.get(element);
|
||||
String cacheKey = "cm."+profile.getVersionedUrl()+"#"+(element.hasId() ? element.getId() : element.getPath());
|
||||
if (childMapCache.containsKey(cacheKey)) {
|
||||
return childMapCache.get(cacheKey);
|
||||
}
|
||||
StructureDefinition src = profile;
|
||||
if (element.getContentReference() != null) {
|
||||
|
@ -524,7 +524,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
break;
|
||||
}
|
||||
SourcedChildDefinitions result = new SourcedChildDefinitions(src, res);
|
||||
childMapCache.put(element, result);
|
||||
childMapCache.put(cacheKey, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent
|
|||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||
import org.hl7.fhir.r5.model.IdType;
|
||||
import org.hl7.fhir.r5.model.Identifier;
|
||||
import org.hl7.fhir.r5.model.IntegerType;
|
||||
import org.hl7.fhir.r5.model.ImplementationGuide;
|
||||
import org.hl7.fhir.r5.model.Library;
|
||||
import org.hl7.fhir.r5.model.Measure;
|
||||
|
@ -101,9 +102,7 @@ import org.hl7.fhir.r5.model.StringType;
|
|||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||
import org.hl7.fhir.r5.model.StructureMap;
|
||||
import org.hl7.fhir.r5.model.TerminologyCapabilities;
|
||||
import org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent;
|
||||
import org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent;
|
||||
|
||||
import org.hl7.fhir.r5.model.UriType;
|
||||
import org.hl7.fhir.r5.model.UrlType;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
|
@ -129,8 +128,8 @@ import org.hl7.fhir.r5.terminologies.utilities.TerminologyCache.SourcedValueSet;
|
|||
import org.hl7.fhir.r5.terminologies.validation.VSCheckerException;
|
||||
import org.hl7.fhir.r5.terminologies.validation.ValueSetValidator;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientR5.TerminologyClientR5Factory;
|
||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientManager;
|
||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientR5;
|
||||
import org.hl7.fhir.r5.terminologies.client.TerminologyClientContext;
|
||||
import org.hl7.fhir.r5.utils.PackageHackerR5;
|
||||
import org.hl7.fhir.r5.utils.ResourceUtilities;
|
||||
|
@ -138,10 +137,8 @@ import org.hl7.fhir.r5.utils.ToolingExtensions;
|
|||
import org.hl7.fhir.r5.utils.client.EFhirClientException;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.TimeTracker;
|
||||
import org.hl7.fhir.utilities.ToolingClientLogger;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nBase;
|
||||
|
@ -234,7 +231,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
private Object lock = new Object(); // used as a lock for the data that follows
|
||||
protected String version; // although the internal resources are all R5, the version of FHIR they describe may not be
|
||||
|
||||
protected final TerminologyClientManager terminologyClientManager = new TerminologyClientManager(null, UUID.randomUUID().toString());
|
||||
protected final TerminologyClientManager terminologyClientManager = new TerminologyClientManager(new TerminologyClientR5.TerminologyClientR5Factory(), UUID.randomUUID().toString());
|
||||
private boolean minimalMemory = false;
|
||||
|
||||
private Map<String, Map<String, ResourceProxy>> allResourcesById = new HashMap<String, Map<String, ResourceProxy>>();
|
||||
|
@ -277,7 +274,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
private int expandCodesLimit = 1000;
|
||||
protected ILoggingService logger = new SystemOutLoggingService();
|
||||
protected Parameters expParameters;
|
||||
private TranslationServices translator = new NullTranslator();
|
||||
private Map<String, PackageInformation> packages = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
|
@ -312,7 +308,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
protected void copy(BaseWorkerContext other) {
|
||||
synchronized (other.lock) { // tricky, because you need to lock this as well, but it's really not in use yet
|
||||
allResourcesById.putAll(other.allResourcesById);
|
||||
translator = other.translator;
|
||||
codeSystems.copy(other.codeSystems);
|
||||
valueSets.copy(other.valueSets);
|
||||
maps.copy(other.maps);
|
||||
|
@ -851,7 +846,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return res;
|
||||
}
|
||||
Set<String> systems = findRelevantSystems(vs);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(systems, true);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(vs, systems, true);
|
||||
if (tc == null) {
|
||||
return new ValueSetExpansionOutcome("No server available", TerminologyServiceErrorClass.INTERNAL_ERROR, true);
|
||||
}
|
||||
|
@ -915,7 +910,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
|
||||
Parameters p = pIn.copy();
|
||||
|
||||
p.setParameter("_limit",new IntegerType("10000"));
|
||||
p.setParameter("_incomplete", new BooleanType("true"));
|
||||
if (vs.hasExpansion()) {
|
||||
return new ValueSetExpansionOutcome(vs.copy());
|
||||
}
|
||||
|
@ -978,7 +974,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
|
||||
p.addParameter().setName("cache-id").setValue(new IdType(terminologyClientManager.getCacheId()));
|
||||
Set<String> systems = findRelevantSystems(vs);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(systems, true);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(vs, systems, true);
|
||||
addDependentResources(tc, p, vs);
|
||||
|
||||
|
||||
|
@ -1108,7 +1104,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
|
||||
if (batch.getEntry().size() > 0) {
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(systems, false);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(vs, systems, false);
|
||||
Bundle resp = processBatch(tc, batch, systems);
|
||||
for (int i = 0; i < batch.getEntry().size(); i++) {
|
||||
CodingValidationRequest t = (CodingValidationRequest) batch.getEntry().get(i).getUserData("source");
|
||||
|
@ -1213,7 +1209,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
systems.add(codingValidationRequest.getCoding().getSystem());
|
||||
}
|
||||
}
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(systems, false);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(vs, systems, false);
|
||||
|
||||
if (batch.getEntry().size() > 0) {
|
||||
Bundle resp = processBatch(tc, batch, systems);
|
||||
|
@ -1291,7 +1287,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
vsc.setUnknownSystems(unknownSystems);
|
||||
vsc.setThrowToServer(options.isUseServer() && terminologyClientManager.hasClient());
|
||||
if (!ValueSetUtilities.isServerSide(code.getSystem())) {
|
||||
res = vsc.validateCode(path, code);
|
||||
res = vsc.validateCode(path, code.copy());
|
||||
if (txCache != null && cachingAllowed) {
|
||||
txCache.cacheValidation(cacheToken, res, TerminologyCache.TRANSIENT);
|
||||
}
|
||||
|
@ -1346,9 +1342,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
|
||||
Set<String> systems = findRelevantSystems(code, vs);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(systems, false);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(vs, systems, false);
|
||||
|
||||
String csumm =cachingAllowed && txCache != null ? txCache.summary(code) : null;
|
||||
String csumm = cachingAllowed && txCache != null ? txCache.summary(code) : null;
|
||||
if (cachingAllowed && txCache != null) {
|
||||
txLog("$validate "+csumm+(vs == null ? "" : " for "+ txCache.summary(vs))+" on "+tc.getAddress());
|
||||
} else {
|
||||
|
@ -1365,7 +1361,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
if (!res.isOk() && localError != null) {
|
||||
res.setDiagnostics("Local Error: "+localError.trim()+". Server Error: "+res.getMessage());
|
||||
} else if (!res.isOk() && res.getUnknownSystems() != null && res.getUnknownSystems().contains(codeKey) && localWarning != null) {
|
||||
} else if (!res.isOk() && res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && res.getUnknownSystems() != null && res.getUnknownSystems().contains(codeKey) && localWarning != null) {
|
||||
// we had some problem evaluating locally, but the server doesn't know the code system, so we'll just go with the local error
|
||||
res = new ValidationResult(IssueSeverity.WARNING, localWarning, null);
|
||||
res.setDiagnostics("Local Warning: "+localWarning.trim()+". Server Error: "+res.getMessage());
|
||||
|
@ -1378,6 +1374,83 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ask the terminology system whether parent subsumes child.
|
||||
*
|
||||
* @return true if it does, false if it doesn't, and null if it's not know whether it does
|
||||
*/
|
||||
public Boolean subsumes(ValidationOptions optionsArg, Coding parent, Coding child) {
|
||||
ValidationOptions options = optionsArg != null ? optionsArg : ValidationOptions.defaults();
|
||||
|
||||
if (parent.hasSystem()) {
|
||||
codeSystemsUsed.add(parent.getSystem());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (child.hasSystem()) {
|
||||
codeSystemsUsed.add(child.getSystem());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
final CacheToken cacheToken = cachingAllowed && txCache != null ? txCache.generateSubsumesToken(options, parent, child, expParameters) : null;
|
||||
if (cachingAllowed && txCache != null) {
|
||||
Boolean res = txCache.getSubsumes(cacheToken);
|
||||
if (res != null) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.isUseClient() && parent.getSystem().equals(child.getSystem())) {
|
||||
CodeSystem cs = fetchCodeSystem(parent.getSystem());
|
||||
if (cs != null) {
|
||||
Boolean b = CodeSystemUtilities.subsumes(cs, parent.getCode(), child.getCode());
|
||||
if (txCache != null && cachingAllowed) {
|
||||
txCache.cacheSubsumes(cacheToken, b, true);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
if (!terminologyClientManager.hasClient() || !options.isUseServer() || unsupportedCodeSystems.contains(parent.getSystem()) || unsupportedCodeSystems.contains(child.getSystem()) || noTerminologyServer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<String> systems = new HashSet<>();
|
||||
systems.add(parent.getSystem());
|
||||
systems.add(child.getSystem());
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(null, systems, false);
|
||||
|
||||
txLog("$subsumes "+parent.toString()+" > "+child.toString()+" on "+tc.getAddress());
|
||||
|
||||
try {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("codingA").setValue(parent);
|
||||
pIn.addParameter().setName("codingB").setValue(child);
|
||||
if (txLog != null) {
|
||||
txLog.clearLastId();
|
||||
}
|
||||
Parameters pOut = tc.getClient().subsumes(pIn);
|
||||
return processSubsumesResult(pOut, tc.getClient().getAddress());
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Boolean processSubsumesResult(Parameters pOut, String server) {
|
||||
for (ParametersParameterComponent p : pOut.getParameter()) {
|
||||
if (p.hasValue()) {
|
||||
if (p.getName().equals("outcome")) {
|
||||
return Utilities.existsInList(p.getValue().primitiveValue(), "equivalent", "subsumes");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ValueSetExpander constructValueSetExpanderSimple(ValidationOptions options) {
|
||||
return new ValueSetExpander(this, new TerminologyOperationContext(this, options)).setDebug(logger.isDebugLogging());
|
||||
}
|
||||
|
@ -1538,7 +1611,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return new ValidationResult(IssueSeverity.ERROR, "Error validating code: running without terminology services", TerminologyServiceErrorClass.NOSERVICE, null);
|
||||
}
|
||||
Set<String> systems = findRelevantSystems(code, vs);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(systems, false);
|
||||
TerminologyClientContext tc = terminologyClientManager.chooseServer(vs, systems, false);
|
||||
|
||||
txLog("$validate "+txCache.summary(code)+" for "+ txCache.summary(vs)+" on "+tc.getAddress());
|
||||
try {
|
||||
|
@ -1780,6 +1853,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
} else if (p.getName().equals("x-caused-by-unknown-system")) {
|
||||
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED;
|
||||
unknownSystems.add(((PrimitiveType<?>) p.getValue()).asStringValue());
|
||||
} else if (p.getName().equals("x-unknown-system")) {
|
||||
unknownSystems.add(((PrimitiveType<?>) p.getValue()).asStringValue());
|
||||
} else if (p.getName().equals("warning-withdrawn")) {
|
||||
String msg = ((PrimitiveType<?>) p.getValue()).asStringValue();
|
||||
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION, org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE);
|
||||
|
@ -2562,55 +2637,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
|
||||
public TranslationServices translator() {
|
||||
return translator;
|
||||
}
|
||||
|
||||
public void setTranslator(TranslationServices translator) {
|
||||
this.translator = translator;
|
||||
}
|
||||
|
||||
public class NullTranslator implements TranslationServices {
|
||||
|
||||
@Override
|
||||
public String translate(String context, String value, String targetLang) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translate(String context, String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toStr(float value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toStr(Date value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translateAndFormat(String contest, String lang, String value, Object... args) {
|
||||
return String.format(value, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> translations(String value) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> listTranslations(String category) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void reportStatus(JsonObject json) {
|
||||
synchronized (lock) {
|
||||
json.addProperty("codeystem-count", codeSystems.size());
|
||||
|
@ -3221,4 +3247,95 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Resource> List<T> fetchResourcesByUrl(Class<T> class_, String uri) {
|
||||
List<T> res = new ArrayList<>();
|
||||
if (uri != null && !uri.startsWith("#")) {
|
||||
if (class_ == StructureDefinition.class) {
|
||||
uri = ProfileUtilities.sdNs(uri, null);
|
||||
}
|
||||
assert !uri.contains("|");
|
||||
if (uri.contains("#")) {
|
||||
uri = uri.substring(0, uri.indexOf("#"));
|
||||
}
|
||||
synchronized (lock) {
|
||||
if (class_ == Resource.class || class_ == null) {
|
||||
for (Map<String, ResourceProxy> rt : allResourcesById.values()) {
|
||||
for (ResourceProxy r : rt.values()) {
|
||||
if (uri.equals(r.getUrl())) {
|
||||
res.add((T) r.getResource());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (class_ == ImplementationGuide.class || class_ == Resource.class || class_ == null) {
|
||||
for (ImplementationGuide cr : guides.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == CapabilityStatement.class || class_ == Resource.class || class_ == null) {
|
||||
for (CapabilityStatement cr : capstmts.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == Measure.class || class_ == Resource.class || class_ == null) {
|
||||
for (Measure cr : measures.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == Library.class || class_ == Resource.class || class_ == null) {
|
||||
for (Library cr : libraries.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == StructureDefinition.class || class_ == Resource.class || class_ == null) {
|
||||
for (StructureDefinition cr : structures.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == StructureMap.class || class_ == Resource.class || class_ == null) {
|
||||
for (StructureMap cr : transforms.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == NamingSystem.class || class_ == Resource.class || class_ == null) {
|
||||
for (NamingSystem cr : systems.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == ValueSet.class || class_ == Resource.class || class_ == null) {
|
||||
for (ValueSet cr : valueSets.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == CodeSystem.class || class_ == Resource.class || class_ == null) {
|
||||
for (CodeSystem cr : codeSystems.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == ConceptMap.class || class_ == Resource.class || class_ == null) {
|
||||
for (ConceptMap cr : maps.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == ActorDefinition.class || class_ == Resource.class || class_ == null) {
|
||||
for (ActorDefinition cr : actors.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == Requirements.class || class_ == Resource.class || class_ == null) {
|
||||
for (Requirements cr : requirements.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == PlanDefinition.class || class_ == Resource.class || class_ == null) {
|
||||
for (PlanDefinition cr : plans.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == OperationDefinition.class || class_ == Resource.class || class_ == null) {
|
||||
for (OperationDefinition cr : operations.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == Questionnaire.class || class_ == Resource.class || class_ == null) {
|
||||
for (Questionnaire cr : questionnaires.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
} else if (class_ == SearchParameter.class || class_ == Resource.class || class_ == null) {
|
||||
for (SearchParameter cr : searchParameters.getForUrl(uri)) {
|
||||
res.add((T) cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -537,6 +537,16 @@ public class CanonicalResourceManager<T extends CanonicalResource> {
|
|||
}
|
||||
}
|
||||
|
||||
public List<T> getForUrl(String url) {
|
||||
List<T> res = new ArrayList<>();
|
||||
List<CanonicalResourceManager<T>.CachedCanonicalResource<T>> list = listForUrl.get(url);
|
||||
if (list != null) {
|
||||
for (CanonicalResourceManager<T>.CachedCanonicalResource<T> t : list) {
|
||||
res.add(t.getResource());
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is asking for a packaged version aware resolution
|
||||
|
|
|
@ -47,6 +47,7 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
|||
private List<StructureDefinition> allStructuresList = new ArrayList<StructureDefinition>();
|
||||
private List<String> canonicalResourceNames;
|
||||
private List<String> concreteResourceNames;
|
||||
private Set<String> concreteResourceNameSet;
|
||||
|
||||
public ContextUtilities(IWorkerContext context) {
|
||||
super();
|
||||
|
@ -317,6 +318,9 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
|||
|
||||
@Override
|
||||
public boolean isResource(String t) {
|
||||
if (getConcreteResourceSet().contains(t)) {
|
||||
return true;
|
||||
}
|
||||
StructureDefinition sd;
|
||||
try {
|
||||
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t);
|
||||
|
@ -370,16 +374,22 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<String> getConcreteResources() {
|
||||
if (concreteResourceNames == null) {
|
||||
concreteResourceNames = new ArrayList<>();
|
||||
Set<String> names = new HashSet<>();
|
||||
for (StructureDefinition sd : allStructures()) {
|
||||
if (sd.getKind() == StructureDefinitionKind.RESOURCE && !sd.getAbstract()) {
|
||||
names.add(sd.getType());
|
||||
public Set<String> getConcreteResourceSet() {
|
||||
if (concreteResourceNameSet == null) {
|
||||
concreteResourceNameSet = new HashSet<>();
|
||||
for (StructureDefinition sd : getStructures()) {
|
||||
if (sd.getKind() == StructureDefinitionKind.RESOURCE && !sd.getAbstract() && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
|
||||
concreteResourceNameSet.add(sd.getType());
|
||||
}
|
||||
}
|
||||
concreteResourceNames.addAll(Utilities.sorted(names));
|
||||
}
|
||||
return concreteResourceNameSet;
|
||||
}
|
||||
|
||||
public List<String> getConcreteResources() {
|
||||
if (concreteResourceNames == null) {
|
||||
concreteResourceNames = new ArrayList<>();
|
||||
concreteResourceNames.addAll(Utilities.sorted(getConcreteResourceSet()));
|
||||
}
|
||||
return concreteResourceNames;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
|||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
import org.hl7.fhir.utilities.TimeTracker;
|
||||
import org.hl7.fhir.utilities.TranslationServices;
|
||||
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
|
@ -191,6 +190,15 @@ public interface IWorkerContext {
|
|||
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_, FhirPublication fhirVersion);
|
||||
public <T extends Resource> List<T> fetchResourcesByType(Class<T> class_);
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all the resources for the given URL - all matching versions
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public <T extends Resource> List<T> fetchResourcesByUrl(Class<T> class_, String url);
|
||||
|
||||
/**
|
||||
* Variation of fetchResource when you have a string type, and don't need the right class
|
||||
*
|
||||
|
@ -380,6 +388,8 @@ public interface IWorkerContext {
|
|||
/**
|
||||
* Access to the contexts internationalised error messages
|
||||
*
|
||||
* For rendering internationalization, see RenderingContext
|
||||
*
|
||||
* @param theMessage
|
||||
* @param theMessageArguments
|
||||
* @return
|
||||
|
@ -497,7 +507,6 @@ public interface IWorkerContext {
|
|||
|
||||
// todo: figure these out
|
||||
public Map<String, NamingSystem> getNSUrlMap();
|
||||
public TranslationServices translator();
|
||||
|
||||
public void setLogger(@Nonnull ILoggingService logger);
|
||||
public ILoggingService getLogger();
|
||||
|
@ -640,4 +649,11 @@ public interface IWorkerContext {
|
|||
public <T extends Resource> T findTxResource(Class<T> class_, String canonical);
|
||||
public <T extends Resource> T findTxResource(Class<T> class_, String canonical, String version);
|
||||
|
||||
/**
|
||||
* ask the terminology system whether parent subsumes child.
|
||||
*
|
||||
* @return true if it does, false if it doesn't, and null if it's not know whether it does
|
||||
*/
|
||||
public Boolean subsumes(ValidationOptions options, Coding parent, Coding child);
|
||||
|
||||
}
|
|
@ -514,7 +514,7 @@ public class Element extends Base implements NamedItem {
|
|||
}
|
||||
|
||||
private boolean isDataType(Base v) {
|
||||
return v instanceof DataType && new ContextUtilities(property.getContext()).getTypeNames().contains(v.fhirType());
|
||||
return v instanceof DataType && property.getContextUtils().getTypeNames().contains(v.fhirType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1342,6 +1342,23 @@ public class Element extends Base implements NamedItem {
|
|||
children.add(ne);
|
||||
return ne;
|
||||
}
|
||||
// polymorphic support
|
||||
if (p.getName().endsWith("[x]")) {
|
||||
String base = p.getName().substring(0, p.getName().length()-3);
|
||||
|
||||
if (name.startsWith(base)) {
|
||||
String type = name.substring(base.length());
|
||||
if (p.getContextUtils().isPrimitiveType(Utilities.uncapitalize(type))) {
|
||||
type = Utilities.uncapitalize(type);
|
||||
}
|
||||
if (p.canBeType(type)) {
|
||||
Element ne = new Element(name, p).setFormat(format);
|
||||
ne.setType(type);
|
||||
children.add(ne);
|
||||
return ne;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Unrecognised property '"+name+"' on "+this.name);
|
||||
|
@ -1496,7 +1513,7 @@ public class Element extends Base implements NamedItem {
|
|||
ext.addElement("valueCode").setValue(lang);
|
||||
|
||||
ext = t.addElement("extension");
|
||||
ext.addElement("url").setValue("value");
|
||||
ext.addElement("url").setValue("content");
|
||||
ext.addElement("valueString").setValue(translation);
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public class FmlParser extends ParserBase {
|
|||
lexer.token("conceptmap");
|
||||
Element map = structureMap.makeElement("contained");
|
||||
StructureDefinition sd = context.fetchTypeDefinition("ConceptMap");
|
||||
map.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd), SpecialElement.fromProperty(map.getElementProperty() != null ? map.getElementProperty() : map.getProperty()), map.getProperty());
|
||||
map.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities()), SpecialElement.fromProperty(map.getElementProperty() != null ? map.getElementProperty() : map.getProperty()), map.getProperty());
|
||||
map.setType("ConceptMap");
|
||||
Element eid = map.makeElement("id").markLocation(lexer.getCurrentLocation());
|
||||
String id = lexer.readConstant("map id");
|
||||
|
@ -225,6 +225,8 @@ public class FmlParser extends ParserBase {
|
|||
String token = lexer.take();
|
||||
if (token.equals("-"))
|
||||
return ConceptMapRelationship.RELATEDTO;
|
||||
if (token.equals("=")) // temporary
|
||||
return ConceptMapRelationship.RELATEDTO;
|
||||
if (token.equals("=="))
|
||||
return ConceptMapRelationship.EQUIVALENT;
|
||||
if (token.equals("!="))
|
||||
|
|
|
@ -86,22 +86,15 @@ public class JsonParser extends ParserBase {
|
|||
private JsonCreator json;
|
||||
private boolean allowComments;
|
||||
|
||||
private ProfileUtilities profileUtilities;
|
||||
private Element baseElement;
|
||||
private ContextUtilities contextUtilities;
|
||||
|
||||
public JsonParser(IWorkerContext context, ProfileUtilities utilities) {
|
||||
super(context);
|
||||
super(context, utilities);
|
||||
|
||||
this.profileUtilities = utilities;
|
||||
contextUtilities = new ContextUtilities(context);
|
||||
}
|
||||
|
||||
public JsonParser(IWorkerContext context) {
|
||||
super(context);
|
||||
|
||||
this.profileUtilities = new ProfileUtilities(this.context, null, null, new FHIRPathEngine(context));
|
||||
contextUtilities = new ContextUtilities(context);
|
||||
}
|
||||
|
||||
public Element parse(String source, String type) throws Exception {
|
||||
|
@ -128,7 +121,7 @@ public class JsonParser extends ParserBase {
|
|||
nEd.addType().setCode(type);
|
||||
nEd.setMax(obj.getProperties().get(0).getValue().isJsonArray() ? "*" : "1");
|
||||
}
|
||||
Element result = new Element(type, new Property(context, sd.getSnapshot().getElement().get(0), sd, this.profileUtilities)).setFormat(FhirFormat.JSON);
|
||||
Element result = new Element(type, new Property(context, sd.getSnapshot().getElement().get(0), sd, this.getProfileUtilities(), this.getContextUtilities())).setFormat(FhirFormat.JSON);
|
||||
result.setPath(type);
|
||||
checkObject(focusFragment.getErrors(), obj, result, path);
|
||||
result.setType(type);
|
||||
|
@ -199,7 +192,7 @@ public class JsonParser extends ParserBase {
|
|||
name = sd.getType();
|
||||
path = sd.getTypeTail();
|
||||
}
|
||||
baseElement = new Element(name, new Property(context, sd.getSnapshot().getElement().get(0), sd, this.profileUtilities)).setFormat(FhirFormat.JSON);
|
||||
baseElement = new Element(name, new Property(context, sd.getSnapshot().getElement().get(0), sd, this.getProfileUtilities(), this.getContextUtilities())).setFormat(FhirFormat.JSON);
|
||||
checkObject(errors, object, baseElement, path);
|
||||
baseElement.markLocation(line(object), col(object));
|
||||
baseElement.setType(name);
|
||||
|
@ -259,9 +252,9 @@ public class JsonParser extends ParserBase {
|
|||
if (policy != ValidationPolicy.NONE) {
|
||||
for (JsonProperty e : children) {
|
||||
if (e.getTag() == 0) {
|
||||
StructureDefinition sd = element.getProperty().isLogical() ? contextUtilities.fetchByJsonName(e.getName()) : null;
|
||||
StructureDefinition sd = element.getProperty().isLogical() ? getContextUtilities().fetchByJsonName(e.getName()) : null;
|
||||
if (sd != null) {
|
||||
Property property = new Property(context, sd.getSnapshot().getElementFirstRep(), sd, element.getProperty().getUtils());
|
||||
Property property = new Property(context, sd.getSnapshot().getElementFirstRep(), sd, element.getProperty().getUtils(), element.getProperty().getContextUtils());
|
||||
parseChildItem(errors, path, children, element, property);
|
||||
} else if ("fhir_comments".equals(e.getName()) && (VersionUtilities.isR2BVer(context.getVersion()) || VersionUtilities.isR2Ver(context.getVersion()))) {
|
||||
if (!e.getValue().isJsonArray()) {
|
||||
|
@ -341,7 +334,7 @@ public class JsonParser extends ParserBase {
|
|||
if (type == null) {
|
||||
logError(errors, ValidationMessage.NO_RULE_DATE, line(je), col(je), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE, describeType(je), property.getName(), property.typeSummary()), IssueSeverity.ERROR);
|
||||
} else if (property.hasType(type)) {
|
||||
Property np = new Property(property.getContext(), property.getDefinition(), property.getStructure(), property.getUtils(), type);
|
||||
Property np = new Property(property.getContext(), property.getDefinition(), property.getStructure(), property.getUtils(), property.getContextUtils(), type);
|
||||
parseChildPrimitive(errors, jp, getJsonPropertyByName("_"+property.getJsonName(), children), context, np, path, property.getName(), false);
|
||||
} else {
|
||||
logError(errors, ValidationMessage.NO_RULE_DATE, line(je), col(je), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE_WRONG, describeType(je), property.getName(), type, property.typeSummary()), IssueSeverity.ERROR);
|
||||
|
@ -474,7 +467,7 @@ public class JsonParser extends ParserBase {
|
|||
if (type == null) {
|
||||
logError(errors, ValidationMessage.NO_RULE_DATE, line(pv.getValue()), col(pv.getValue()), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE, describeType(pv.getValue()), propV.getName(), propV.typeSummary()), IssueSeverity.ERROR);
|
||||
} else if (propV.hasType(type)) {
|
||||
pvl = new Property(propV.getContext(), propV.getDefinition(), propV.getStructure(), propV.getUtils(), type);
|
||||
pvl = new Property(propV.getContext(), propV.getDefinition(), propV.getStructure(), propV.getUtils(), propV.getContextUtils(), type);
|
||||
ok = true;
|
||||
} else {
|
||||
logError(errors, ValidationMessage.NO_RULE_DATE, line(pv.getValue()), col(pv.getValue()), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE_WRONG, describeType(pv.getValue()), propV.getName(), type, propV.typeSummary()), IssueSeverity.ERROR);
|
||||
|
@ -713,7 +706,7 @@ public class JsonParser extends ParserBase {
|
|||
if (sd == null) {
|
||||
logError(errors, ValidationMessage.NO_RULE_DATE, line(res), col(res), npath, IssueType.INVALID, context.formatMessage(I18nConstants.CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_, name), IssueSeverity.FATAL);
|
||||
} else {
|
||||
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, this.profileUtilities), SpecialElement.fromProperty(parent.getProperty()), elementProperty);
|
||||
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, this.getProfileUtilities(), this.getContextUtilities()), SpecialElement.fromProperty(parent.getProperty()), elementProperty);
|
||||
parent.setType(name);
|
||||
parseChildren(errors, npath, res, parent, true, null);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,19 @@ import java.util.Set;
|
|||
import org.checkerframework.checker.units.qual.cd;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent;
|
||||
import org.hl7.fhir.r5.model.ContactDetail;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingAdditionalComponent;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.StringType;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -24,6 +31,10 @@ import org.hl7.fhir.utilities.i18n.LanguageFileProducer;
|
|||
import org.hl7.fhir.utilities.i18n.LanguageFileProducer.LanguageProducerLanguageSession;
|
||||
import org.hl7.fhir.utilities.i18n.LanguageFileProducer.TextUnit;
|
||||
import org.hl7.fhir.utilities.i18n.LanguageFileProducer.TranslationUnit;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||
|
||||
/**
|
||||
* in here:
|
||||
|
@ -78,7 +89,6 @@ public class LanguageUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private String contextForElement(Element element) {
|
||||
throw new Error("Not done yet");
|
||||
}
|
||||
|
@ -110,7 +120,7 @@ public class LanguageUtils {
|
|||
}
|
||||
|
||||
private boolean isTranslatable(Element element) {
|
||||
return element.getProperty().isTranslatable() && !Utilities.existsInList(pathForElement(element), "CanonicalResource.version");
|
||||
return element.getProperty().isTranslatable();
|
||||
}
|
||||
|
||||
private String pathForElement(Element element) {
|
||||
|
@ -132,11 +142,85 @@ public class LanguageUtils {
|
|||
return bp;
|
||||
}
|
||||
|
||||
public int importFromTranslations(Element resource, Set<TranslationUnit> translations) {
|
||||
return importFromTranslations(null, resource, translations);
|
||||
|
||||
public int importFromTranslations(Element resource, List<TranslationUnit> translations) {
|
||||
return importFromTranslations(null, resource, translations, new HashSet<>());
|
||||
}
|
||||
|
||||
private int importFromTranslations(Element parent, Element element, Set<TranslationUnit> translations) {
|
||||
public int importFromTranslations(Element resource, List<TranslationUnit> translations, List<ValidationMessage> messages) {
|
||||
Set<TranslationUnit> usedUnits = new HashSet<>();
|
||||
int r = 0;
|
||||
if (resource.fhirType().equals("StructureDefinition")) {
|
||||
r = importFromTranslationsForSD(null, resource, translations, usedUnits);
|
||||
} else {
|
||||
r = importFromTranslations(null, resource, translations, usedUnits);
|
||||
}
|
||||
for (TranslationUnit t : translations) {
|
||||
if (!usedUnits.contains(t)) {
|
||||
messages.add(new ValidationMessage(Source.Publisher, IssueType.INFORMATIONAL, t.getId(), "Unused '"+t.getLanguage()+"' translation '"+t.getSrcText()+"' -> '"+t.getTgtText()+"'", IssueSeverity.INFORMATION));
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* */
|
||||
private int importFromTranslationsForSD(Object object, Element resource, List<TranslationUnit> translations, Set<TranslationUnit> usedUnits) {
|
||||
int r = 0;
|
||||
r = r + checkForTranslations(translations, usedUnits, resource, "name", "name");
|
||||
r = r + checkForTranslations(translations, usedUnits, resource, "title", "title");
|
||||
r = r + checkForTranslations(translations, usedUnits, resource, "publisher", "publisher");
|
||||
for (Element cd : resource.getChildrenByName("contact")) {
|
||||
r = r + checkForTranslations(translations, usedUnits, cd, "contact.name", "name");
|
||||
}
|
||||
r = r + checkForTranslations(translations, usedUnits, resource, "purpose", "purpose");
|
||||
r = r + checkForTranslations(translations, usedUnits, resource, "copyright", "copyright");
|
||||
Element diff = resource.getNamedChild("differential");
|
||||
if (diff != null) {
|
||||
for (Element ed : diff.getChildrenByName("element")) {
|
||||
String id = ed.getNamedChildValue("id");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/label", "label");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/short", "short");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/definition", "definition");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/comment", "comment");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/requirements", "requirements");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/meaningWhenMissing", "meaningWhenMissing");
|
||||
r = r + checkForTranslations(translations, usedUnits, ed, id+"/orderMeaning", "orderMeaning");
|
||||
// for (ElementDefinitionConstraintComponent con : ed.getConstraint()) {
|
||||
// addToList(list, lang, con, ed.getId()+"/constraint", "human", con.getHumanElement());
|
||||
// }
|
||||
// if (ed.hasBinding()) {
|
||||
// addToList(list, lang, ed.getBinding(), ed.getId()+"/b/desc", "description", ed.getBinding().getDescriptionElement());
|
||||
// for (ElementDefinitionBindingAdditionalComponent ab : ed.getBinding().getAdditional()) {
|
||||
// addToList(list, lang, ab, ed.getId()+"/ab/doco", "documentation", ab.getDocumentationElement());
|
||||
// addToList(list, lang, ab, ed.getId()+"/ab/short", "shortDoco", ab.getShortDocoElement());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
private int checkForTranslations(List<TranslationUnit> translations, Set<TranslationUnit> usedUnits, Element context, String tname, String pname) {
|
||||
int r = 0;
|
||||
Element child = context.getNamedChild(pname);
|
||||
if (child != null) {
|
||||
String v = child.primitiveValue();
|
||||
if (v != null) {
|
||||
for (TranslationUnit tu : translations) {
|
||||
if (tname.equals(tu.getId()) && v.equals(tu.getSrcText())) {
|
||||
usedUnits.add(tu);
|
||||
child.setTranslation(tu.getLanguage(), tu.getTgtText());
|
||||
r++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
private int importFromTranslations(Element parent, Element element, List<TranslationUnit> translations, Set<TranslationUnit> usedUnits) {
|
||||
int t = 0;
|
||||
if (element.isPrimitive() && isTranslatable(element)) {
|
||||
String base = element.primitiveValue();
|
||||
|
@ -146,13 +230,14 @@ public class LanguageUtils {
|
|||
t++;
|
||||
if (!handleAsSpecial(parent, element, translation)) {
|
||||
element.setTranslation(translation.getLanguage(), translation.getTgtText());
|
||||
usedUnits.add(translation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Element c: element.getChildren()) {
|
||||
if (!c.getName().equals("designation")) {
|
||||
t = t + importFromTranslations(element, c, translations);
|
||||
t = t + importFromTranslations(element, c, translations, usedUnits);
|
||||
}
|
||||
}
|
||||
return t;
|
||||
|
@ -193,7 +278,7 @@ public class LanguageUtils {
|
|||
return true;
|
||||
}
|
||||
|
||||
private Set<TranslationUnit> findTranslations(String path, String src, Set<TranslationUnit> translations) {
|
||||
private Set<TranslationUnit> findTranslations(String path, String src, List<TranslationUnit> translations) {
|
||||
Set<TranslationUnit> res = new HashSet<>();
|
||||
for (TranslationUnit translation : translations) {
|
||||
if (path.equals(translation.getId()) && src.equals(translation.getSrcText())) {
|
||||
|
@ -290,22 +375,64 @@ public class LanguageUtils {
|
|||
}
|
||||
|
||||
public static boolean handlesAsResource(Resource resource) {
|
||||
return (resource instanceof CodeSystem && resource.hasUserData(SUPPLEMENT_NAME));
|
||||
return (resource instanceof CodeSystem && resource.hasUserData(SUPPLEMENT_NAME)) || (resource instanceof StructureDefinition);
|
||||
}
|
||||
|
||||
public static boolean handlesAsElement(Element element) {
|
||||
return false; // for now...
|
||||
return true; // for now...
|
||||
}
|
||||
|
||||
public static List<TranslationUnit> generateTranslations(Resource res, String lang) {
|
||||
List<TranslationUnit> list = new ArrayList<>();
|
||||
CodeSystem cs = (CodeSystem) res;
|
||||
for (ConceptDefinitionComponent cd : cs.getConcept()) {
|
||||
generateTranslations(list, cd, lang);
|
||||
if (res instanceof StructureDefinition) {
|
||||
StructureDefinition sd = (StructureDefinition) res;
|
||||
generateTranslations(list, sd, lang);
|
||||
} else {
|
||||
CodeSystem cs = (CodeSystem) res;
|
||||
for (ConceptDefinitionComponent cd : cs.getConcept()) {
|
||||
generateTranslations(list, cd, lang);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void generateTranslations(List<TranslationUnit> list, StructureDefinition sd, String lang) {
|
||||
addToList(list, lang, sd, "name", "name", sd.getNameElement());
|
||||
addToList(list, lang, sd, "title", "title", sd.getTitleElement());
|
||||
addToList(list, lang, sd, "publisher", "publisher", sd.getPublisherElement());
|
||||
for (ContactDetail cd : sd.getContact()) {
|
||||
addToList(list, lang, cd, "contact.name", "name", cd.getNameElement());
|
||||
}
|
||||
addToList(list, lang, sd, "purpose", "purpose", sd.getPurposeElement());
|
||||
addToList(list, lang, sd, "copyright", "copyright", sd.getCopyrightElement());
|
||||
for (ElementDefinition ed : sd.getDifferential().getElement()) {
|
||||
addToList(list, lang, ed, ed.getId()+"/label", "label", ed.getLabelElement());
|
||||
addToList(list, lang, ed, ed.getId()+"/short", "short", ed.getShortElement());
|
||||
addToList(list, lang, ed, ed.getId()+"/definition", "definition", ed.getDefinitionElement());
|
||||
addToList(list, lang, ed, ed.getId()+"/comment", "comment", ed.getCommentElement());
|
||||
addToList(list, lang, ed, ed.getId()+"/requirements", "requirements", ed.getRequirementsElement());
|
||||
addToList(list, lang, ed, ed.getId()+"/meaningWhenMissing", "meaningWhenMissing", ed.getMeaningWhenMissingElement());
|
||||
addToList(list, lang, ed, ed.getId()+"/orderMeaning", "orderMeaning", ed.getOrderMeaningElement());
|
||||
for (ElementDefinitionConstraintComponent con : ed.getConstraint()) {
|
||||
addToList(list, lang, con, ed.getId()+"/constraint", "human", con.getHumanElement());
|
||||
}
|
||||
if (ed.hasBinding()) {
|
||||
addToList(list, lang, ed.getBinding(), ed.getId()+"/b/desc", "description", ed.getBinding().getDescriptionElement());
|
||||
for (ElementDefinitionBindingAdditionalComponent ab : ed.getBinding().getAdditional()) {
|
||||
addToList(list, lang, ab, ed.getId()+"/ab/doco", "documentation", ab.getDocumentationElement());
|
||||
addToList(list, lang, ab, ed.getId()+"/ab/short", "shortDoco", ab.getShortDocoElement());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addToList(List<TranslationUnit> list, String lang, Base ctxt, String name, String propName, DataType value) {
|
||||
if (value != null && value.hasPrimitiveValue()) {
|
||||
list.add(new TranslationUnit(lang, name, ctxt.getNamedProperty(propName).getDefinition(), value.primitiveValue(), value.getTranslation(lang)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void generateTranslations(List<TranslationUnit> list, ConceptDefinitionComponent cd, String lang) {
|
||||
String code = cd.getCode();
|
||||
String display = cd.getDisplay();
|
||||
|
@ -334,4 +461,51 @@ public class LanguageUtils {
|
|||
return cd.getDefinition();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<TranslationUnit> generateTranslations(Element e, String lang) {
|
||||
List<TranslationUnit> list = new ArrayList<>();
|
||||
generateTranslations(e, lang, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void generateTranslations(Element e, String lang, List<TranslationUnit> list) {
|
||||
if (e.getProperty().isTranslatable()) {
|
||||
String id = e.getProperty().getDefinition().getPath();
|
||||
String context = e.getProperty().getDefinition().getDefinition();
|
||||
String src = e.primitiveValue();
|
||||
String tgt = getTranslation(e, lang);
|
||||
list.add(new TranslationUnit(lang, id, context, src, tgt));
|
||||
}
|
||||
if (e.hasChildren()) {
|
||||
for (Element c : e.getChildren()) {
|
||||
generateTranslations(c, lang, list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static String getTranslation(Element e, String lang) {
|
||||
if (!e.hasChildren()) {
|
||||
return null;
|
||||
}
|
||||
for (Element ext : e.getChildren()) {
|
||||
if ("Extension".equals(ext.fhirType()) && "http://hl7.org/fhir/StructureDefinition/translation".equals(ext.getNamedChildValue("url"))) {
|
||||
String l = null;
|
||||
String v = null;
|
||||
for (Element subExt : ext.getChildren()) {
|
||||
if ("Extension".equals(subExt.fhirType()) && "lang".equals(subExt.getNamedChildValue("url"))) {
|
||||
l = subExt.getNamedChildValue("value");
|
||||
}
|
||||
if ("Extension".equals(subExt.fhirType()) && "content".equals(subExt.getNamedChildValue("url"))) {
|
||||
v = subExt.getNamedChildValue("value");
|
||||
}
|
||||
}
|
||||
if (lang.equals(l)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,8 +39,10 @@ import java.util.List;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.fhirpath.FHIRPathEngine;
|
||||
import org.hl7.fhir.r5.formats.FormatUtilities;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
|
@ -89,14 +91,26 @@ public abstract class ParserBase {
|
|||
protected IdRenderingPolicy idPolicy = IdRenderingPolicy.All;
|
||||
protected StructureDefinition logical;
|
||||
protected IDigitalSignatureServices signatureServices;
|
||||
private ProfileUtilities profileUtilities;
|
||||
private ContextUtilities contextUtilities;
|
||||
|
||||
public ParserBase(IWorkerContext context) {
|
||||
public ParserBase(IWorkerContext context, ProfileUtilities utilities) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.profileUtilities = utilities;
|
||||
contextUtilities = new ContextUtilities(context);
|
||||
policy = ValidationPolicy.NONE;
|
||||
}
|
||||
|
||||
public void setupValidation(ValidationPolicy policy) {
|
||||
public ParserBase(IWorkerContext context) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.profileUtilities = new ProfileUtilities(context, null, null, new FHIRPathEngine(context));
|
||||
contextUtilities = new ContextUtilities(context);
|
||||
policy = ValidationPolicy.NONE;
|
||||
}
|
||||
|
||||
public void setupValidation(ValidationPolicy policy) {
|
||||
this.policy = policy;
|
||||
}
|
||||
|
||||
|
@ -215,19 +229,19 @@ public abstract class ParserBase {
|
|||
// first pass: only look at base definitions
|
||||
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
|
||||
if (sd.getUrl().equals("http://hl7.org/fhir/StructureDefinition/"+name)) {
|
||||
new ContextUtilities(context).generateSnapshot(sd);
|
||||
contextUtilities.generateSnapshot(sd);
|
||||
return sd;
|
||||
}
|
||||
}
|
||||
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
|
||||
if (name.equals(sd.getTypeName()) && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
|
||||
new ContextUtilities(context).generateSnapshot(sd);
|
||||
contextUtilities.generateSnapshot(sd);
|
||||
return sd;
|
||||
}
|
||||
}
|
||||
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
|
||||
if (name.equals(sd.getUrl()) && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
|
||||
new ContextUtilities(context).generateSnapshot(sd);
|
||||
contextUtilities.generateSnapshot(sd);
|
||||
return sd;
|
||||
}
|
||||
}
|
||||
|
@ -304,4 +318,22 @@ public abstract class ParserBase {
|
|||
return element.getNamedChildValue("reference");
|
||||
}
|
||||
}
|
||||
|
||||
public IWorkerContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public ValidationPolicy getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
||||
public ProfileUtilities getProfileUtilities() {
|
||||
return profileUtilities;
|
||||
}
|
||||
|
||||
public ContextUtilities getContextUtilities() {
|
||||
return contextUtilities;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -38,6 +38,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
|
|||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.SourcedChildDefinitions;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.fhirpath.TypeDetails;
|
||||
import org.hl7.fhir.r5.formats.FormatUtilities;
|
||||
|
@ -60,21 +61,24 @@ public class Property {
|
|||
private ElementDefinition definition;
|
||||
private StructureDefinition structure;
|
||||
private ProfileUtilities profileUtilities;
|
||||
private ContextUtilities utils;
|
||||
private TypeRefComponent type;
|
||||
|
||||
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure, ProfileUtilities profileUtilities) {
|
||||
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure, ProfileUtilities profileUtilities, ContextUtilities utils) {
|
||||
this.context = context;
|
||||
this.definition = definition;
|
||||
this.structure = structure;
|
||||
this.utils = utils;
|
||||
this.profileUtilities = profileUtilities;
|
||||
}
|
||||
|
||||
|
||||
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure, ProfileUtilities profileUtilities, String type) {
|
||||
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure, ProfileUtilities profileUtilities, ContextUtilities utils, String type) {
|
||||
this.context = context;
|
||||
this.definition = definition;
|
||||
this.structure = structure;
|
||||
this.profileUtilities = profileUtilities;
|
||||
this.utils = utils;
|
||||
for (TypeRefComponent tr : definition.getType()) {
|
||||
if (tr.getWorkingCode().equals(type)) {
|
||||
this.type = tr;
|
||||
|
@ -83,7 +87,7 @@ public class Property {
|
|||
}
|
||||
|
||||
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure) {
|
||||
this(context, definition, structure, new ProfileUtilities(context, null, null));
|
||||
this(context, definition, structure, new ProfileUtilities(context, null, null), new ContextUtilities(context));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -265,10 +269,10 @@ public class Property {
|
|||
public boolean isResource() {
|
||||
if (type != null) {
|
||||
String tc = type.getCode();
|
||||
return (("Resource".equals(tc) || "DomainResource".equals(tc)) || Utilities.existsInList(tc, context.getResourceNames()));
|
||||
return (("Resource".equals(tc) || "DomainResource".equals(tc)) || utils.isResource(tc));
|
||||
} else if (definition.getType().size() > 0) {
|
||||
String tc = definition.getType().get(0).getCode();
|
||||
return definition.getType().size() == 1 && (("Resource".equals(tc) || "DomainResource".equals(tc)) || Utilities.existsInList(tc, context.getResourceNames()));
|
||||
return definition.getType().size() == 1 && (("Resource".equals(tc) || "DomainResource".equals(tc)) || utils.isResource(tc));
|
||||
}
|
||||
else {
|
||||
return !definition.getPath().contains(".") && (structure.getKind() == StructureDefinitionKind.RESOURCE);
|
||||
|
@ -425,7 +429,7 @@ public class Property {
|
|||
}
|
||||
List<Property> properties = new ArrayList<Property>();
|
||||
for (ElementDefinition child : children.getList()) {
|
||||
properties.add(new Property(context, child, sd, this.profileUtilities));
|
||||
properties.add(new Property(context, child, sd, this.profileUtilities, this.utils));
|
||||
}
|
||||
profileUtilities.getCachedPropertyList().put(cacheKey, properties);
|
||||
return properties;
|
||||
|
@ -485,7 +489,7 @@ public class Property {
|
|||
}
|
||||
List<Property> properties = new ArrayList<Property>();
|
||||
for (ElementDefinition child : children.getList()) {
|
||||
properties.add(new Property(context, child, sd, this.profileUtilities));
|
||||
properties.add(new Property(context, child, sd, this.profileUtilities, this.utils));
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
@ -613,6 +617,9 @@ public class Property {
|
|||
public ProfileUtilities getUtils() {
|
||||
return profileUtilities;
|
||||
}
|
||||
public ContextUtilities getContextUtils() {
|
||||
return utils;
|
||||
}
|
||||
|
||||
public boolean isJsonPrimitiveChoice() {
|
||||
return ToolingExtensions.readBoolExtension(definition, ToolingExtensions.EXT_JSON_PRIMITIVE_CHOICE);
|
||||
|
@ -634,14 +641,32 @@ public class Property {
|
|||
|
||||
public boolean isTranslatable() {
|
||||
boolean ok = ToolingExtensions.readBoolExtension(definition, ToolingExtensions.EXT_TRANSLATABLE);
|
||||
if (!ok && !Utilities.existsInList(definition.getBase().getPath(), "Reference.reference", "Coding.version", "Identifier.value", "SampledData.offsets", "SampledData.data", "ContactPoint.value")) {
|
||||
if (!ok && !definition.getPath().endsWith(".id") && !Utilities.existsInList(definition.getBase().getPath(), "Resource.id", "Reference.reference", "Coding.version", "Identifier.value", "SampledData.offsets", "SampledData.data", "ContactPoint.value")) {
|
||||
String t = getType();
|
||||
ok = Utilities.existsInList(t, "string", "markdown");
|
||||
}
|
||||
if (Utilities.existsInList(pathForElement(getStructure().getType(), getDefinition().getBase().getPath()), "CanonicalResource.version")) {
|
||||
return false;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
private String pathForElement(String type, String path) {
|
||||
// special case support for metadata elements prior to R5:
|
||||
if (utils.getCanonicalResourceNames().contains(type)) {
|
||||
String fp = path.replace(type+".", "CanonicalResource.");
|
||||
if (Utilities.existsInList(fp,
|
||||
"CanonicalResource.url", "CanonicalResource.identifier", "CanonicalResource.version", "CanonicalResource.name",
|
||||
"CanonicalResource.title", "CanonicalResource.status", "CanonicalResource.experimental", "CanonicalResource.date",
|
||||
"CanonicalResource.publisher", "CanonicalResource.contact", "CanonicalResource.description", "CanonicalResource.useContext",
|
||||
"CanonicalResource.jurisdiction")) {
|
||||
return fp;
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getXmlTypeName() {
|
||||
TypeRefComponent tr = type;
|
||||
if (tr == null) {
|
||||
|
@ -671,4 +696,14 @@ public class Property {
|
|||
}
|
||||
|
||||
|
||||
public boolean canBeType(String type) {
|
||||
for (TypeRefComponent tr : getDefinition().getType()) {
|
||||
if (type.equals(tr.getWorkingCode())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -50,7 +50,7 @@ public class ResourceParser extends ParserBase {
|
|||
if (sd == null) {
|
||||
throw new FHIRException("No definition exists for "+resource.fhirType());
|
||||
}
|
||||
Property p = new Property(context, sd.getSnapshot().getElement().get(0), sd, new ProfileUtilities(context, null, null));
|
||||
Property p = new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities());
|
||||
String path = resource.fhirType();
|
||||
|
||||
Element e = new Element(resource.fhirType(), p);
|
||||
|
@ -106,7 +106,7 @@ public class ResourceParser extends ParserBase {
|
|||
StructureDefinition sd = context.fetchResource(StructureDefinition.class, ProfileUtilities.sdNs(v.fhirType(), null));
|
||||
if (sd == null)
|
||||
throw new FHIRFormatError(context.formatMessage(I18nConstants.CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_, v.fhirType()));
|
||||
n.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd), SpecialElement.fromProperty(n.getProperty()), p);
|
||||
n.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities()), SpecialElement.fromProperty(n.getProperty()), p);
|
||||
n.setType(v.fhirType());
|
||||
parseChildren(npath, v, n);
|
||||
} else {
|
||||
|
|
|
@ -151,7 +151,7 @@ public class TurtleParser extends ParserBase {
|
|||
if (sd == null)
|
||||
return null;
|
||||
|
||||
Element result = new Element(name, new Property(context, sd.getSnapshot().getElement().get(0), sd)).setFormat(FhirFormat.TURTLE);
|
||||
Element result = new Element(name, new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities())).setFormat(FhirFormat.TURTLE);
|
||||
result.markLocation(cmp.getLine(), cmp.getCol());
|
||||
result.setType(name);
|
||||
parseChildren(errors, src, path, cmp, result, false);
|
||||
|
@ -279,7 +279,7 @@ public class TurtleParser extends ParserBase {
|
|||
|
||||
Element n = new Element(tail(name), property).markLocation(object.getLine(), object.getCol()).setFormat(FhirFormat.TURTLE);
|
||||
element.getChildren().add(n);
|
||||
n.updateProperty(new Property(this.context, sd.getSnapshot().getElement().get(0), sd), SpecialElement.fromProperty(n.getProperty()), property);
|
||||
n.updateProperty(new Property(this.context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities()), SpecialElement.fromProperty(n.getProperty()), property);
|
||||
n.setType(rt);
|
||||
parseChildren(errors, src, npath, obj, n, false);
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ public class VerticalBarParser extends ParserBase {
|
|||
@Override
|
||||
public List<ValidatedFragment> parse(InputStream inStream) throws IOException, FHIRFormatError, DefinitionException, FHIRException {
|
||||
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/v2/StructureDefinition/Message");
|
||||
Element message = new Element("Message", new Property(context, sd.getSnapshot().getElementFirstRep(), sd));
|
||||
Element message = new Element("Message", new Property(context, sd.getSnapshot().getElementFirstRep(), sd, getProfileUtilities(), getContextUtilities()));
|
||||
byte[] content = TextFile.streamToBytes(inStream);
|
||||
ByteArrayInputStream stream = new ByteArrayInputStream(content);
|
||||
VerticalBarParserReader reader = new VerticalBarParserReader(new BufferedInputStream(stream), charset);
|
||||
|
|
|
@ -231,7 +231,7 @@ public class XmlParser extends ParserBase {
|
|||
if (sd == null)
|
||||
return null;
|
||||
|
||||
Element result = new Element(element.getLocalName(), new Property(context, sd.getSnapshot().getElement().get(0), sd)).setFormat(FhirFormat.XML);
|
||||
Element result = new Element(element.getLocalName(), new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities())).setFormat(FhirFormat.XML);
|
||||
result.setPath(element.getLocalName());
|
||||
checkElement(errors, element, result, path, result.getProperty(), false);
|
||||
result.markLocation(line(element, false), col(element, false));
|
||||
|
@ -321,7 +321,7 @@ public class XmlParser extends ParserBase {
|
|||
|
||||
public Element parse(List<ValidationMessage> errors, org.w3c.dom.Element base, String type) throws Exception {
|
||||
StructureDefinition sd = getDefinition(errors, 0, 0, FormatUtilities.FHIR_NS, type);
|
||||
Element result = new Element(base.getLocalName(), new Property(context, sd.getSnapshot().getElement().get(0), sd)).setFormat(FhirFormat.XML).setNativeObject(base);
|
||||
Element result = new Element(base.getLocalName(), new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities())).setFormat(FhirFormat.XML).setNativeObject(base);
|
||||
result.setPath(base.getLocalName());
|
||||
String path = "/"+pathPrefix(base.getNamespaceURI())+base.getLocalName();
|
||||
checkElement(errors, base, result, path, result.getProperty(), false);
|
||||
|
@ -662,7 +662,7 @@ public class XmlParser extends ParserBase {
|
|||
StructureDefinition sd = context.fetchResource(StructureDefinition.class, ProfileUtilities.sdNs(name, null));
|
||||
if (sd == null)
|
||||
throw new FHIRFormatError(context.formatMessage(I18nConstants.CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_, res.getLocalName()));
|
||||
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd), SpecialElement.fromProperty(parent.getProperty()), elementProperty);
|
||||
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd, getProfileUtilities(), getContextUtilities()), SpecialElement.fromProperty(parent.getProperty()), elementProperty);
|
||||
parent.setType(name);
|
||||
parseChildren(errors, res.getLocalName(), res, parent);
|
||||
}
|
||||
|
|
|
@ -3253,7 +3253,7 @@ public class FHIRPathEngine {
|
|||
return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Boolean);
|
||||
}
|
||||
case SubsetOf : {
|
||||
checkParamTypes(exp, exp.getFunction().toCode(), paramTypes, focus);
|
||||
checkParamTypes(exp, exp.getFunction().toCode(), paramTypes, focus.toUnordered());
|
||||
return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Boolean);
|
||||
}
|
||||
case SupersetOf : {
|
||||
|
|
|
@ -405,6 +405,16 @@ public class TypeDetails {
|
|||
result.types.addAll(types);
|
||||
return result;
|
||||
}
|
||||
public TypeDetails toOrdered() {
|
||||
TypeDetails result = new TypeDetails(CollectionStatus.ORDERED);
|
||||
result.types.addAll(types);
|
||||
return result;
|
||||
}
|
||||
public TypeDetails toUnordered() {
|
||||
TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED);
|
||||
result.types.addAll(types);
|
||||
return result;
|
||||
}
|
||||
public CollectionStatus getCollectionStatus() {
|
||||
return collectionStatus;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class FormatUtilities {
|
|||
}
|
||||
|
||||
public static boolean isValidId(String tail) {
|
||||
return tail.matches(ID_REGEX);
|
||||
return tail == null ? false : tail.matches(ID_REGEX);
|
||||
}
|
||||
|
||||
public static String makeId(String candidate) {
|
||||
|
|
|
@ -596,6 +596,9 @@ public abstract class CanonicalResource extends DomainResource {
|
|||
}
|
||||
|
||||
public String present() {
|
||||
if (hasUserData("presentation")) {
|
||||
return getUserString("presentation");
|
||||
}
|
||||
if (hasTitle())
|
||||
return getTitle();
|
||||
if (hasName())
|
||||
|
|
|
@ -563,7 +563,26 @@ public class Coding extends DataType implements IBaseCoding, ICompositeType, ICo
|
|||
if (hasDisplay())
|
||||
base = base+": '"+getDisplay()+"'";
|
||||
return base;
|
||||
}
|
||||
|
||||
public static Coding fromLiteral(String value) {
|
||||
String sv = value.contains("#") ? value.substring(0, value.indexOf("#")) : value;
|
||||
String cp = value.contains("#") ? value.substring(value.indexOf("#")+1) : null;
|
||||
|
||||
String system = sv.contains("|") ? sv.substring(0, sv.indexOf("|")) : sv;
|
||||
String version = sv.contains("|") ? sv.substring(sv.indexOf("|")+1) : null;
|
||||
|
||||
String code = cp != null && cp.contains("'") ? cp.substring(0, cp.indexOf("'")) : cp;
|
||||
String display = cp != null && cp.contains("'") ? cp.substring(cp.indexOf("'")+1) : null;
|
||||
if (display != null) {
|
||||
display = display.trim();
|
||||
display = display.substring(0, display.length() -1);
|
||||
}
|
||||
if ((system == null || !Utilities.isAbsoluteUrl(system)) && code == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new Coding(system, version, code, display);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean matches(Coding other) {
|
||||
|
@ -629,5 +648,9 @@ public class Coding extends DataType implements IBaseCoding, ICompositeType, ICo
|
|||
}
|
||||
// end addition
|
||||
|
||||
public String getVersionedSystem() {
|
||||
return hasVersion() ? getSystem()+"|"+getVersion() : getSystem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1777,10 +1777,24 @@ public class ConceptMap extends MetadataResource {
|
|||
|
||||
}
|
||||
|
||||
public SourceElementComponent getOrAddElement(String code) {
|
||||
for (SourceElementComponent e : getElement()) {
|
||||
if (code.equals(e.getCode())) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return addElement().setCode(code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Block()
|
||||
public static class SourceElementComponent extends BackboneElement implements IBaseBackboneElement {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SourceElementComponent [code=" + code + ", display=" + display + ", noMap=" + noMap + "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Identity (code or path) or the element/item being mapped.
|
||||
*/
|
||||
|
@ -2260,10 +2274,30 @@ public class ConceptMap extends MetadataResource {
|
|||
|
||||
}
|
||||
|
||||
public boolean hasTargetCode(String code) {
|
||||
for (TargetElementComponent tgt : getTarget()) {
|
||||
if (code.equals(tgt.getCode())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TargetElementComponent addTarget(String code, ConceptMapRelationship relationship) {
|
||||
TargetElementComponent tgt = addTarget();
|
||||
tgt.setCode(code);
|
||||
tgt.setRelationship(relationship);
|
||||
return tgt;
|
||||
}
|
||||
}
|
||||
|
||||
@Block()
|
||||
public static class TargetElementComponent extends BackboneElement implements IBaseBackboneElement {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TargetElementComponent [code=" + code + ", relationship=" + relationship + "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Identity (code or path) or the element/item that the map refers to.
|
||||
*/
|
||||
|
@ -8572,7 +8606,42 @@ public class ConceptMap extends MetadataResource {
|
|||
private String tail(String uri) {
|
||||
return uri.contains("/") ? uri.substring(uri.lastIndexOf("/")+1) : uri;
|
||||
}
|
||||
|
||||
public ConceptMapGroupComponent getGroup(String su, String tu) {
|
||||
for (ConceptMapGroupComponent g : getGroup()) {
|
||||
if (su.equals(g.getSource()) && tu.equals(g.getTarget())) {
|
||||
return g;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ConceptMapGroupComponent forceGroup(String su, String tu) {
|
||||
for (ConceptMapGroupComponent g : getGroup()) {
|
||||
if (su.equals(g.getSource()) && tu.equals(g.getTarget())) {
|
||||
return g;
|
||||
}
|
||||
}
|
||||
ConceptMapGroupComponent g = addGroup();
|
||||
g.setSource(su);
|
||||
g.setTarget(tu);
|
||||
return g;
|
||||
|
||||
}
|
||||
|
||||
public List<ConceptMapGroupComponent> getGroups(String su) {
|
||||
List<ConceptMapGroupComponent> res = new ArrayList<>();
|
||||
|
||||
for (ConceptMapGroupComponent g : getGroup()) {
|
||||
if (su.equals(g.getSource())) {
|
||||
res.add(g);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// end addition
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ package org.hl7.fhir.r5.model;
|
|||
Redistribution and use in source and binary forms, with or without modification, \
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this \
|
||||
* Redistributions of source code must retain the above copyright notice, this \
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, \
|
||||
* Redistributions in binary form must reproduce the above copyright notice, \
|
||||
this list of conditions and the following disclaimer in the documentation \
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
|
@ -27,7 +27,7 @@ package org.hl7.fhir.r5.model;
|
|||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
*/
|
||||
|
||||
// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
|
||||
|
||||
|
@ -35,6 +35,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.hl7.fhir.r5.model.Enumerations.*;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
|
@ -52,26 +53,40 @@ import ca.uhn.fhir.model.api.IElement;
|
|||
@DatatypeDef(name="DataType")
|
||||
public abstract class DataType extends Element implements IBaseDatatype, IElement {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DataType() {
|
||||
super();
|
||||
}
|
||||
public DataType() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String fhirType() {
|
||||
return "DataType";
|
||||
|
||||
}
|
||||
|
||||
public abstract DataType copy();
|
||||
public abstract DataType copy();
|
||||
|
||||
public void copyValues(DataType dst) {
|
||||
super.copyValues(dst);
|
||||
public void copyValues(DataType dst) {
|
||||
super.copyValues(dst);
|
||||
}
|
||||
|
||||
|
||||
public String getTranslation(String l) throws FHIRException {
|
||||
for (Extension e : getExtension()) {
|
||||
if (e.getUrl().equals(ToolingExtensions.EXT_TRANSLATION)) {
|
||||
String lang = ToolingExtensions.readStringExtension(e, "lang");
|
||||
if (lang.equals(l))
|
||||
return e.getExtensionString("content");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isTranslatable() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4605,6 +4605,11 @@ public boolean hasTarget() {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + ":" + expression + (severity == null ? "("+severity.asStringValue()+")" : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Block()
|
||||
|
@ -13093,6 +13098,10 @@ If a pattern[x] is declared on a repeating element, the pattern applies to all r
|
|||
return t;
|
||||
}
|
||||
|
||||
public boolean repeats() {
|
||||
return !Utilities.existsInList(getMax(), "0", "1");
|
||||
}
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
|
@ -3829,6 +3829,17 @@ public class Enumerations {
|
|||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getSymbol() {
|
||||
switch (this) {
|
||||
case RELATEDTO: return "-";
|
||||
case EQUIVALENT: return "=";
|
||||
case SOURCEISNARROWERTHANTARGET: return "<";
|
||||
case SOURCEISBROADERTHANTARGET: return ">";
|
||||
case NOTRELATEDTO: return "!=";
|
||||
case NULL: return null;
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConceptMapRelationshipEnumFactory implements EnumFactory<ConceptMapRelationship> {
|
||||
|
|
|
@ -114,15 +114,19 @@ public class ExtensionHelper {
|
|||
* @return The extension, if on this element, else null. will check modifier extensions too
|
||||
*/
|
||||
public static Extension getExtension(BackboneElement element, String name) {
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
if (name == null || element == null)
|
||||
return null;
|
||||
for (Extension e : element.getModifierExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
if (element.hasModifierExtension()) {
|
||||
for (Extension e : element.getModifierExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
}
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
if (element.hasExtension()) {
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -79,4 +79,9 @@ public class MarkdownType extends StringType implements Comparable<MarkdownType>
|
|||
return "markdown";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTranslatable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -99,15 +99,8 @@ public class StringType extends PrimitiveType<String> {
|
|||
return "string";
|
||||
}
|
||||
|
||||
public String getTranslation(String l) throws FHIRException {
|
||||
for (Extension e : getExtension()) {
|
||||
if (e.getUrl().equals(ToolingExtensions.EXT_TRANSLATION)) {
|
||||
String lang = ToolingExtensions.readStringExtension(e, "lang");
|
||||
if (lang.equals(l))
|
||||
return e.getExtensionString("content");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@Override
|
||||
public boolean isTranslatable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1499,6 +1499,34 @@ public class StructureDefinition extends CanonicalResource {
|
|||
|
||||
}
|
||||
|
||||
//added from java-adornments.txt:
|
||||
|
||||
public ElementDefinition getElementByPath(String path) {
|
||||
if (path == null) {
|
||||
return null;
|
||||
}
|
||||
for (ElementDefinition ed : getElement()) {
|
||||
if (path.equals(ed.getPath()) || (path+"[x]").equals(ed.getPath())) {
|
||||
return ed;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ElementDefinition getElementById(String id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
for (ElementDefinition ed : getElement()) {
|
||||
if (id.equals(ed.getId())) {
|
||||
return ed;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//end addition
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1150,6 +1150,15 @@ public class ValueSet extends MetadataResource {
|
|||
|
||||
}
|
||||
|
||||
public boolean hasConcept(String code) {
|
||||
for (ConceptReferenceComponent c : getConcept()) {
|
||||
if (code.equals(c.getCode())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Block()
|
||||
|
|
|
@ -33,13 +33,13 @@ public class ActorDefinitionRenderer extends ResourceRenderer {
|
|||
public boolean render(XhtmlNode x, ActorDefinition acd) throws FHIRFormatError, DefinitionException, IOException {
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx("Actor: "+acd.getName());
|
||||
tr.td().b().tx(/*!#*/"Actor: "+acd.getName());
|
||||
tr.td().tx(acd.getTitle());
|
||||
tr.td().tx("Type: " + acd.getType().toCode());
|
||||
tr.td().tx(/*!#*/"Type: " + acd.getType().toCode());
|
||||
XhtmlNode td = tbl.tr().td().colspan("3");
|
||||
addMarkdown(td, acd.getDocumentation());
|
||||
if (acd.hasReference()) {
|
||||
tbl.tr().td().tx("References:");
|
||||
tbl.tr().td().tx(/*!#*/"References:");
|
||||
td = tr.td().colspan("2");
|
||||
boolean first = true;
|
||||
for (UrlType t : acd.getReference()) {
|
||||
|
@ -48,7 +48,7 @@ public class ActorDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
if (acd.hasCapabilities()) {
|
||||
tbl.tr().td().tx("Capabilities:");
|
||||
tbl.tr().td().tx(/*!#*/"Capabilities:");
|
||||
td = tr.td().colspan("2");
|
||||
CapabilityStatement cs = context.getWorker().fetchResource(CapabilityStatement.class, acd.getCapabilities(), acd);
|
||||
if (cs != null) {
|
||||
|
@ -58,7 +58,7 @@ public class ActorDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
if (acd.hasDerivedFrom()) {
|
||||
tbl.tr().td().tx("Derived from:");
|
||||
tbl.tr().td().tx(/*!#*/"Derived from:");
|
||||
td = tr.td().colspan("2");
|
||||
boolean first = true;
|
||||
for (UrlType t : acd.getReference()) {
|
||||
|
|
|
@ -231,16 +231,16 @@ public class AdditionalBindingsRenderer {
|
|||
|
||||
XhtmlNode tr = new XhtmlNode(NodeType.Element, "tr");
|
||||
children.add(tr);
|
||||
tr.td().style("font-size: 11px").b().tx("Additional Bindings");
|
||||
tr.td().style("font-size: 11px").tx("Purpose");
|
||||
tr.td().style("font-size: 11px").b().tx(/*!#*/"Additional Bindings");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Purpose");
|
||||
if (usage) {
|
||||
tr.td().style("font-size: 11px").tx("Usage");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Usage");
|
||||
}
|
||||
if (any) {
|
||||
tr.td().style("font-size: 11px").tx("Any");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Any");
|
||||
}
|
||||
if (doco) {
|
||||
tr.td().style("font-size: 11px").tx("Documentation");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Documentation");
|
||||
}
|
||||
for (AdditionalBindingDetail binding : bindings) {
|
||||
tr = new XhtmlNode(NodeType.Element, "tr");
|
||||
|
@ -296,8 +296,8 @@ public class AdditionalBindingsRenderer {
|
|||
}
|
||||
}
|
||||
if (any) {
|
||||
String newRepeat = binding.any ? "Any repeats" : "All repeats";
|
||||
String oldRepeat = binding.compare!=null && binding.compare.any ? "Any repeats" : "All repeats";
|
||||
String newRepeat = binding.any ? /*!#*/"Any repeats" : /*!#*/"All repeats";
|
||||
String oldRepeat = binding.compare!=null && binding.compare.any ? /*!#*/"Any repeats" : /*!#*/"All repeats";
|
||||
compareString(tr.td().style("font-size: 11px"), newRepeat, oldRepeat);
|
||||
}
|
||||
if (doco) {
|
||||
|
@ -338,54 +338,54 @@ public class AdditionalBindingsRenderer {
|
|||
boolean r5 = context == null || context.getWorker() == null ? false : VersionUtilities.isR5Plus(context.getWorker().getVersion());
|
||||
switch (purpose) {
|
||||
case "maximum":
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-maximum" : corePath+"extension-elementdefinition-maxvalueset.html", "A required binding, for use when the binding strength is 'extensible' or 'preferred'").tx("Max Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-maximum" : corePath+"extension-elementdefinition-maxvalueset.html", /*!#*/"A required binding, for use when the binding strength is 'extensible' or 'preferred'").tx(/*!#*/"Max Binding");
|
||||
break;
|
||||
case "minimum":
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-minimum" : corePath+"extension-elementdefinition-minvalueset.html", "The minimum allowable value set - any conformant system SHALL support all these codes").tx("Min Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-minimum" : corePath+"extension-elementdefinition-minvalueset.html", /*!#*/"The minimum allowable value set - any conformant system SHALL support all these codes").tx(/*!#*/"Min Binding");
|
||||
break;
|
||||
case "required" :
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-required" : corePath+"terminologies.html#strength", "Validators will check this binding (strength = required)").tx("Required Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-required" : corePath+"terminologies.html#strength", /*!#*/"Validators will check this binding (strength = required)").tx(/*!#*/"Required Binding");
|
||||
break;
|
||||
case "extensible" :
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-extensible" : corePath+"terminologies.html#strength", "Validators will check this binding (strength = extensible)").tx("Extensible Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-extensible" : corePath+"terminologies.html#strength", /*!#*/"Validators will check this binding (strength = extensible)").tx(/*!#*/"Extensible Binding");
|
||||
break;
|
||||
case "current" :
|
||||
if (r5) {
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-current" : corePath+"terminologies.html#strength", "New records are required to use this value set, but legacy records may use other codes").tx("Current Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-current" : corePath+"terminologies.html#strength", /*!#*/"New records are required to use this value set, but legacy records may use other codes").tx(/*!#*/"Current Binding");
|
||||
} else {
|
||||
td.span(null, "New records are required to use this value set, but legacy records may use other codes").tx("Required");
|
||||
td.span(null, /*!#*/"New records are required to use this value set, but legacy records may use other codes").tx(/*!#*/"Required");
|
||||
}
|
||||
break;
|
||||
case "preferred" :
|
||||
if (r5) {
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-preferred" : corePath+"terminologies.html#strength", "This is the value set that is recommended (documentation should explain why)").tx("Preferred Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-preferred" : corePath+"terminologies.html#strength", /*!#*/"This is the value set that is recommended (documentation should explain why)").tx(/*!#*/"Preferred Binding");
|
||||
} else {
|
||||
td.span(null, "This is the value set that is recommended (documentation should explain why)").tx("Recommended");
|
||||
td.span(null, /*!#*/"This is the value set that is recommended (documentation should explain why)").tx(/*!#*/"Recommended");
|
||||
}
|
||||
break;
|
||||
case "ui" :
|
||||
if (r5) {
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-ui" : corePath+"terminologies.html#strength", "This value set is provided to user look up in a given context").tx("UI Binding");
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-ui" : corePath+"terminologies.html#strength", /*!#*/"This value set is provided to user look up in a given context").tx(/*!#*/"UI Binding");
|
||||
} else {
|
||||
td.span(null, "This value set is provided to user look up in a given context").tx("UI");
|
||||
td.span(null, /*!#*/"This value set is provided to user look up in a given context").tx(/*!#*/"UI");
|
||||
}
|
||||
break;
|
||||
case "starter" :
|
||||
if (r5) {
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-starter" : corePath+"terminologies.html#strength", "This value set is a good set of codes to start with when designing your system").tx("Starter Set");
|
||||
} else {
|
||||
td.span(null, "This value set is a good set of codes to start with when designing your system").tx("Starter");
|
||||
td.span(null, /*!#*/"This value set is a good set of codes to start with when designing your system").tx(/*!#*/"Starter");
|
||||
}
|
||||
break;
|
||||
case "component" :
|
||||
if (r5) {
|
||||
td.ah(r5 ? corePath+"valueset-additional-binding-purpose.html#additional-binding-purpose-component" : corePath+"terminologies.html#strength", "This value set is a component of the base value set").tx("Component");
|
||||
} else {
|
||||
td.span(null, "This value set is a component of the base value set").tx("Component");
|
||||
td.span(null, /*!#*/"This value set is a component of the base value set").tx(/*!#*/"Component");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
td.span(null, "Unknown code for purpose").tx(purpose);
|
||||
td.span(null, /*!#*/"Unknown code for purpose").tx(purpose);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ public class AdditionalBindingsRenderer {
|
|||
children.tx(" (");
|
||||
boolean ffirst = !b.getAny();
|
||||
if (b.getAny()) {
|
||||
children.tx("any repeat");
|
||||
children.tx(/*!#*/"any repeat");
|
||||
}
|
||||
for (UsageContext uc : b.getUsage()) {
|
||||
if (ffirst) ffirst = false; else children.tx(",");
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BinaryRenderer {
|
|||
public void render(XhtmlNode x, Binary bin) throws IOException {
|
||||
filenames.clear();
|
||||
if (!bin.hasContentType()) {
|
||||
error(x, "No Content Type");
|
||||
error(x, /*!#*/"No Content Type");
|
||||
} else if (bin.getContentType().startsWith("image/")) {
|
||||
image(x, bin);
|
||||
} else if (isXml(bin.getContentType())) {
|
||||
|
@ -75,7 +75,7 @@ public class BinaryRenderer {
|
|||
}
|
||||
|
||||
if (ext == null) {
|
||||
error(x, "The Image Type '"+bin.getContentType()+"' is not rendered in this context");
|
||||
error(x, /*!#*/"The Image Type '"+bin.getContentType()+"' is not rendered in this context");
|
||||
} else {
|
||||
String fn = "Binary-Native-"+bin.getId()+ext;
|
||||
TextFile.bytesToFile(bin.getContent(), Utilities.path(folder, fn));
|
||||
|
|
|
@ -62,13 +62,13 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
List<BaseWrapper> entries = b.children("entry");
|
||||
if ("document".equals(b.get("type").primitiveValue())) {
|
||||
if (entries.isEmpty() || (entries.get(0).has("resource") && !"Composition".equals(entries.get(0).get("resource").fhirType())))
|
||||
throw new FHIRException("Invalid document '"+b.getId()+"' - first entry is not a Composition ('"+entries.get(0).get("resource").fhirType()+"')");
|
||||
throw new FHIRException(/*!#*/"Invalid document '"+b.getId()+"' - first entry is not a Composition ('"+entries.get(0).get("resource").fhirType()+"')");
|
||||
return renderDocument(x, b, entries);
|
||||
} else if ("collection".equals(b.get("type").primitiveValue()) && allEntriesAreHistoryProvenance(entries)) {
|
||||
// nothing
|
||||
} else {
|
||||
XhtmlNode root = new XhtmlNode(NodeType.Element, "div");
|
||||
root.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.get("type").primitiveValue()));
|
||||
root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.get("type").primitiveValue()));
|
||||
int i = 0;
|
||||
for (BaseWrapper be : entries) {
|
||||
i++;
|
||||
|
@ -85,9 +85,9 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
}
|
||||
root.hr();
|
||||
if (be.has("fullUrl")) {
|
||||
root.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.get("fullUrl").primitiveValue()));
|
||||
root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.get("fullUrl").primitiveValue()));
|
||||
} else {
|
||||
root.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i)));
|
||||
root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i)));
|
||||
}
|
||||
// if (be.hasRequest())
|
||||
// renderRequest(root, be.getRequest());
|
||||
|
@ -96,7 +96,7 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
// if (be.hasResponse())
|
||||
// renderResponse(root, be.getResponse());
|
||||
if (be.has("resource")) {
|
||||
root.para().addText(formatMessage(RENDER_BUNDLE_RESOURCE, be.get("resource").fhirType()));
|
||||
root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_RESOURCE, be.get("resource").fhirType()));
|
||||
ResourceWrapper rw = be.getChildByName("resource").getAsResource();
|
||||
XhtmlNode xn = rw.getNarrative();
|
||||
if (xn == null || xn.isEmpty()) {
|
||||
|
@ -106,7 +106,7 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
xn = rr.render(rw);
|
||||
} catch (Exception e) {
|
||||
xn = new XhtmlNode();
|
||||
xn.para().b().tx("Exception generating narrative: "+e.getMessage());
|
||||
xn.para().b().tx(/*!#*/"Exception generating narrative: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
root.blockquote().para().addChildren(xn);
|
||||
|
@ -280,15 +280,15 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
|
||||
if (b.getType() == BundleType.DOCUMENT) {
|
||||
if (!b.hasEntry() || !(b.getEntryFirstRep().hasResource() && b.getEntryFirstRep().getResource() instanceof Composition)) {
|
||||
throw new FHIRException("Invalid document - first entry is not a Composition");
|
||||
throw new FHIRException(/*!#*/"Invalid document - first entry is not a Composition");
|
||||
}
|
||||
renderDocument(x, b);
|
||||
start = 1;
|
||||
docMode = true;
|
||||
x.hr();
|
||||
x.h2().addText(formatMessage(RENDER_BUNDLE_DOCUMENT_CONTENT, b.getId(), b.getType().toCode()));
|
||||
x.h2().addText(formatMessage(RenderingContext.RENDER_BUNDLE_DOCUMENT_CONTENT, b.getId(), b.getType().toCode()));
|
||||
} else {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.getType().toCode()));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.getType().toCode()));
|
||||
}
|
||||
int i = 0;
|
||||
for (BundleEntryComponent be : b.getEntry()) {
|
||||
|
@ -307,17 +307,17 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
x.hr();
|
||||
if (docMode) {
|
||||
if (be.hasFullUrl() && be.hasResource()) {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_DOC_ENTRY_URD, Integer.toString(i), be.getFullUrl(), be.getResource().fhirType(), be.getResource().getIdBase()));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_DOC_ENTRY_URD, Integer.toString(i), be.getFullUrl(), be.getResource().fhirType(), be.getResource().getIdBase()));
|
||||
} else if (be.hasFullUrl()) {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_DOC_ENTRY_U, Integer.toString(i), be.getFullUrl()));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_DOC_ENTRY_U, Integer.toString(i), be.getFullUrl()));
|
||||
} else if (be.hasResource()) {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_DOC_ENTRY_RD, Integer.toString(i), be.getResource().fhirType(), be.getResource().getIdBase()));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_DOC_ENTRY_RD, Integer.toString(i), be.getResource().fhirType(), be.getResource().getIdBase()));
|
||||
}
|
||||
} else {
|
||||
if (be.hasFullUrl()) {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.getFullUrl()));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.getFullUrl()));
|
||||
} else {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i)));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i)));
|
||||
}
|
||||
if (be.hasRequest())
|
||||
renderRequest(x, be.getRequest());
|
||||
|
@ -328,7 +328,7 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (be.hasResource()) {
|
||||
if (!docMode) {
|
||||
x.para().addText(formatMessage(RENDER_BUNDLE_RESOURCE, be.getResource().fhirType()));
|
||||
x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_RESOURCE, be.getResource().fhirType()));
|
||||
}
|
||||
if (be.hasResource()) {
|
||||
XhtmlNode xn = null;
|
||||
|
@ -342,7 +342,7 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
rr.setRcontext(new ResourceContext(rcontext, be.getResource()));
|
||||
xn = rr.build(be.getResource());
|
||||
} catch (Exception e) {
|
||||
xn = makeExceptionXhtml(e, "generating narrative");
|
||||
xn = makeExceptionXhtml(e, /*!#*/"generating narrative");
|
||||
}
|
||||
}
|
||||
x.blockquote().para().getChildNodes().addAll(checkInternalLinks(b, xn.getChildNodes()));
|
||||
|
@ -401,42 +401,42 @@ public class BundleRenderer extends ResourceRenderer {
|
|||
|
||||
private void renderSearch(XhtmlNode root, BundleEntrySearchComponent search) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(formatMessage(RENDER_BUNDLE_SEARCH));
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_SEARCH));
|
||||
if (search.hasMode())
|
||||
b.append(formatMessage(RENDER_BUNDLE_SEARCH_MODE, search.getMode().toCode()));
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_SEARCH_MODE, search.getMode().toCode()));
|
||||
if (search.hasScore()) {
|
||||
if (search.hasMode())
|
||||
b.append(",");
|
||||
b.append(formatMessage(RENDER_BUNDLE_SEARCH_SCORE, search.getScore()));
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_SEARCH_SCORE, search.getScore()));
|
||||
}
|
||||
root.para().addText(b.toString());
|
||||
}
|
||||
|
||||
private void renderResponse(XhtmlNode root, BundleEntryResponseComponent response) {
|
||||
root.para().addText(formatMessage(RENDER_BUNDLE_RESPONSE));
|
||||
root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_RESPONSE));
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(response.getStatus()+"\r\n");
|
||||
if (response.hasLocation())
|
||||
b.append(formatMessage(RENDER_BUNDLE_LOCATION, response.getLocation())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_LOCATION, response.getLocation())+"\r\n");
|
||||
if (response.hasEtag())
|
||||
b.append(formatMessage(RENDER_BUNDLE_ETAG, response.getEtag())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_ETAG, response.getEtag())+"\r\n");
|
||||
if (response.hasLastModified())
|
||||
b.append(formatMessage(RENDER_BUNDLE_LAST_MOD, response.getEtag())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_LAST_MOD, response.getEtag())+"\r\n");
|
||||
root.pre().addText(b.toString());
|
||||
}
|
||||
|
||||
private void renderRequest(XhtmlNode root, BundleEntryRequestComponent request) {
|
||||
root.para().addText(formatMessage(RENDER_BUNDLE_REQUEST));
|
||||
root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_REQUEST));
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(request.getMethod()+" "+request.getUrl()+"\r\n");
|
||||
if (request.hasIfNoneMatch())
|
||||
b.append(formatMessage(RENDER_BUNDLE_IF_NON_MATCH, request.getIfNoneMatch())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_NON_MATCH, request.getIfNoneMatch())+"\r\n");
|
||||
if (request.hasIfModifiedSince())
|
||||
b.append(formatMessage(RENDER_BUNDLE_IF_MOD, request.getIfModifiedSince())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_MOD, request.getIfModifiedSince())+"\r\n");
|
||||
if (request.hasIfMatch())
|
||||
b.append(formatMessage(RENDER_BUNDLE_IF_MATCH, request.getIfMatch())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_MATCH, request.getIfMatch())+"\r\n");
|
||||
if (request.hasIfNoneExist())
|
||||
b.append(formatMessage(RENDER_BUNDLE_IF_NONE, request.getIfNoneExist())+"\r\n");
|
||||
b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_NONE, request.getIfNoneExist())+"\r\n");
|
||||
root.pre().addText(b.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -700,26 +700,26 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
private void addSummaryTable(XhtmlNode x, CapabilityStatement.CapabilityStatementRestComponent rest, boolean hasVRead, boolean hasPatch, boolean hasDelete, boolean hasHistory, boolean hasUpdates, int count) throws IOException {
|
||||
XhtmlNode t = x.div().attribute("class","table-responsive").table("table table-condensed table-hover");
|
||||
XhtmlNode tr = t.addTag("thead").tr();
|
||||
tr.th().b().tx("Resource Type");
|
||||
tr.th().b().tx("Profile");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "GET a resource (read interaction)").tx("R");
|
||||
tr.th().b().tx(/*!#*/"Resource Type");
|
||||
tr.th().b().tx(/*!#*/"Profile");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"GET a resource (read interaction)").tx("R");
|
||||
if (hasVRead)
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "GET past versions of resources (vread interaction)").tx("V-R");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "GET all set of resources of the type (search interaction)").tx("S");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "PUT a new resource version (update interaction)").tx("U");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"GET past versions of resources (vread interaction)").tx("V-R");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"GET all set of resources of the type (search interaction)").tx("S");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"PUT a new resource version (update interaction)").tx("U");
|
||||
if (hasPatch)
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "PATCH a new resource version (patch interaction)").tx("P");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "POST a new resource (create interaction)").tx("C");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"PATCH a new resource version (patch interaction)").tx("P");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"POST a new resource (create interaction)").tx("C");
|
||||
if (hasDelete)
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "DELETE a resource (delete interaction)").tx("D");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"DELETE a resource (delete interaction)").tx("D");
|
||||
if (hasUpdates)
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "GET changes to a resource (history interaction on instance)").tx("H-I");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"GET changes to a resource (history interaction on instance)").tx("H-I");
|
||||
if (hasHistory)
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", "GET changes for all resources of the type (history interaction on type)").tx("H-T");
|
||||
tr.th().b().attribute("title", "Required and recommended search parameters").tx("Searches");
|
||||
tr.th().attribute("class", "text-center").b().attribute("title", /*!#*/"GET changes for all resources of the type (history interaction on type)").tx("H-T");
|
||||
tr.th().b().attribute("title", /*!#*/"Required and recommended search parameters").tx(/*!#*/"Searches");
|
||||
tr.th().code().b().tx("_include");
|
||||
tr.th().code().b().tx("_revinclude");
|
||||
tr.th().b().tx("Operations");
|
||||
tr.th().b().tx(/*!#*/"Operations");
|
||||
|
||||
XhtmlNode tbody = t.addTag("tbody");
|
||||
XhtmlNode profCell = null;
|
||||
|
@ -744,12 +744,12 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
//profCell.ah(r.getProfile()).addText(r.getProfile());
|
||||
if (hasSupProf) {
|
||||
profCell.br();
|
||||
profCell.addTag("em").addText("Additional supported profiles:");
|
||||
profCell.addTag("em").addText(/*!#*/"Additional supported profiles:");
|
||||
renderSupportedProfiles(profCell, r);
|
||||
}
|
||||
}
|
||||
else { //Case of only supported profiles
|
||||
profCell.addText("Supported profiles:");
|
||||
profCell.addText(/*!#*/"Supported profiles:");
|
||||
renderSupportedProfiles(profCell, r);
|
||||
}
|
||||
//Show capabilities
|
||||
|
@ -809,17 +809,17 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (r.hasExtension(ToolingExtensions.EXT_PROFILE_MAPPING)) {
|
||||
profCell.br();
|
||||
profCell.b().tx("Profile Mapping");
|
||||
profCell.b().tx(/*!#*/"Profile Mapping");
|
||||
XhtmlNode tbl = profCell.table("grid");
|
||||
boolean doco = false;
|
||||
for (Extension ext : r.getExtensionsByUrl(ToolingExtensions.EXT_PROFILE_MAPPING)) {
|
||||
doco = doco || ext.hasExtension("documentation");
|
||||
}
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.th().tx("Criteria");
|
||||
tr.th().tx("Profile");
|
||||
tr.th().tx(/*!#*/"Criteria");
|
||||
tr.th().tx(/*!#*/"Profile");
|
||||
if (doco) {
|
||||
tr.th().tx("Criteria");
|
||||
tr.th().tx(/*!#*/"Criteria");
|
||||
}
|
||||
for (Extension ext : r.getExtensionsByUrl(ToolingExtensions.EXT_PROFILE_MAPPING)) {
|
||||
tr = tbl.tr();
|
||||
|
@ -936,7 +936,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
}
|
||||
else {
|
||||
panelHead = panel.div().attribute("class", "panel-heading").h(nextLevel,r.getType() + countString).attribute("class", "panel-title");
|
||||
panelHead.span("float: right;","").addText("Resource Conformance: " + getResourceExpectation(r));
|
||||
panelHead.span("float: right;","").addText(/*!#*/"Resource Conformance: " + getResourceExpectation(r));
|
||||
panelHead.addText(r.getType());
|
||||
body = panel.div().attribute("class", "panel-body").div().attribute("class", "container");
|
||||
}
|
||||
|
@ -950,17 +950,17 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
String refPolicyWidth = "col-lg-3";
|
||||
if (!Utilities.noString(text)) {
|
||||
cell = row.div().attribute("class", "col-lg-6");
|
||||
addLead(cell,"Base System Profile");
|
||||
addLead(cell,/*!#*/"Base System Profile");
|
||||
cell.br();
|
||||
addResourceLink(cell, text, text);
|
||||
cell=row.div().attribute("class", "col-lg-3");
|
||||
addLead(cell, "Profile Conformance");
|
||||
addLead(cell, /*!#*/"Profile Conformance");
|
||||
cell.br();
|
||||
cell.b().addText(getProfileExpectation(r.getProfileElement()));
|
||||
}
|
||||
else { //No profile, use FHIR Core Resource
|
||||
cell = row.div().attribute("class", "col-lg-4");
|
||||
addLead(cell,"Core FHIR Resource");
|
||||
addLead(cell,/*!#*/"Core FHIR Resource");
|
||||
cell.br();
|
||||
cell.ah(currentFhirBase + r.getType().toLowerCase() + ".html").addText(r.getType());
|
||||
pullInteraction = true;
|
||||
|
@ -968,7 +968,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
cell = row.div().attribute("class", refPolicyWidth);
|
||||
addLead(cell,"Reference Policy");
|
||||
addLead(cell,/*!#*/"Reference Policy");
|
||||
cell.br();
|
||||
addSeparatedListOfCodes(cell, getReferencePolicyStrings(r.getReferencePolicy()) , ",");
|
||||
if (pullInteraction) {
|
||||
|
@ -979,7 +979,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
if (supportedProfiles.size() > 0) {
|
||||
row = body.div().attribute("class", "row");
|
||||
cell = row.div().attribute("class", "col-6");
|
||||
addLead(cell,"Supported Profiles");
|
||||
addLead(cell,/*!#*/"Supported Profiles");
|
||||
XhtmlNode para = cell.para();
|
||||
boolean first = true;
|
||||
for (CanonicalType c : supportedProfiles) {
|
||||
|
@ -1004,7 +1004,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
if (!Utilities.noString(mdText)) {
|
||||
row = body.div().attribute("class", "row");
|
||||
cell = row.div().attribute("class", "col-12");
|
||||
addLead(cell,"Documentation");
|
||||
addLead(cell,/*!#*/"Documentation");
|
||||
addMarkdown(cell.blockquote(), mdText);
|
||||
}
|
||||
|
||||
|
@ -1028,12 +1028,12 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
XhtmlNode tr;
|
||||
row = body.div().attribute("class", "row");
|
||||
cell = row.div().attribute("class", "col-12");
|
||||
addLead(cell,"Extended Operations");
|
||||
addLead(cell,/*!#*/"Extended Operations");
|
||||
table = cell.table("table table-condensed table-hover");
|
||||
tr = table.addTag("thead").tr();
|
||||
tr.th().addText("Conformance");
|
||||
tr.th().addText("Operation");
|
||||
tr.th().addText("Documentation");
|
||||
tr.th().addText(/*!#*/"Conformance");
|
||||
tr.th().addText(/*!#*/"Operation");
|
||||
tr.th().addText(/*!#*/"Documentation");
|
||||
tbody = table.addTag("tbody");
|
||||
addOps(tbody, map, "supported");
|
||||
addOps(tbody, map, "SHALL");
|
||||
|
@ -1089,7 +1089,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
XhtmlNode cell = row.div().attribute("class", widthString);
|
||||
addLead(cell, "Interaction summary");
|
||||
addLead(cell, /*!#*/"Interaction summary");
|
||||
cell.br();
|
||||
XhtmlNode ul = cell.ul();
|
||||
addInteractionSummaryList(ul, "SHALL", shalls);
|
||||
|
@ -1154,13 +1154,13 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
XhtmlNode tr;
|
||||
row = body.div().attribute("class", "row");
|
||||
cell = row.div().attribute("class", "col-lg-7");
|
||||
addLead(cell,"Search Parameters");
|
||||
addLead(cell,/*!#*/"Search Parameters");
|
||||
table = cell.table("table table-condensed table-hover");
|
||||
tr = table.addTag("thead").tr();
|
||||
tr.th().addText("Conformance");
|
||||
tr.th().addText("Parameter");
|
||||
tr.th().addText("Type");
|
||||
tr.th().addText("Documentation");
|
||||
tr.th().addText(/*!#*/"Conformance");
|
||||
tr.th().addText(/*!#*/"Parameter");
|
||||
tr.th().addText(/*!#*/"Type");
|
||||
tr.th().addText(/*!#*/"Documentation");
|
||||
tbody = table.addTag("tbody");
|
||||
Map<String,List<SingleParam>> map = sParams.getIndbyExp();
|
||||
addIndRows(tbody, map, "supported");
|
||||
|
@ -1170,12 +1170,12 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
|
|||
addIndRows(tbody, map, "SHOULD-NOT");
|
||||
cell = row.div().attribute("class", "col-lg-5");
|
||||
if (!isCombinedEmpty(comboMap)) {
|
||||
addLead(cell,"Combined Search Parameters");
|
||||
addLead(cell,/*!#*/"Combined Search Parameters");
|
||||
table = cell.table("table table-condensed table-hover");
|
||||
tr = table.addTag("thead").tr();
|
||||
tr.th().addText("Conformance");
|
||||
tr.th().addText("Parameters");
|
||||
tr.th().addText("Types");
|
||||
tr.th().addText(/*!#*/"Conformance");
|
||||
tr.th().addText(/*!#*/"Parameters");
|
||||
tr.th().addText(/*!#*/"Types");
|
||||
tbody = table.addTag("tbody");
|
||||
addComboRows(tbody, comboMap, "supported");
|
||||
addComboRows(tbody, comboMap, "SHALL");
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.comparison.VersionComparisonAnnotation;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.Enumerations.CodeSystemContentMode;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent;
|
||||
|
@ -81,13 +82,13 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
|
||||
private void generateFilters(XhtmlNode x, CodeSystem cs) {
|
||||
if (cs.hasFilter()) {
|
||||
x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Filters", getContext().getLang()));
|
||||
x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTERS));
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Code", getContext().getLang()));
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Description", getContext().getLang()));
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "operator", getContext().getLang()));
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Value", getContext().getLang()));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_CODE));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_DESC));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_OP));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_VALUE));
|
||||
for (CodeSystemFilterComponent f : cs.getFilter()) {
|
||||
tr = tbl.tr();
|
||||
renderStatus(f, tr.td()).tx(f.getCode());
|
||||
|
@ -111,20 +112,20 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
hasDescription = hasDescription || p.hasDescription();
|
||||
}
|
||||
|
||||
x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Properties", getContext().getLang()));
|
||||
x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "This code system defines the following properties for its concepts", getContext().getLang()));
|
||||
x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROPS));
|
||||
x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROPS_DESC));
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
if (hasRendered) {
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Name", getContext().getLang()));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_NAME));
|
||||
}
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Code", getContext().getLang()));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_CODE));
|
||||
if (hasURI) {
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "URI", getContext().getLang()));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_URI));
|
||||
}
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Type", getContext().getLang()));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_TYPE));
|
||||
if (hasDescription) {
|
||||
tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Description", getContext().getLang()));
|
||||
tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_DESC));
|
||||
}
|
||||
for (PropertyComponent p : cs.getProperty()) {
|
||||
tr = tbl.tr();
|
||||
|
@ -148,32 +149,32 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
|
||||
private String sentenceForContent(CodeSystemContentMode mode, CodeSystem cs) {
|
||||
switch (mode) {
|
||||
case COMPLETE: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_COMPLETE);
|
||||
case EXAMPLE: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_EXAMPLE);
|
||||
case FRAGMENT: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_FRAGMENT);
|
||||
case NOTPRESENT: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_NOTPRESENT);
|
||||
case COMPLETE: return formatMessage(I18nConstants.RND_CS_CONTENT_COMPLETE);
|
||||
case EXAMPLE: return formatMessage(I18nConstants.RND_CS_CONTENT_EXAMPLE);
|
||||
case FRAGMENT: return formatMessage(I18nConstants.RND_CS_CONTENT_FRAGMENT);
|
||||
case NOTPRESENT: return formatMessage(I18nConstants.RND_CS_CONTENT_NOTPRESENT);
|
||||
case SUPPLEMENT:
|
||||
boolean properties = CodeSystemUtilities.hasProperties(cs);
|
||||
boolean designations = CodeSystemUtilities.hasDesignations(cs);
|
||||
String features;
|
||||
if (properties && designations) {
|
||||
features = "displays and properties";
|
||||
features = /*!#*/"displays and properties";
|
||||
} else if (properties) {
|
||||
features = "properties";
|
||||
features = /*!#*/"properties";
|
||||
} else if (designations) {
|
||||
features = "displays";
|
||||
features = /*!#*/"displays";
|
||||
} else {
|
||||
features = "features"; // ?
|
||||
features = /*!#*/"features"; // ?
|
||||
}
|
||||
return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_SUPPLEMENT, features);
|
||||
return formatMessage(I18nConstants.RND_CS_CONTENT_SUPPLEMENT, features);
|
||||
default:
|
||||
throw new FHIRException("Unknown CodeSystemContentMode mode");
|
||||
throw new FHIRException(/*!#*/"Unknown CodeSystemContentMode mode");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean generateCodeSystemContent(XhtmlNode x, CodeSystem cs, boolean hasExtensions, List<UsedConceptMap> maps, boolean props) throws FHIRFormatError, DefinitionException, IOException {
|
||||
if (props) {
|
||||
x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Concepts", getContext().getLang()));
|
||||
x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_CONCEPTS));
|
||||
}
|
||||
XhtmlNode p = x.para();
|
||||
renderStatus(cs.getUrlElement(), p.param("cs")).code().tx(cs.getUrl());
|
||||
|
@ -233,10 +234,10 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (langs.size() >= 2) {
|
||||
Collections.sort(langs);
|
||||
x.para().b().tx("Additional Language Displays");
|
||||
x.para().b().tx(/*!#*/"Additional Language Displays");
|
||||
t = x.table("codes");
|
||||
XhtmlNode tr = t.tr();
|
||||
tr.td().b().tx("Code");
|
||||
tr.td().b().tx(/*!#*/"Code");
|
||||
for (String lang : langs)
|
||||
tr.td().b().addText(describeLang(lang));
|
||||
for (ConceptDefinitionComponent c : cs.getConcept()) {
|
||||
|
@ -249,11 +250,11 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
private void makeHierarchyParam(XhtmlNode x, CodeSystem cs, Enumeration<CodeSystemHierarchyMeaning> hm) {
|
||||
if (hm.hasValue()) {
|
||||
String s = hm.getValue().getDisplay();
|
||||
renderStatus(hm, x).tx(" in a "+s+" heirarchy");
|
||||
renderStatus(hm, x).tx(" "+/*!#*/"in a "+s+" heirarchy");
|
||||
} else if (VersionComparisonAnnotation.hasDeleted(cs, "hierarchyMeaning")) {
|
||||
makeHierarchyParam(x, null, (Enumeration<CodeSystemHierarchyMeaning>) VersionComparisonAnnotation.getDeleted(cs, "hierarchyMeaning").get(0));
|
||||
} else if (CodeSystemUtilities.hasHierarchy(cs)) {
|
||||
x.tx(" in an undefined heirarchy");
|
||||
x.tx(" "+/*!#*/"in an undefined heirarchy");
|
||||
} else {
|
||||
x.tx("");
|
||||
}
|
||||
|
@ -284,7 +285,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
|
||||
private void addCopyColumn(XhtmlNode tr) {
|
||||
if (context.isCopyButton()) {
|
||||
tr.td().b().tx("Copy");
|
||||
tr.td().b().tx(/*!#*/"Copy");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -462,11 +463,11 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
td = tr.td();
|
||||
Boolean b = CodeSystemUtilities.isDeprecated(cs, c, false);
|
||||
if (b != null && b) {
|
||||
smartAddText(td, getContext().getWorker().translator().translate("xhtml-gen-cs", "Deprecated", getContext().getLang()));
|
||||
smartAddText(td, formatMessage(RenderingContext.RENDER_CODESYSTEM_DEPRECATED));
|
||||
hasExtensions = true;
|
||||
if (ToolingExtensions.hasExtension(c, ToolingExtensions.EXT_REPLACED_BY)) {
|
||||
Coding cc = (Coding) ToolingExtensions.getExtension(c, ToolingExtensions.EXT_REPLACED_BY).getValue();
|
||||
td.tx(" (replaced by ");
|
||||
td.tx(" "+/*!#*/"(replaced by ");
|
||||
String url = getCodingReference(cc, system);
|
||||
if (url != null) {
|
||||
td.ah(url).addText(cc.getCode());
|
||||
|
@ -539,8 +540,15 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
if (first) first = false; else td.addText(", ");
|
||||
if (pcv.hasValueCoding()) {
|
||||
td.addText(pcv.getValueCoding().getCode());
|
||||
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) {
|
||||
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
|
||||
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrl(pcv.getValue().primitiveValue())) {
|
||||
CanonicalResource cr = (CanonicalResource) context.getContext().fetchResource(Resource.class, pcv.getValue().primitiveValue());
|
||||
if (cr != null) {
|
||||
td.ah(cr.getWebPath(), cr.getVersionedUrl()).tx(cr.present());
|
||||
} else if (Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) {
|
||||
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
|
||||
} else {
|
||||
td.code(pcv.getValue().primitiveValue());
|
||||
}
|
||||
} else if ("parent".equals(pcv.getCode())) {
|
||||
td.ah("#"+cs.getId()+"-"+Utilities.nmtokenize(pcv.getValue().primitiveValue())).addText(pcv.getValue().primitiveValue());
|
||||
} else {
|
||||
|
@ -598,9 +606,9 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (context.isCopyButton()) {
|
||||
td = tr.td();
|
||||
clipboard(td, "icon_clipboard_x.png", "XML", "<system value=\""+Utilities.escapeXml(cs.getUrl())+"\">\n"+(cs.getVersionNeeded() ? "<version value=\""+Utilities.escapeXml(cs.getVersion())+"\">\n" : "")+"<code value=\""+Utilities.escapeXml(c.getCode())+"\">\n<display value=\""+Utilities.escapeXml(c.getDisplay())+"\">\n");
|
||||
clipboard(td, "icon_clipboard_x.png", /*!#*/"XML", "<system value=\""+Utilities.escapeXml(cs.getUrl())+"\">\n"+(cs.getVersionNeeded() ? "<version value=\""+Utilities.escapeXml(cs.getVersion())+"\">\n" : "")+"<code value=\""+Utilities.escapeXml(c.getCode())+"\">\n<display value=\""+Utilities.escapeXml(c.getDisplay())+"\">\n");
|
||||
td.nbsp();
|
||||
clipboard(td, "icon_clipboard_j.png", "JSON", "\"system\" : \""+Utilities.escapeXml(cs.getUrl())+"\",\n"+(cs.getVersionNeeded() ? "\"version\" : \""+Utilities.escapeXml(cs.getVersion())+"\",\n" : "")+"\"code\" : \""+Utilities.escapeXml(c.getCode())+"\",\n\"display\" : \""+Utilities.escapeXml(c.getDisplay())+"\"\n");
|
||||
clipboard(td, "icon_clipboard_j.png", /*!#*/"JSON", "\"system\" : \""+Utilities.escapeXml(cs.getUrl())+"\",\n"+(cs.getVersionNeeded() ? "\"version\" : \""+Utilities.escapeXml(cs.getVersion())+"\",\n" : "")+"\"code\" : \""+Utilities.escapeXml(c.getCode())+"\",\n\"display\" : \""+Utilities.escapeXml(c.getDisplay())+"\"\n");
|
||||
}
|
||||
return hasExtensions;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.hl7.fhir.r5.renderers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -9,8 +12,10 @@ import java.util.Map;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.ConceptMap;
|
||||
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent;
|
||||
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode;
|
||||
import org.hl7.fhir.r5.model.ConceptMap.MappingPropertyComponent;
|
||||
import org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent;
|
||||
import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent;
|
||||
|
@ -22,11 +27,255 @@ import org.hl7.fhir.r5.model.Resource;
|
|||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public class ConceptMapRenderer extends TerminologyRenderer {
|
||||
|
||||
public enum RenderMultiRowSortPolicy {
|
||||
UNSORTED, FIRST_COL, LAST_COL
|
||||
|
||||
}
|
||||
|
||||
public interface IMultiMapRendererAdvisor {
|
||||
public List<Coding> getMembers(String uri);
|
||||
public boolean describeMap(ConceptMap map, XhtmlNode x);
|
||||
public String getLink(String system, String code);
|
||||
}
|
||||
|
||||
public static class MultipleMappingRowSorter implements Comparator<MultipleMappingRow> {
|
||||
|
||||
private boolean first;
|
||||
|
||||
protected MultipleMappingRowSorter(boolean first) {
|
||||
super();
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(MultipleMappingRow o1, MultipleMappingRow o2) {
|
||||
String s1 = first ? o1.firstCode() : o1.lastCode();
|
||||
String s2 = first ? o2.firstCode() : o2.lastCode();
|
||||
return s1.compareTo(s2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Cell {
|
||||
|
||||
private String system;
|
||||
private String code;
|
||||
private String display;
|
||||
private String relationship;
|
||||
private String relComment;
|
||||
public boolean renderedRel;
|
||||
public boolean renderedCode;
|
||||
private Cell clone;
|
||||
|
||||
protected Cell() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Cell(String system, String code, String display) {
|
||||
this.system = system;
|
||||
this.code = code;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Cell(String system, String code, String relationship, String comment) {
|
||||
this.system = system;
|
||||
this.code = code;
|
||||
this.relationship = relationship;
|
||||
this.relComment = comment;
|
||||
}
|
||||
|
||||
public boolean matches(String system, String code) {
|
||||
return (system != null && system.equals(this.system)) && (code != null && code.equals(this.code));
|
||||
}
|
||||
|
||||
public String present() {
|
||||
if (system == null) {
|
||||
return code;
|
||||
} else {
|
||||
return code; //+(clone == null ? "" : " (@"+clone.code+")");
|
||||
}
|
||||
}
|
||||
|
||||
public Cell copy(boolean clone) {
|
||||
Cell res = new Cell();
|
||||
res.system = system;
|
||||
res.code = code;
|
||||
res.display = display;
|
||||
res.relationship = relationship;
|
||||
res.relComment = relComment;
|
||||
res.renderedRel = renderedRel;
|
||||
res.renderedCode = renderedCode;
|
||||
if (clone) {
|
||||
res.clone = this;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return relationship+" "+system + "#" + code + " \"" + display + "\"";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class MultipleMappingRowItem {
|
||||
List<Cell> cells = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (Cell cell : cells) {
|
||||
if (cell.relationship != null) {
|
||||
b.append(cell.relationship+cell.code);
|
||||
} else {
|
||||
b.append(cell.code);
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static class MultipleMappingRow {
|
||||
private List<MultipleMappingRowItem> rowSets = new ArrayList<>();
|
||||
private MultipleMappingRow stickySource;
|
||||
|
||||
public MultipleMappingRow(int i, String system, String code, String display) {
|
||||
MultipleMappingRowItem row = new MultipleMappingRowItem();
|
||||
rowSets.add(row);
|
||||
for (int c = 0; c < i; c++) {
|
||||
row.cells.add(new Cell()); // blank cell spaces
|
||||
}
|
||||
row.cells.add(new Cell(system, code, display));
|
||||
}
|
||||
|
||||
|
||||
public MultipleMappingRow(MultipleMappingRow stickySource) {
|
||||
this.stickySource = stickySource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (MultipleMappingRowItem rowSet : rowSets) {
|
||||
b.append(""+rowSet.cells.size());
|
||||
}
|
||||
CommaSeparatedStringBuilder b2 = new CommaSeparatedStringBuilder(";");
|
||||
for (MultipleMappingRowItem rowSet : rowSets) {
|
||||
b2.append(rowSet.toString());
|
||||
}
|
||||
return ""+rowSets.size()+" ["+b.toString()+"] ("+b2.toString()+")";
|
||||
}
|
||||
|
||||
|
||||
public String lastCode() {
|
||||
MultipleMappingRowItem first = rowSets.get(0);
|
||||
for (int i = first.cells.size()-1; i >= 0; i--) {
|
||||
if (first.cells.get(i).code != null) {
|
||||
return first.cells.get(i).code;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String firstCode() {
|
||||
MultipleMappingRowItem first = rowSets.get(0);
|
||||
for (int i = 0; i < first.cells.size(); i++) {
|
||||
if (first.cells.get(i).code != null) {
|
||||
return first.cells.get(i).code;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void addSource(MultipleMappingRow sourceRow, List<MultipleMappingRow> rowList, ConceptMapRelationship relationship, String comment) {
|
||||
// we already have a row, and we're going to collapse the rows on sourceRow into here, and add a matching terminus
|
||||
assert sourceRow.rowSets.get(0).cells.size() == rowSets.get(0).cells.size()-1;
|
||||
rowList.remove(sourceRow);
|
||||
Cell template = rowSets.get(0).cells.get(rowSets.get(0).cells.size()-1);
|
||||
for (MultipleMappingRowItem row : sourceRow.rowSets) {
|
||||
row.cells.add(new Cell(template.system, template.code, relationship.getSymbol(), comment));
|
||||
}
|
||||
rowSets.addAll(sourceRow.rowSets);
|
||||
}
|
||||
|
||||
public void addTerminus() {
|
||||
for (MultipleMappingRowItem row : rowSets) {
|
||||
row.cells.add(new Cell(null, null, "X", null));
|
||||
}
|
||||
}
|
||||
|
||||
public void addTarget(String system, String code, ConceptMapRelationship relationship, String comment, List<MultipleMappingRow> sets, int colCount) {
|
||||
if (rowSets.get(0).cells.size() == colCount+1) { // if it's already has a target for this col then we have to clone (and split) the rows
|
||||
for (MultipleMappingRowItem row : rowSets) {
|
||||
row.cells.add(new Cell(system, code, relationship.getSymbol(), comment));
|
||||
}
|
||||
} else {
|
||||
MultipleMappingRow nrow = new MultipleMappingRow(this);
|
||||
for (MultipleMappingRowItem row : rowSets) {
|
||||
MultipleMappingRowItem n = new MultipleMappingRowItem();
|
||||
for (int i = 0; i < row.cells.size()-1; i++) { // note to skip the last
|
||||
n.cells.add(row.cells.get(i).copy(true));
|
||||
}
|
||||
n.cells.add(new Cell(system, code, relationship.getSymbol(), comment));
|
||||
nrow.rowSets.add(n);
|
||||
}
|
||||
sets.add(sets.indexOf(this), nrow);
|
||||
}
|
||||
}
|
||||
|
||||
public String lastSystem() {
|
||||
MultipleMappingRowItem first = rowSets.get(0);
|
||||
for (int i = first.cells.size()-1; i >= 0; i--) {
|
||||
if (first.cells.get(i).system != null) {
|
||||
return first.cells.get(i).system;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void addCopy(String system) {
|
||||
for (MultipleMappingRowItem row : rowSets) {
|
||||
row.cells.add(new Cell(system, lastCode(), "=", null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean alreadyHasMappings(int i) {
|
||||
for (MultipleMappingRowItem row : rowSets) {
|
||||
if (row.cells.size() > i+1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public Cell getLastSource(int i) {
|
||||
for (MultipleMappingRowItem row : rowSets) {
|
||||
return row.cells.get(i+1);
|
||||
}
|
||||
throw new Error("Should not get here"); // return null
|
||||
}
|
||||
|
||||
|
||||
public void cloneSource(int i, Cell cell) {
|
||||
MultipleMappingRowItem row = new MultipleMappingRowItem();
|
||||
rowSets.add(row);
|
||||
for (int c = 0; c < i-1; c++) {
|
||||
row.cells.add(new Cell()); // blank cell spaces
|
||||
}
|
||||
row.cells.add(cell.copy(true));
|
||||
row.cells.add(rowSets.get(0).cells.get(rowSets.get(0).cells.size()-1).copy(false));
|
||||
}
|
||||
}
|
||||
|
||||
public ConceptMapRenderer(RenderingContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
@ -45,23 +294,23 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
}
|
||||
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("Mapping from ");
|
||||
p.tx(/*!#*/"Mapping from ");
|
||||
if (cm.hasSourceScope())
|
||||
AddVsRef(cm.getSourceScope().primitiveValue(), p, cm);
|
||||
else
|
||||
p.tx("(not specified)");
|
||||
p.tx(" to ");
|
||||
p.tx(/*!#*/"(not specified)");
|
||||
p.tx(" "+/*!#*/"to ");
|
||||
if (cm.hasTargetScope())
|
||||
AddVsRef(cm.getTargetScope().primitiveValue(), p, cm);
|
||||
else
|
||||
p.tx("(not specified)");
|
||||
p.tx(/*!#*/"(not specified)");
|
||||
|
||||
p = x.para();
|
||||
if (cm.getExperimental())
|
||||
p.addText(Utilities.capitalize(cm.getStatus().toString())+" (not intended for production usage). ");
|
||||
p.addText(Utilities.capitalize(cm.getStatus().toString())+" "+/*!#*/"(not intended for production usage). ");
|
||||
else
|
||||
p.addText(Utilities.capitalize(cm.getStatus().toString())+". ");
|
||||
p.tx("Published on "+(cm.hasDate() ? display(cm.getDateElement()) : "?ngen-10?")+" by "+cm.getPublisher());
|
||||
p.tx(/*!#*/"Published on "+(cm.hasDate() ? display(cm.getDateElement()) : "?ngen-10?")+" by "+cm.getPublisher());
|
||||
if (!cm.getContact().isEmpty()) {
|
||||
p.tx(" (");
|
||||
boolean firsti = true;
|
||||
|
@ -131,18 +380,18 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
x.hr();
|
||||
}
|
||||
XhtmlNode pp = x.para();
|
||||
pp.b().tx("Group "+gc);
|
||||
pp.tx("Mapping from ");
|
||||
pp.b().tx(/*!#*/"Group "+gc);
|
||||
pp.tx(/*!#*/"Mapping from ");
|
||||
if (grp.hasSource()) {
|
||||
renderCanonical(cm, pp, grp.getSource());
|
||||
} else {
|
||||
pp.code("unspecified code system");
|
||||
pp.code(/*!#*/"unspecified code system");
|
||||
}
|
||||
pp.tx(" to ");
|
||||
if (grp.hasTarget()) {
|
||||
renderCanonical(cm, pp, grp.getTarget());
|
||||
} else {
|
||||
pp.code("unspecified code system");
|
||||
pp.code(/*!#*/"unspecified code system");
|
||||
}
|
||||
|
||||
String display;
|
||||
|
@ -150,11 +399,11 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
// simple
|
||||
XhtmlNode tbl = x.table( "grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx("Source Code");
|
||||
tr.td().b().tx("Relationship");
|
||||
tr.td().b().tx("Target Code");
|
||||
tr.td().b().tx(/*!#*/"Source Code");
|
||||
tr.td().b().tx(/*!#*/"Relationship");
|
||||
tr.td().b().tx(/*!#*/"Target Code");
|
||||
if (comment)
|
||||
tr.td().b().tx("Comment");
|
||||
tr.td().b().tx(/*!#*/"Comment");
|
||||
for (SourceElementComponent ccl : grp.getElement()) {
|
||||
tr = tbl.tr();
|
||||
XhtmlNode td = tr.td();
|
||||
|
@ -201,21 +450,21 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
XhtmlNode tbl = x.table( "grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
XhtmlNode td;
|
||||
tr.td().colspan(Integer.toString(1+sources.size())).b().tx("Source Concept Details");
|
||||
tr.td().colspan(Integer.toString(1+sources.size())).b().tx(/*!#*/"Source Concept Details");
|
||||
if (hasRelationships) {
|
||||
tr.td().b().tx("Relationship");
|
||||
tr.td().b().tx(/*!#*/"Relationship");
|
||||
}
|
||||
tr.td().colspan(Integer.toString(1+targets.size())).b().tx("Target Concept Details");
|
||||
tr.td().colspan(Integer.toString(1+targets.size())).b().tx(/*!#*/"Target Concept Details");
|
||||
if (comment) {
|
||||
tr.td().b().tx("Comment");
|
||||
tr.td().b().tx(/*!#*/"Comment");
|
||||
}
|
||||
tr.td().colspan(Integer.toString(1+targets.size())).b().tx("Properties");
|
||||
tr.td().colspan(Integer.toString(1+targets.size())).b().tx(/*!#*/"Properties");
|
||||
tr = tbl.tr();
|
||||
if (sources.get("code").size() == 1) {
|
||||
String url = sources.get("code").iterator().next();
|
||||
renderCSDetailsLink(tr, url, true);
|
||||
} else
|
||||
tr.td().b().tx("Code");
|
||||
tr.td().b().tx(/*!#*/"Code");
|
||||
for (String s : sources.keySet()) {
|
||||
if (s != null && !s.equals("code")) {
|
||||
if (sources.get(s).size() == 1) {
|
||||
|
@ -232,7 +481,7 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
String url = targets.get("code").iterator().next();
|
||||
renderCSDetailsLink(tr, url, true);
|
||||
} else
|
||||
tr.td().b().tx("Code");
|
||||
tr.td().b().tx(/*!#*/"Code");
|
||||
for (String s : targets.keySet()) {
|
||||
if (s != null && !s.equals("code")) {
|
||||
if (targets.get(s).size() == 1) {
|
||||
|
@ -429,8 +678,8 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
if (span2) {
|
||||
td.colspan("2");
|
||||
}
|
||||
td.b().tx("Codes");
|
||||
td.tx(" from ");
|
||||
td.b().tx(/*!#*/"Codes");
|
||||
td.tx(" "+/*!#*/"from ");
|
||||
if (cs == null)
|
||||
td.tx(url);
|
||||
else
|
||||
|
@ -475,4 +724,257 @@ public class ConceptMapRenderer extends TerminologyRenderer {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static XhtmlNode renderMultipleMaps(String start, String startLink, List<ConceptMap> maps, IMultiMapRendererAdvisor advisor, RenderMultiRowSortPolicy sort) {
|
||||
// 1+1 column for each provided map
|
||||
List<MultipleMappingRow> rowSets = new ArrayList<>();
|
||||
for (int i = 0; i < maps.size(); i++) {
|
||||
populateRows(rowSets, maps.get(i), i, advisor);
|
||||
}
|
||||
collateRows(rowSets);
|
||||
if (sort != RenderMultiRowSortPolicy.UNSORTED) {
|
||||
Collections.sort(rowSets, new MultipleMappingRowSorter(sort == RenderMultiRowSortPolicy.FIRST_COL));
|
||||
}
|
||||
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
|
||||
XhtmlNode tbl = div.table("none").style("text-align: left; border-spacing: 0; padding: 5px");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
styleCell(tr.td(), false, true, 5).b().ahOrNot(startLink).tx(start);
|
||||
for (ConceptMap map : maps) {
|
||||
XhtmlNode td = styleCell(tr.td(), false, true, 5).colspan(2);
|
||||
if (!advisor.describeMap(map, td)) {
|
||||
if (map.hasWebPath()) {
|
||||
td.b().ah(map.getWebPath(), map.getVersionedUrl()).tx(map.present());
|
||||
} else {
|
||||
td.b().tx(map.present());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MultipleMappingRow row : rowSets) {
|
||||
renderMultiRow(tbl, row, maps, advisor);
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
private static void collateRows(List<MultipleMappingRow> rowSets) {
|
||||
List<MultipleMappingRow> toDelete = new ArrayList<ConceptMapRenderer.MultipleMappingRow>();
|
||||
for (MultipleMappingRow rowSet : rowSets) {
|
||||
MultipleMappingRow tgt = rowSet.stickySource;
|
||||
while (toDelete.contains(tgt)) {
|
||||
tgt = tgt.stickySource;
|
||||
}
|
||||
if (tgt != null && rowSets.contains(tgt)) {
|
||||
tgt.rowSets.addAll(rowSet.rowSets);
|
||||
toDelete.add(rowSet);
|
||||
}
|
||||
}
|
||||
rowSets.removeAll(toDelete);
|
||||
}
|
||||
|
||||
private static void renderMultiRow(XhtmlNode tbl, MultipleMappingRow rows, List<ConceptMap> maps, IMultiMapRendererAdvisor advisor) {
|
||||
int rowCounter = 0;
|
||||
for (MultipleMappingRowItem row : rows.rowSets) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
boolean first = true;
|
||||
int cellCounter = 0;
|
||||
Cell last = null;
|
||||
for (Cell cell : row.cells) {
|
||||
if (first) {
|
||||
if (!cell.renderedCode) {
|
||||
int c = 1;
|
||||
for (int i = rowCounter + 1; i < rows.rowSets.size(); i++) {
|
||||
if (cell.code != null && rows.rowSets.get(i).cells.size() > cellCounter && cell.code.equals(rows.rowSets.get(i).cells.get(cellCounter).code)) {
|
||||
rows.rowSets.get(i).cells.get(cellCounter).renderedCode = true;
|
||||
c++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cell.code == null) {
|
||||
styleCell(tr.td(), rowCounter == 0, true, 5).rowspan(c).style("background-color: #eeeeee");
|
||||
} else {
|
||||
String link = advisor.getLink(cell.system, cell.code);
|
||||
XhtmlNode x = null;
|
||||
if (link != null) {
|
||||
x = styleCell(tr.td(), rowCounter == 0, true, 5).attributeNN("title", cell.display).rowspan(c).ah(link);
|
||||
} else {
|
||||
x = styleCell(tr.td(), rowCounter == 0, true, 5).attributeNN("title", cell.display).rowspan(c);
|
||||
}
|
||||
// if (cell.clone != null) {
|
||||
// x.style("color: grey");
|
||||
// }
|
||||
x.tx(cell.present());
|
||||
}
|
||||
}
|
||||
first = false;
|
||||
} else {
|
||||
if (!cell.renderedRel) {
|
||||
int c = 1;
|
||||
for (int i = rowCounter + 1; i < rows.rowSets.size(); i++) {
|
||||
if ((cell.relationship != null && rows.rowSets.get(i).cells.size() > cellCounter && cell.relationship.equals(rows.rowSets.get(i).cells.get(cellCounter).relationship)) &&
|
||||
(cell.code != null && cell.code.equals(rows.rowSets.get(i).cells.get(cellCounter).code)) &&
|
||||
(last.code != null && cell.code.equals(rows.rowSets.get(i).cells.get(cellCounter-1).code))) {
|
||||
rows.rowSets.get(i).cells.get(cellCounter).renderedRel = true;
|
||||
c++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (last.code == null || cell.code == null) {
|
||||
styleCell(tr.td(), rowCounter == 0, true, 5).style("background-color: #eeeeee");
|
||||
} else if (cell.relationship != null) {
|
||||
styleCell(tr.tdW(16), rowCounter == 0, true, 0).attributeNN("title", cell.relComment).rowspan(c).style("background-color: LightGrey; text-align: center; vertical-align: middle; color: white").tx(cell.relationship);
|
||||
} else {
|
||||
styleCell(tr.tdW(16), rowCounter == 0, false, 0).rowspan(c);
|
||||
}
|
||||
}
|
||||
if (!cell.renderedCode) {
|
||||
int c = 1;
|
||||
for (int i = rowCounter + 1; i < rows.rowSets.size(); i++) {
|
||||
if (cell.code != null && rows.rowSets.get(i).cells.size() > cellCounter && cell.code.equals(rows.rowSets.get(i).cells.get(cellCounter).code)) {
|
||||
rows.rowSets.get(i).cells.get(cellCounter).renderedCode = true;
|
||||
c++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cell.code == null) {
|
||||
styleCell(tr.td(), rowCounter == 0, true, 5).rowspan(c).style("background-color: #eeeeee");
|
||||
} else {
|
||||
String link = advisor.getLink(cell.system, cell.code);
|
||||
XhtmlNode x = null;
|
||||
if (link != null) {
|
||||
x = styleCell(tr.td(), rowCounter == 0, true, 5).attributeNN("title", cell.display).rowspan(c).ah(link);
|
||||
} else {
|
||||
x = styleCell(tr.td(), rowCounter == 0, true, 5).attributeNN("title", cell.display).rowspan(c);
|
||||
}
|
||||
// if (cell.clone != null) {
|
||||
// x.style("color: grey");
|
||||
// }
|
||||
x.tx(cell.present());
|
||||
}
|
||||
}
|
||||
}
|
||||
last = cell;
|
||||
cellCounter++;
|
||||
}
|
||||
rowCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
private static XhtmlNode styleCell(XhtmlNode td, boolean firstrow, boolean sides, int padding) {
|
||||
if (firstrow) {
|
||||
td.style("vertical-align: middle; border-top: 1px solid black; padding: "+padding+"px");
|
||||
} else {
|
||||
td.style("vertical-align: middle; border-top: 1px solid LightGrey; padding: "+padding+"px");
|
||||
}
|
||||
if (sides) {
|
||||
td.style("border-left: 1px solid LightGrey; border-right: 2px solid LightGrey");
|
||||
}
|
||||
return td;
|
||||
}
|
||||
|
||||
private static void populateRows(List<MultipleMappingRow> rowSets, ConceptMap map, int i, IMultiMapRendererAdvisor advisor) {
|
||||
// if we can resolve the value set, we create entries for it
|
||||
if (map.hasSourceScope()) {
|
||||
List<Coding> codings = advisor.getMembers(map.getSourceScope().primitiveValue());
|
||||
if (codings != null) {
|
||||
for (Coding c : codings) {
|
||||
MultipleMappingRow row = i == 0 ? null : findExistingRowBySource(rowSets, c.getSystem(), c.getCode(), i);
|
||||
if (row == null) {
|
||||
row = new MultipleMappingRow(i, c.getSystem(), c.getCode(), c.getDisplay());
|
||||
rowSets.add(row);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ConceptMapGroupComponent grp : map.getGroup()) {
|
||||
for (SourceElementComponent src : grp.getElement()) {
|
||||
MultipleMappingRow row = findExistingRowBySource(rowSets, grp.getSource(), src.getCode(), i);
|
||||
if (row == null) {
|
||||
row = new MultipleMappingRow(i, grp.getSource(), src.getCode(), src.getDisplay());
|
||||
rowSets.add(row);
|
||||
}
|
||||
if (src.getNoMap()) {
|
||||
row.addTerminus();
|
||||
} else {
|
||||
List<TargetElementComponent> todo = new ArrayList<>();
|
||||
for (TargetElementComponent tgt : src.getTarget()) {
|
||||
MultipleMappingRow trow = findExistingRowByTarget(rowSets, grp.getTarget(), tgt.getCode(), i);
|
||||
if (trow == null) {
|
||||
row.addTarget(grp.getTarget(), tgt.getCode(), tgt.getRelationship(), tgt.getComment(), rowSets, i);
|
||||
} else {
|
||||
todo.add(tgt);
|
||||
}
|
||||
}
|
||||
// we've already got a mapping to these targets. So we gather them under the one mapping - but do this after the others are done
|
||||
for (TargetElementComponent t : todo) {
|
||||
MultipleMappingRow trow = findExistingRowByTarget(rowSets, grp.getTarget(), t.getCode(), i);
|
||||
if (row.alreadyHasMappings(i)) {
|
||||
// src is already mapped, and so is target, and now we need to map src to target too
|
||||
// we have to clone src, but we only clone the last
|
||||
trow.cloneSource(i, row.getLastSource(i));
|
||||
} else {
|
||||
trow.addSource(row, rowSets, t.getRelationship(), t.getComment());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean copy = grp.hasUnmapped() && grp.getUnmapped().getMode() == ConceptMapGroupUnmappedMode.USESOURCECODE;
|
||||
if (copy) {
|
||||
for (MultipleMappingRow row : rowSets) {
|
||||
if (row.rowSets.get(0).cells.size() == i && row.lastSystem().equals(grp.getSource())) {
|
||||
row.addCopy(grp.getTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MultipleMappingRow row : rowSets) {
|
||||
if (row.rowSets.get(0).cells.size() == i) {
|
||||
row.addTerminus();
|
||||
}
|
||||
}
|
||||
if (map.hasTargetScope()) {
|
||||
List<Coding> codings = advisor.getMembers(map.getTargetScope().primitiveValue());
|
||||
if (codings != null) {
|
||||
for (Coding c : codings) {
|
||||
MultipleMappingRow row = findExistingRowByTarget(rowSets, c.getSystem(), c.getCode(), i);
|
||||
if (row == null) {
|
||||
row = new MultipleMappingRow(i+1, c.getSystem(), c.getCode(), c.getDisplay());
|
||||
rowSets.add(row);
|
||||
} else {
|
||||
for (MultipleMappingRowItem cells : row.rowSets) {
|
||||
Cell last = cells.cells.get(cells.cells.size() -1);
|
||||
if (last.system != null && last.system.equals(c.getSystem()) && last.code.equals(c.getCode()) && last.display == null) {
|
||||
last.display = c.getDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static MultipleMappingRow findExistingRowByTarget(List<MultipleMappingRow> rows, String system, String code, int i) {
|
||||
for (MultipleMappingRow row : rows) {
|
||||
for (MultipleMappingRowItem cells : row.rowSets) {
|
||||
if (cells.cells.size() > i + 1 && cells.cells.get(i+1).matches(system, code)) {
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static MultipleMappingRow findExistingRowBySource(List<MultipleMappingRow> rows, String system, String code, int i) {
|
||||
for (MultipleMappingRow row : rows) {
|
||||
for (MultipleMappingRowItem cells : row.rowSets) {
|
||||
if (cells.cells.size() > i && cells.cells.get(i).matches(system, code)) {
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,10 +159,15 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
parts[0] = parts[0].substring(0, parts[0].indexOf("."));
|
||||
}
|
||||
StructureDefinition p = getContext().getWorker().fetchResource(StructureDefinition.class, parts[0]);
|
||||
if (p == null)
|
||||
if (p == null) {
|
||||
p = getContext().getWorker().fetchTypeDefinition(parts[0]);
|
||||
if (p == null)
|
||||
}
|
||||
if (context.getTypeMap().containsKey(parts[0])) {
|
||||
p = getContext().getWorker().fetchTypeDefinition(context.getTypeMap().get(parts[0]));
|
||||
}
|
||||
if (p == null) {
|
||||
p = getContext().getWorker().fetchResource(StructureDefinition.class, link);
|
||||
}
|
||||
if (p != null) {
|
||||
if ("Extension".equals(p.getType())) {
|
||||
path = null;
|
||||
|
@ -175,8 +180,9 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (url == null) {
|
||||
url = p.getUserString("filename");
|
||||
}
|
||||
} else
|
||||
throw new DefinitionException("Unable to resolve markdown link "+link);
|
||||
} else {
|
||||
throw new DefinitionException(/*!#*/"Unable to resolve markdown link "+link);
|
||||
}
|
||||
|
||||
text = left+"["+link+"]("+url+(path == null ? "" : "#"+path)+")"+right;
|
||||
}
|
||||
|
@ -210,18 +216,18 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
private static String month(String m) {
|
||||
switch (m) {
|
||||
case "1" : return "Jan";
|
||||
case "2" : return "Feb";
|
||||
case "3" : return "Mar";
|
||||
case "4" : return "Apr";
|
||||
case "5" : return "May";
|
||||
case "6" : return "Jun";
|
||||
case "7" : return "Jul";
|
||||
case "8" : return "Aug";
|
||||
case "9" : return "Sep";
|
||||
case "10" : return "Oct";
|
||||
case "11" : return "Nov";
|
||||
case "12" : return "Dec";
|
||||
case "1" : return /*!#*/"Jan";
|
||||
case "2" : return /*!#*/"Feb";
|
||||
case "3" : return /*!#*/"Mar";
|
||||
case "4" : return/*!#*/ "Apr";
|
||||
case "5" : return /*!#*/"May";
|
||||
case "6" : return /*!#*/"Jun";
|
||||
case "7" : return /*!#*/"Jul";
|
||||
case "8" : return /*!#*/"Aug";
|
||||
case "9" : return /*!#*/"Sep";
|
||||
case "10" : return /*!#*/"Oct";
|
||||
case "11" : return /*!#*/"Nov";
|
||||
case "12" : return /*!#*/"Dec";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
@ -241,16 +247,16 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
ed = p[p.length-1];
|
||||
}
|
||||
switch (ed) {
|
||||
case "900000000000207008": return "Intl"+dt;
|
||||
case "731000124108": return "US"+dt;
|
||||
case "32506021000036107": return "AU"+dt;
|
||||
case "449081005": return "ES"+dt;
|
||||
case "554471000005108": return "DK"+dt;
|
||||
case "11000146104": return "NL"+dt;
|
||||
case "45991000052106": return "SE"+dt;
|
||||
case "999000041000000102": return "UK"+dt;
|
||||
case "20611000087101": return "CA"+dt;
|
||||
case "11000172109": return "BE"+dt;
|
||||
case "900000000000207008": return /*!#*/"Intl"+dt;
|
||||
case "731000124108": return /*!#*/"US"+dt;
|
||||
case "32506021000036107": return /*!#*/"AU"+dt;
|
||||
case "449081005": return /*!#*/"ES"+dt;
|
||||
case "554471000005108": return /*!#*/"DK"+dt;
|
||||
case "11000146104": return /*!#*/"NL"+dt;
|
||||
case "45991000052106": return /*!#*/"SE"+dt;
|
||||
case "999000041000000102": return /*!#*/"UK"+dt;
|
||||
case "20611000087101": return /*!#*/"CA"+dt;
|
||||
case "11000172109": return /*!#*/"BE"+dt;
|
||||
default: return "??"+dt;
|
||||
}
|
||||
} else {
|
||||
|
@ -260,38 +266,38 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
public static String describeSystem(String system) {
|
||||
if (system == null)
|
||||
return "[not stated]";
|
||||
return /*!#*/"[not stated]";
|
||||
if (system.equals("http://loinc.org"))
|
||||
return "LOINC";
|
||||
return /*!#*/"LOINC";
|
||||
if (system.startsWith("http://snomed.info"))
|
||||
return "SNOMED CT";
|
||||
return /*!#*/"SNOMED CT";
|
||||
if (system.equals("http://www.nlm.nih.gov/research/umls/rxnorm"))
|
||||
return "RxNorm";
|
||||
return /*!#*/"RxNorm";
|
||||
if (system.equals("http://hl7.org/fhir/sid/icd-9"))
|
||||
return "ICD-9";
|
||||
return /*!#*/"ICD-9";
|
||||
if (system.equals("http://dicom.nema.org/resources/ontology/DCM"))
|
||||
return "DICOM";
|
||||
return /*!#*/"DICOM";
|
||||
if (system.equals("http://unitsofmeasure.org"))
|
||||
return "UCUM";
|
||||
return /*!#*/"UCUM";
|
||||
|
||||
return system;
|
||||
}
|
||||
|
||||
public String displaySystem(String system) {
|
||||
if (system == null)
|
||||
return "[not stated]";
|
||||
return /*!#*/"[not stated]";
|
||||
if (system.equals("http://loinc.org"))
|
||||
return "LOINC";
|
||||
return /*!#*/"LOINC";
|
||||
if (system.startsWith("http://snomed.info"))
|
||||
return "SNOMED CT";
|
||||
return /*!#*/"SNOMED CT";
|
||||
if (system.equals("http://www.nlm.nih.gov/research/umls/rxnorm"))
|
||||
return "RxNorm";
|
||||
return /*!#*/"RxNorm";
|
||||
if (system.equals("http://hl7.org/fhir/sid/icd-9"))
|
||||
return "ICD-9";
|
||||
return /*!#*/"ICD-9";
|
||||
if (system.equals("http://dicom.nema.org/resources/ontology/DCM"))
|
||||
return "DICOM";
|
||||
return /*!#*/"DICOM";
|
||||
if (system.equals("http://unitsofmeasure.org"))
|
||||
return "UCUM";
|
||||
return /*!#*/"UCUM";
|
||||
|
||||
CodeSystem cs = context.getContext().fetchCodeSystem(system);
|
||||
if (cs != null) {
|
||||
|
@ -304,7 +310,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (system.contains("/")) {
|
||||
return system.substring(system.lastIndexOf("/")+1);
|
||||
} else {
|
||||
return "unknown";
|
||||
return /*!#*/"unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +341,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
protected String describeLang(String lang) {
|
||||
// special cases:
|
||||
if ("fr-CA".equals(lang)) {
|
||||
return "French (Canadian)"; // this one was omitted from the value set
|
||||
return /*!#*/"French (Canadian)"; // this one was omitted from the value set
|
||||
}
|
||||
ValueSet v = getContext().getWorker().findTxResource(ValueSet.class, "http://hl7.org/fhir/ValueSet/languages");
|
||||
if (v != null) {
|
||||
|
@ -402,10 +408,6 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
// -- 4. Language support ------------------------------------------------------
|
||||
|
||||
protected String translate(String source, String content) {
|
||||
return content;
|
||||
}
|
||||
|
||||
public String gt(@SuppressWarnings("rawtypes") PrimitiveType value) {
|
||||
return value.primitiveValue();
|
||||
}
|
||||
|
@ -470,7 +472,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
} else {
|
||||
// somehow have to do better than this
|
||||
XhtmlNode li = ul.li();
|
||||
li.b().tx("WARNING: Unrenderable Modifier Extension!");
|
||||
li.b().tx(/*!#*/"WARNING: Unrenderable Modifier Extension!");
|
||||
}
|
||||
}
|
||||
for (Extension ext : element.getExtension()) {
|
||||
|
@ -520,7 +522,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
render(div, ext.getValue());
|
||||
} else {
|
||||
// somehow have to do better than this
|
||||
div.b().tx("WARNING: Unrenderable Modifier Extension!");
|
||||
div.b().tx(/*!#*/"WARNING: Unrenderable Modifier Extension!");
|
||||
}
|
||||
}
|
||||
for (Extension ext : element.getExtension()) {
|
||||
|
@ -551,7 +553,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (b instanceof DataType) {
|
||||
return display((DataType) b);
|
||||
} else {
|
||||
return "No display for "+b.fhirType();
|
||||
return /*!#*/"No display for "+b.fhirType();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,7 +589,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
} else if (type.isPrimitive()) {
|
||||
return type.primitiveValue();
|
||||
} else {
|
||||
return "No display for "+type.fhirType();
|
||||
return /*!#*/"No display for "+type.fhirType();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,7 +671,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
|
||||
public String display(BaseWrapper type) {
|
||||
return "to do";
|
||||
return /*!#*/"to do";
|
||||
}
|
||||
|
||||
public void render(XhtmlNode x, BaseWrapper type) throws FHIRFormatError, DefinitionException, IOException {
|
||||
|
@ -677,13 +679,13 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
try {
|
||||
base = type.getBase();
|
||||
} catch (FHIRException | IOException e) {
|
||||
x.tx("Error: " + e.getMessage()); // this shouldn't happen - it's an error in the library itself
|
||||
x.tx(/*!#*/"Error: " + e.getMessage()); // this shouldn't happen - it's an error in the library itself
|
||||
return;
|
||||
}
|
||||
if (base instanceof DataType) {
|
||||
render(x, (DataType) base);
|
||||
} else {
|
||||
x.tx("to do: "+base.fhirType());
|
||||
x.tx(/*!#*/"to do: "+base.fhirType());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,7 +693,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (b instanceof DataType) {
|
||||
render(x, (DataType) b);
|
||||
} else {
|
||||
x.tx("No display for "+b.fhirType());
|
||||
x.tx(/*!#*/"No display for "+b.fhirType());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,7 +747,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
} else if (type.isPrimitive()) {
|
||||
x.tx(type.primitiveValue());
|
||||
} else {
|
||||
x.tx("No display for "+type.fhirType());
|
||||
x.tx(/*!#*/"No display for "+type.fhirType());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -837,7 +839,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
|
||||
if (a.hasAuthor()) {
|
||||
b.append("By ");
|
||||
b.append(/*!#*/"By ");
|
||||
if (a.hasAuthorReference()) {
|
||||
b.append(a.getAuthorReference().getReference());
|
||||
} else if (a.hasAuthorStringType()) {
|
||||
|
@ -1025,7 +1027,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
systemName = cs != null ? cs.present() : describeSystem(c.getSystem());
|
||||
link = getLinkForCode(c.getSystem(), c.getVersion(), c.getCode());
|
||||
|
||||
hint = systemName+": "+display+(c.hasVersion() ? " (version = "+c.getVersion()+")" : "");
|
||||
hint = systemName+": "+display+(c.hasVersion() ? " "+/*!#*/"(version = "+c.getVersion()+")" : "");
|
||||
return new CodeResolution(systemName, systemLink, link, display, hint);
|
||||
}
|
||||
|
||||
|
@ -1060,7 +1062,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
x.tx(s);
|
||||
}
|
||||
if (c.hasVersion()) {
|
||||
x.tx(" (version = "+c.getVersion()+")");
|
||||
x.tx(" "+/*!#*/"(version = "+c.getVersion()+")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1077,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
s = c.getCode();
|
||||
|
||||
if (showCodeDetails) {
|
||||
x.addText(s+" (Details: "+TerminologyRenderer.describeSystem(c.getSystem())+" code "+c.getCode()+" = '"+lookupCode(c.getSystem(), c.getVersion(), c.getCode())+"', stated as '"+c.getDisplay()+"')");
|
||||
x.addText(s+" "+/*!#*/"(Details: "+TerminologyRenderer.describeSystem(c.getSystem())+" code "+c.getCode()+" = '"+lookupCode(c.getSystem(), c.getVersion(), c.getCode())+"', stated as '"+c.getDisplay()+"')");
|
||||
} else
|
||||
x.span(null, "{"+c.getSystem()+" "+c.getCode()+"}").addText(s);
|
||||
}
|
||||
|
@ -1195,25 +1197,31 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
}
|
||||
|
||||
x.span(null, "Codes: "+b.toString()).addText(s);
|
||||
x.span(null, /*!#*/"Codes: "+b.toString()).addText(s);
|
||||
}
|
||||
}
|
||||
|
||||
protected String displayIdentifier(Identifier ii) {
|
||||
String s = Utilities.noString(ii.getValue()) ? "?ngen-9?" : ii.getValue();
|
||||
NamingSystem ns = context.getContext().getNSUrlMap().get(ii.getSystem());
|
||||
if (ns != null) {
|
||||
s = ns.present()+"#"+s;
|
||||
}
|
||||
if (ii.hasType()) {
|
||||
if (ii.getType().hasText())
|
||||
s = ii.getType().getText()+":\u00A0"+s;
|
||||
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasDisplay())
|
||||
s = ii.getType().getCoding().get(0).getDisplay()+": "+s;
|
||||
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasCode())
|
||||
s = lookupCode(ii.getType().getCoding().get(0).getSystem(), ii.getType().getCoding().get(0).getVersion(), ii.getType().getCoding().get(0).getCode())+": "+s;
|
||||
if ("urn:ietf:rfc:3986".equals(ii.getSystem()) && s.startsWith("urn:oid:")) {
|
||||
s = "OID:"+s.substring(8);
|
||||
} else if ("urn:ietf:rfc:3986".equals(ii.getSystem()) && s.startsWith("urn:uuid:")) {
|
||||
s = "UUID:"+s.substring(9);
|
||||
} else {
|
||||
s = "id:\u00A0"+s;
|
||||
NamingSystem ns = context.getContext().getNSUrlMap().get(ii.getSystem());
|
||||
if (ns != null) {
|
||||
s = ns.present()+"#"+s;
|
||||
}
|
||||
if (ii.hasType()) {
|
||||
if (ii.getType().hasText())
|
||||
s = ii.getType().getText()+":\u00A0"+s;
|
||||
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasDisplay())
|
||||
s = ii.getType().getCoding().get(0).getDisplay()+": "+s;
|
||||
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasCode())
|
||||
s = lookupCode(ii.getType().getCoding().get(0).getSystem(), ii.getType().getCoding().get(0).getVersion(), ii.getType().getCoding().get(0).getCode())+": "+s;
|
||||
} else if (ii.hasSystem()) {
|
||||
s = ii.getSystem()+"#"+s;
|
||||
}
|
||||
}
|
||||
|
||||
if (ii.hasUse() || ii.hasPeriod()) {
|
||||
|
@ -1234,24 +1242,32 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
protected void renderIdentifier(XhtmlNode x, Identifier ii) {
|
||||
if (ii.hasType()) {
|
||||
if (ii.getType().hasText())
|
||||
x.tx(ii.getType().getText()+":");
|
||||
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasDisplay())
|
||||
x.tx(ii.getType().getCoding().get(0).getDisplay()+":");
|
||||
else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasCode())
|
||||
x.tx(lookupCode(ii.getType().getCoding().get(0).getSystem(), ii.getType().getCoding().get(0).getVersion(), ii.getType().getCoding().get(0).getCode())+":");
|
||||
} else {
|
||||
x.tx("id:");
|
||||
}
|
||||
x.nbsp();
|
||||
|
||||
NamingSystem ns = context.getContext().getNSUrlMap().get(ii.getSystem());
|
||||
if (ns != null) {
|
||||
if (ns.hasWebPath()) {
|
||||
x.ah(ns.getWebPath()).tx("#");
|
||||
} else {
|
||||
x.tx(ns.present()+"#");
|
||||
if (ii.getType().hasText()) {
|
||||
x.tx(ii.getType().getText());
|
||||
} else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasDisplay()) {
|
||||
x.tx(ii.getType().getCoding().get(0).getDisplay());
|
||||
} else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasCode()) {
|
||||
x.tx(lookupCode(ii.getType().getCoding().get(0).getSystem(), ii.getType().getCoding().get(0).getVersion(), ii.getType().getCoding().get(0).getCode()));
|
||||
}
|
||||
x.tx("/");
|
||||
} else if (ii.hasSystem()) {
|
||||
NamingSystem ns = context.getContext().getNSUrlMap().get(ii.getSystem());
|
||||
if (ns != null) {
|
||||
if (ns.hasWebPath()) {
|
||||
x.ah(ns.getWebPath(), ns.getDescription()).tx(ns.present());
|
||||
} else {
|
||||
x.tx(ns.present());
|
||||
}
|
||||
} else {
|
||||
switch (ii.getSystem()) {
|
||||
case "urn:oid:2.51.1.3":
|
||||
x.ah("https://www.gs1.org/standards/id-keys/gln", /*!#*/"Global Location Number").tx("GLN");
|
||||
break;
|
||||
default:
|
||||
x.code(ii.getSystem());
|
||||
}
|
||||
}
|
||||
x.tx("/");
|
||||
}
|
||||
x.tx(Utilities.noString(ii.getValue()) ? "?ngen-9?" : ii.getValue());
|
||||
|
||||
|
@ -1259,7 +1275,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
x.nbsp();
|
||||
x.tx("(");
|
||||
if (ii.hasUse()) {
|
||||
x.tx("use:");
|
||||
x.tx(/*!#*/"use:");
|
||||
x.nbsp();
|
||||
x.tx(ii.getUse().toString());
|
||||
}
|
||||
|
@ -1268,7 +1284,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
x.nbsp();
|
||||
}
|
||||
if (ii.hasPeriod()) {
|
||||
x.tx("period:");
|
||||
x.tx(/*!#*/"period:");
|
||||
x.nbsp();
|
||||
x.tx(displayPeriod(ii.getPeriod()));
|
||||
}
|
||||
|
@ -1391,7 +1407,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
c.code().tx(expr.getExpression());
|
||||
} else if (expr.hasReference()) {
|
||||
p.ah(expr.getReference()).tx("source");
|
||||
p.ah(expr.getReference()).tx(/*!#*/"source");
|
||||
}
|
||||
if (expr.hasName() || expr.hasDescription()) {
|
||||
p.tx("(");
|
||||
|
@ -1452,9 +1468,9 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
protected void displayContactPoint(XhtmlNode p, ContactPoint c) {
|
||||
if (c != null) {
|
||||
if (c.getSystem() == ContactPointSystem.PHONE) {
|
||||
p.tx("Phone: "+c.getValue());
|
||||
p.tx(/*!#*/"Phone: "+c.getValue());
|
||||
} else if (c.getSystem() == ContactPointSystem.FAX) {
|
||||
p.tx("Fax: "+c.getValue());
|
||||
p.tx(/*!#*/"Fax: "+c.getValue());
|
||||
} else if (c.getSystem() == ContactPointSystem.EMAIL) {
|
||||
p.tx(c.getValue());
|
||||
} else if (c.getSystem() == ContactPointSystem.URL) {
|
||||
|
@ -1469,11 +1485,11 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
protected void addTelecom(XhtmlNode p, ContactPoint c) {
|
||||
if (c.getSystem() == ContactPointSystem.PHONE) {
|
||||
p.tx("Phone: "+c.getValue());
|
||||
p.tx(/*!#*/"Phone: "+c.getValue());
|
||||
} else if (c.getSystem() == ContactPointSystem.FAX) {
|
||||
p.tx("Fax: "+c.getValue());
|
||||
p.tx(/*!#*/"Fax: "+c.getValue());
|
||||
} else if (c.getSystem() == ContactPointSystem.EMAIL) {
|
||||
p.ah( "mailto:"+c.getValue()).addText(c.getValue());
|
||||
p.ah("mailto:"+c.getValue()).addText(c.getValue());
|
||||
} else if (c.getSystem() == ContactPointSystem.URL) {
|
||||
if (c.getValue().length() > 30)
|
||||
p.ah(c.getValue()).addText(c.getValue().substring(0, 30)+"...");
|
||||
|
@ -1485,8 +1501,8 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (system == null)
|
||||
return "";
|
||||
switch (system) {
|
||||
case PHONE: return "ph: ";
|
||||
case FAX: return "fax: ";
|
||||
case PHONE: return /*!#*/"ph: ";
|
||||
case FAX: return /*!#*/"fax: ";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
@ -1524,7 +1540,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
x.tx("(unit "+q.getCode()+" from "+q.getSystem()+")");
|
||||
}
|
||||
if (showCodeDetails && q.hasCode()) {
|
||||
x.span("background: LightGoldenRodYellow", null).tx(" (Details: "+TerminologyRenderer.describeSystem(q.getSystem())+" code "+q.getCode()+" = '"+lookupCode(q.getSystem(), null, q.getCode())+"')");
|
||||
x.span("background: LightGoldenRodYellow", null).tx(" "+/*!#*/"(Details: "+TerminologyRenderer.describeSystem(q.getSystem())+" code "+q.getCode()+" = '"+lookupCode(q.getSystem(), null, q.getCode())+"')");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1568,13 +1584,13 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
public String displayPeriod(Period p) {
|
||||
String s = !p.hasStart() ? "(?)" : displayDateTime(p.getStartElement());
|
||||
s = s + " --> ";
|
||||
return s + (!p.hasEnd() ? "(ongoing)" : displayDateTime(p.getEndElement()));
|
||||
return s + (!p.hasEnd() ? /*!#*/"(ongoing)" : displayDateTime(p.getEndElement()));
|
||||
}
|
||||
|
||||
public void renderPeriod(XhtmlNode x, Period p) {
|
||||
x.addText(!p.hasStart() ? "??" : displayDateTime(p.getStartElement()));
|
||||
x.tx(" --> ");
|
||||
x.addText(!p.hasEnd() ? "(ongoing)" : displayDateTime(p.getEndElement()));
|
||||
x.addText(!p.hasEnd() ? /*!#*/"(ongoing)" : displayDateTime(p.getEndElement()));
|
||||
}
|
||||
|
||||
public void renderUsageContext(XhtmlNode x, UsageContext u) throws FHIRFormatError, DefinitionException, IOException {
|
||||
|
@ -1586,31 +1602,31 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
public void renderTriggerDefinition(XhtmlNode x, TriggerDefinition td) throws FHIRFormatError, DefinitionException, IOException {
|
||||
if (x.isPara()) {
|
||||
x.b().tx("Type");
|
||||
x.b().tx(/*!#*/"Type");
|
||||
x.tx(": ");
|
||||
x.tx(td.getType().getDisplay());
|
||||
|
||||
if (td.hasName()) {
|
||||
x.tx(", ");
|
||||
x.b().tx("Name");
|
||||
x.b().tx(/*!#*/"Name");
|
||||
x.tx(": ");
|
||||
x.tx(td.getType().getDisplay());
|
||||
}
|
||||
if (td.hasCode()) {
|
||||
x.tx(", ");
|
||||
x.b().tx("Code");
|
||||
x.b().tx(/*!#*/"Code");
|
||||
x.tx(": ");
|
||||
renderCodeableConcept(x, td.getCode());
|
||||
}
|
||||
if (td.hasTiming()) {
|
||||
x.tx(", ");
|
||||
x.b().tx("Timing");
|
||||
x.b().tx(/*!#*/"Timing");
|
||||
x.tx(": ");
|
||||
render(x, td.getTiming());
|
||||
}
|
||||
if (td.hasCondition()) {
|
||||
x.tx(", ");
|
||||
x.b().tx("Condition");
|
||||
x.b().tx(/*!#*/"Condition");
|
||||
x.tx(": ");
|
||||
renderExpression(x, td.getCondition());
|
||||
}
|
||||
|
@ -1618,27 +1634,27 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
XhtmlNode tbl = x.table("grid");
|
||||
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx("Type");
|
||||
tr.td().b().tx(/*!#*/"Type");
|
||||
tr.td().tx(td.getType().getDisplay());
|
||||
|
||||
if (td.hasName()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().b().tx("Name");
|
||||
tr.td().b().tx(/*!#*/"Name");
|
||||
tr.td().tx(td.getType().getDisplay());
|
||||
}
|
||||
if (td.hasCode()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().b().tx("Code");
|
||||
tr.td().b().tx(/*!#*/"Code");
|
||||
renderCodeableConcept(tr.td(), td.getCode());
|
||||
}
|
||||
if (td.hasTiming()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().b().tx("Timing");
|
||||
tr.td().b().tx(/*!#*/"Timing");
|
||||
render(tr.td(), td.getTiming());
|
||||
}
|
||||
if (td.hasCondition()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().b().tx("Condition");
|
||||
tr.td().b().tx(/*!#*/"Condition");
|
||||
renderExpression(tr.td(), td.getCondition());
|
||||
}
|
||||
}
|
||||
|
@ -1648,7 +1664,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
XhtmlNode tbl = x.table("grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
XhtmlNode td = tr.td().colspan("2");
|
||||
td.b().tx("Type");
|
||||
td.b().tx(/*!#*/"Type");
|
||||
td.tx(": ");
|
||||
StructureDefinition sd = context.getWorker().fetchTypeDefinition(dr.getType().toCode());
|
||||
if (sd != null && sd.hasWebPath()) {
|
||||
|
@ -1673,7 +1689,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (dr.hasSubject()) {
|
||||
tr = tbl.tr();
|
||||
td = tr.td().colspan("2");
|
||||
td.b().tx("Subject");
|
||||
td.b().tx(/*!#*/"Subject");
|
||||
if (dr.hasSubjectReference()) {
|
||||
renderReference(td, dr.getSubjectReference());
|
||||
} else {
|
||||
|
@ -1682,24 +1698,24 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
if (dr.hasCodeFilter() || dr.hasDateFilter()) {
|
||||
tr = tbl.tr().backgroundColor("#efefef");
|
||||
tr.td().tx("Filter");
|
||||
tr.td().tx("Value");
|
||||
tr.td().tx(/*!#*/"Filter");
|
||||
tr.td().tx(/*!#*/"Value");
|
||||
}
|
||||
for (DataRequirementCodeFilterComponent cf : dr.getCodeFilter()) {
|
||||
tr = tbl.tr();
|
||||
if (cf.hasPath()) {
|
||||
tr.td().tx(cf.getPath());
|
||||
} else {
|
||||
tr.td().tx("Search on " +cf.getSearchParam());
|
||||
tr.td().tx(/*!#*/"Search on " +cf.getSearchParam());
|
||||
}
|
||||
if (cf.hasValueSet()) {
|
||||
td = tr.td();
|
||||
td.tx("In ValueSet ");
|
||||
td.tx(/*!#*/"In ValueSet ");
|
||||
render(td, cf.getValueSetElement());
|
||||
} else {
|
||||
boolean first = true;
|
||||
td = tr.td();
|
||||
td.tx("One of these codes: ");
|
||||
td.tx(/*!#*/"One of these codes: ");
|
||||
for (Coding c : cf.getCode()) {
|
||||
if (first) first = false; else td.tx(", ");
|
||||
render(td, c);
|
||||
|
@ -1711,7 +1727,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
if (cf.hasPath()) {
|
||||
tr.td().tx(cf.getPath());
|
||||
} else {
|
||||
tr.td().tx("Search on " +cf.getSearchParam());
|
||||
tr.td().tx(/*!#*/"Search on " +cf.getSearchParam());
|
||||
}
|
||||
render(tr.td(), cf.getValue());
|
||||
}
|
||||
|
@ -1719,7 +1735,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
tr = tbl.tr();
|
||||
td = tr.td().colspan("2");
|
||||
if (dr.hasLimit()) {
|
||||
td.b().tx("Limit");
|
||||
td.b().tx(/*!#*/"Limit");
|
||||
td.tx(": ");
|
||||
td.tx(dr.getLimit());
|
||||
if (dr.hasSort()) {
|
||||
|
@ -1727,7 +1743,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
}
|
||||
if (dr.hasSort()) {
|
||||
td.b().tx("Sort");
|
||||
td.b().tx(/*!#*/"Sort");
|
||||
td.tx(": ");
|
||||
boolean first = true;
|
||||
for (DataRequirementSortComponent p : dr.getSort()) {
|
||||
|
@ -1743,7 +1759,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
private String displayTiming(Timing s) throws FHIRException {
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
if (s.hasCode())
|
||||
b.append("Code: "+displayCodeableConcept(s.getCode()));
|
||||
b.append(/*!#*/"Code: "+displayCodeableConcept(s.getCode()));
|
||||
|
||||
if (s.getEvent().size() > 0) {
|
||||
CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
|
||||
|
@ -1754,17 +1770,17 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
c.append("??");
|
||||
}
|
||||
}
|
||||
b.append("Events: "+ c.toString());
|
||||
b.append(/*!#*/"Events: "+ c.toString());
|
||||
}
|
||||
|
||||
if (s.hasRepeat()) {
|
||||
TimingRepeatComponent rep = s.getRepeat();
|
||||
if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasStart())
|
||||
b.append("Starting "+displayDateTime(rep.getBoundsPeriod().getStartElement()));
|
||||
b.append(/*!#*/"Starting "+displayDateTime(rep.getBoundsPeriod().getStartElement()));
|
||||
if (rep.hasCount())
|
||||
b.append("Count "+Integer.toString(rep.getCount())+" times");
|
||||
b.append(/*!#*/"Count "+Integer.toString(rep.getCount())+" times");
|
||||
if (rep.hasDuration())
|
||||
b.append("Duration "+rep.getDuration().toPlainString()+displayTimeUnits(rep.getPeriodUnit()));
|
||||
b.append(/*!#*/"Duration "+rep.getDuration().toPlainString()+displayTimeUnits(rep.getPeriodUnit()));
|
||||
|
||||
if (rep.hasWhen()) {
|
||||
String st = "";
|
||||
|
@ -1777,14 +1793,14 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
} else {
|
||||
String st = "";
|
||||
if (!rep.hasFrequency() || (!rep.hasFrequencyMax() && rep.getFrequency() == 1) )
|
||||
st = "Once";
|
||||
st = /*!#*/"Once";
|
||||
else {
|
||||
st = Integer.toString(rep.getFrequency());
|
||||
if (rep.hasFrequencyMax())
|
||||
st = st + "-"+Integer.toString(rep.getFrequency());
|
||||
}
|
||||
if (rep.hasPeriod()) {
|
||||
st = st + " per "+rep.getPeriod().toPlainString();
|
||||
st = st + " "+/*!#*/"per "+rep.getPeriod().toPlainString();
|
||||
if (rep.hasPeriodMax())
|
||||
st = st + "-"+rep.getPeriodMax().toPlainString();
|
||||
st = st + " "+displayTimeUnits(rep.getPeriodUnit());
|
||||
|
@ -1792,7 +1808,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
b.append(st);
|
||||
}
|
||||
if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasEnd())
|
||||
b.append("Until "+displayDateTime(rep.getBoundsPeriod().getEndElement()));
|
||||
b.append(/*!#*/"Until "+displayDateTime(rep.getBoundsPeriod().getEndElement()));
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
@ -1808,20 +1824,20 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
|
||||
private String displayEventCode(EventTiming when) {
|
||||
switch (when) {
|
||||
case C: return "at meals";
|
||||
case CD: return "at lunch";
|
||||
case CM: return "at breakfast";
|
||||
case CV: return "at dinner";
|
||||
case AC: return "before meals";
|
||||
case ACD: return "before lunch";
|
||||
case ACM: return "before breakfast";
|
||||
case ACV: return "before dinner";
|
||||
case HS: return "before sleeping";
|
||||
case PC: return "after meals";
|
||||
case PCD: return "after lunch";
|
||||
case PCM: return "after breakfast";
|
||||
case PCV: return "after dinner";
|
||||
case WAKE: return "after waking";
|
||||
case C: return /*!#*/"at meals";
|
||||
case CD: return /*!#*/"at lunch";
|
||||
case CM: return /*!#*/"at breakfast";
|
||||
case CV: return /*!#*/"at dinner";
|
||||
case AC: return /*!#*/"before meals";
|
||||
case ACD: return /*!#*/"before lunch";
|
||||
case ACM: return /*!#*/"before breakfast";
|
||||
case ACV: return /*!#*/"before dinner";
|
||||
case HS: return /*!#*/"before sleeping";
|
||||
case PC: return /*!#*/"after meals";
|
||||
case PCD: return /*!#*/"after lunch";
|
||||
case PCM: return /*!#*/"after breakfast";
|
||||
case PCV: return /*!#*/"after dinner";
|
||||
case WAKE: return /*!#*/"after waking";
|
||||
default: return "?ngen-6?";
|
||||
}
|
||||
}
|
||||
|
@ -1849,29 +1865,29 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
private String displaySampledData(SampledData s) {
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
if (s.hasOrigin())
|
||||
b.append("Origin: "+displayQuantity(s.getOrigin()));
|
||||
b.append(/*!#*/"Origin: "+displayQuantity(s.getOrigin()));
|
||||
|
||||
if (s.hasInterval()) {
|
||||
b.append("Interval: "+s.getInterval().toString());
|
||||
b.append(/*!#*/"Interval: "+s.getInterval().toString());
|
||||
|
||||
if (s.hasIntervalUnit())
|
||||
b.append(s.getIntervalUnit().toString());
|
||||
}
|
||||
|
||||
if (s.hasFactor())
|
||||
b.append("Factor: "+s.getFactor().toString());
|
||||
b.append(/*!#*/"Factor: "+s.getFactor().toString());
|
||||
|
||||
if (s.hasLowerLimit())
|
||||
b.append("Lower: "+s.getLowerLimit().toString());
|
||||
b.append(/*!#*/"Lower: "+s.getLowerLimit().toString());
|
||||
|
||||
if (s.hasUpperLimit())
|
||||
b.append("Upper: "+s.getUpperLimit().toString());
|
||||
b.append(/*!#*/"Upper: "+s.getUpperLimit().toString());
|
||||
|
||||
if (s.hasDimensions())
|
||||
b.append("Dimensions: "+s.getDimensions());
|
||||
b.append(/*!#*/"Dimensions: "+s.getDimensions());
|
||||
|
||||
if (s.hasData())
|
||||
b.append("Data: "+s.getData());
|
||||
b.append(/*!#*/"Data: "+s.getData());
|
||||
|
||||
return b.toString();
|
||||
}
|
||||
|
@ -1889,7 +1905,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
XhtmlNode xn;
|
||||
xn = new XhtmlNode(NodeType.Element, "div");
|
||||
XhtmlNode p = xn.para();
|
||||
p.b().tx("Exception "+function+": "+e.getMessage());
|
||||
p.b().tx(/*!#*/"Exception "+function+": "+e.getMessage());
|
||||
p.addComment(getStackTrace(e));
|
||||
return xn;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
XhtmlNode tr;
|
||||
if (dr.has("subject")) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Subject");
|
||||
tr.td().tx(/*!#*/"Subject");
|
||||
populateSubjectSummary(tr.td(), getProperty(dr, "subject").value());
|
||||
}
|
||||
|
||||
|
@ -71,13 +71,13 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
|
||||
if (dr.has("effective[x]")) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("When For");
|
||||
tr.td().tx(/*!#*/"When For");
|
||||
eff = (DataType) getProperty(dr, "effective[x]").value().getBase();
|
||||
render(tr.td(), eff);
|
||||
}
|
||||
if (dr.has("issued")) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Reported");
|
||||
tr.td().tx(/*!#*/"Reported");
|
||||
eff = (DataType) getProperty(dr, "issued").value().getBase();
|
||||
render(tr.td(), getProperty(dr, "issued").value());
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
pw = getProperty(dr, "perfomer");
|
||||
if (valued(pw)) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Performer", pw.getValues().size()));
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Performer", pw.getValues().size()));
|
||||
XhtmlNode tdr = tr.td();
|
||||
for (BaseWrapper v : pw.getValues()) {
|
||||
tdr.tx(" ");
|
||||
|
@ -95,7 +95,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
pw = getProperty(dr, "identifier");
|
||||
if (valued(pw)) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Identifier", pw.getValues().size())+":");
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Identifier", pw.getValues().size())+":");
|
||||
XhtmlNode tdr = tr.td();
|
||||
for (BaseWrapper v : pw.getValues()) {
|
||||
tdr.tx(" ");
|
||||
|
@ -105,7 +105,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
pw = getProperty(dr, "request");
|
||||
if (valued(pw)) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Request", pw.getValues().size())+":");
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Request", pw.getValues().size())+":");
|
||||
XhtmlNode tdr = tr.td();
|
||||
for (BaseWrapper v : pw.getValues()) {
|
||||
tdr.tx(" ");
|
||||
|
@ -115,7 +115,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
|
||||
x.para().b().tx("Report Details");
|
||||
x.para().b().tx(/*!#*/"Report Details");
|
||||
|
||||
pw = getProperty(dr, "result");
|
||||
if (valued(pw)) {
|
||||
|
@ -138,7 +138,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (valued(pw)) {
|
||||
XhtmlNode p = x.para();
|
||||
p.b().tx("Coded Conclusions :");
|
||||
p.b().tx(/*!#*/"Coded Conclusions :");
|
||||
XhtmlNode ul = x.ul();
|
||||
for (BaseWrapper v : pw.getValues()) {
|
||||
render(ul.li(), v);
|
||||
|
@ -174,11 +174,11 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
private void populateSubjectSummary(XhtmlNode container, BaseWrapper subject) throws UnsupportedEncodingException, FHIRException, IOException, EOperationOutcome {
|
||||
ResourceWrapper r = fetchResource(subject);
|
||||
if (r == null)
|
||||
container.tx("Unable to get Patient Details");
|
||||
container.tx(/*!#*/"Unable to get Patient Details");
|
||||
else if (r.getName().equals("Patient"))
|
||||
generatePatientSummary(container, r);
|
||||
else
|
||||
container.tx("Not done yet");
|
||||
container.tx(/*!#*/"Not done yet");
|
||||
}
|
||||
|
||||
private void generatePatientSummary(XhtmlNode c, ResourceWrapper r) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
|
||||
|
@ -218,22 +218,22 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
if (issued) cs++;
|
||||
if (effectiveTime) cs++;
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx("Code");
|
||||
tr.td().b().tx("Value");
|
||||
tr.td().b().tx(/*!#*/"Code");
|
||||
tr.td().b().tx(/*!#*/"Value");
|
||||
if (refRange) {
|
||||
tr.td().b().tx("Reference Range");
|
||||
tr.td().b().tx(/*!#*/"Reference Range");
|
||||
}
|
||||
if (flags) {
|
||||
tr.td().b().tx("Flags");
|
||||
tr.td().b().tx(/*!#*/"Flags");
|
||||
}
|
||||
if (note) {
|
||||
tr.td().b().tx("Note");
|
||||
tr.td().b().tx(/*!#*/"Note");
|
||||
}
|
||||
if (effectiveTime) {
|
||||
tr.td().b().tx("When For");
|
||||
tr.td().b().tx(/*!#*/"When For");
|
||||
}
|
||||
if (issued) {
|
||||
tr.td().b().tx("Reported");
|
||||
tr.td().b().tx(/*!#*/"Reported");
|
||||
}
|
||||
for (ObservationNode o : observations) {
|
||||
addObservationToTable(tbl, o, 0, Integer.toString(cs), refRange, flags, note, effectiveTime, issued, eff, iss);
|
||||
|
@ -340,13 +340,13 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
XhtmlNode tr = tbl.tr();
|
||||
if (o.obs != null && o.obs.getReference() == null) {
|
||||
XhtmlNode td = tr.td().colspan(cs);
|
||||
td.i().tx("This Observation could not be resolved");
|
||||
td.i().tx(/*!#*/"This Observation could not be resolved");
|
||||
} else {
|
||||
if (o.obs != null && o.obs.getResource() != null) {
|
||||
addObservationToTable(tr, o.obs.getResource(), i, o.obs.getReference(), refRange, flags, note, effectiveTime, issued, eff, iss);
|
||||
} else {
|
||||
XhtmlNode td = tr.td().colspan(cs);
|
||||
td.i().tx("Observation");
|
||||
td.i().tx(/*!#*/"Observation");
|
||||
}
|
||||
if (o.contained != null) {
|
||||
for (ObservationNode c : o.contained) {
|
||||
|
@ -380,7 +380,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
pw = getProperty(obs, "dataAbsentReason");
|
||||
if (valued(pw)) {
|
||||
XhtmlNode span = td.span("color: maroon", "Error");
|
||||
span.tx("Error: ");
|
||||
span.tx(/*!#*/"Error: ");
|
||||
render(span.b(), pw.value());
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
PropertyWrapper pwrA = getProperty(v, "age");
|
||||
if (valued(pwr) || valued(pwrA)) {
|
||||
boolean firstA = true;
|
||||
td.tx(" for ");
|
||||
td.tx(" "+/*!#*/"for ");
|
||||
if (valued(pwr)) {
|
||||
for (BaseWrapper va : pwr.getValues()) {
|
||||
if (firstA) firstA = false; else td.tx(", ");
|
||||
|
@ -430,7 +430,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (valued(pwrA)) {
|
||||
if (firstA) firstA = false; else td.tx(", ");
|
||||
td.tx("Age ");
|
||||
td.tx(/*!#*/"Age ");
|
||||
render(td, pwrA.value());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,11 +43,11 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
case PROCESSES:
|
||||
return renderProcesses(x, scen);
|
||||
default:
|
||||
throw new FHIRException("Unknown ExampleScenario Renderer Mode " + context.getScenarioMode());
|
||||
throw new FHIRException(/*!#*/"Unknown ExampleScenario Renderer Mode " + context.getScenarioMode());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new FHIRException("Error rendering ExampleScenario " + scen.getUrl(), e);
|
||||
throw new FHIRException(/*!#*/"Error rendering ExampleScenario " + scen.getUrl(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
for (ExampleScenarioProcessStepComponent step: process.getStep()) {
|
||||
plantUml += toPlantUml(step, stepPrefix(prefix, step, stepCount), scen, actorsActive, actorKeys);
|
||||
if (step.getPause())
|
||||
plantUml += "... time passes ...\n";
|
||||
plantUml += /*!#*/"... time passes ...\n";
|
||||
stepCount++;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
XhtmlNode n = new XhtmlDocument();
|
||||
renderCanonical(scen, n, step.getWorkflow());
|
||||
XhtmlNode ref = n.getChildNodes().get(0);
|
||||
plantUml += noteOver(scen.getActor(), "Step " + trimPrefix(prefix) + " - See scenario\n" + creolLink(ref.getContent(), ref.getAttribute("href")));
|
||||
plantUml += noteOver(scen.getActor(), /*!#*/"Step " + trimPrefix(prefix) + " - See scenario\n" + creolLink(ref.getContent(), ref.getAttribute("href")));
|
||||
} else if (step.hasProcess())
|
||||
plantUml += toPlantUml(step.getProcess(), prefix, scen, actorKeys);
|
||||
else {
|
||||
|
@ -211,9 +211,9 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
public boolean renderActors(XhtmlNode x, ExampleScenario scen) throws IOException {
|
||||
XhtmlNode tbl = x.table("table-striped table-bordered");
|
||||
XhtmlNode thead = tbl.tr();
|
||||
thead.th().addText("Name");
|
||||
thead.th().addText("Type");
|
||||
thead.th().addText("Description");
|
||||
thead.th().addText(/*!#*/"Name");
|
||||
thead.th().addText(/*!#*/"Type");
|
||||
thead.th().addText(/*!#*/"Description");
|
||||
for (ExampleScenarioActorComponent actor : scen.getActor()) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
XhtmlNode nameCell = tr.td();
|
||||
|
@ -228,10 +228,10 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
public boolean renderInstances(XhtmlNode x, ExampleScenario scen) throws IOException {
|
||||
XhtmlNode tbl = x.table("table-striped table-bordered");
|
||||
XhtmlNode thead = tbl.tr();
|
||||
thead.th().addText("Name");
|
||||
thead.th().addText("Type");
|
||||
thead.th().addText("Content");
|
||||
thead.th().addText("Description");
|
||||
thead.th().addText(/*!#*/"Name");
|
||||
thead.th().addText(/*!#*/"Type");
|
||||
thead.th().addText(/*!#*/"Content");
|
||||
thead.th().addText(/*!#*/"Description");
|
||||
|
||||
Map<String, String> instanceNames = new HashMap<String, String>();
|
||||
for (ExampleScenarioInstanceComponent instance : scen.getInstance()) {
|
||||
|
@ -254,7 +254,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
|
||||
if (!instance.hasStructureVersion() || instance.getStructureType().getSystem().equals("")) {
|
||||
if (instance.hasStructureVersion())
|
||||
typeCell.tx("FHIR version " + instance.getStructureVersion() + " ");
|
||||
typeCell.tx(/*!#*/"FHIR version " + instance.getStructureVersion() + " ");
|
||||
if (instance.hasStructureProfile()) {
|
||||
renderCanonical(scen, typeCell, instance.getStructureProfile().toString());
|
||||
} else {
|
||||
|
@ -262,7 +262,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
}
|
||||
} else {
|
||||
render(typeCell, instance.getStructureVersionElement());
|
||||
typeCell.tx(" version " + instance.getStructureVersion());
|
||||
typeCell.tx(" "+/*!#*/"version " + instance.getStructureVersion());
|
||||
if (instance.hasStructureProfile()) {
|
||||
typeCell.tx(" ");
|
||||
renderCanonical(scen, typeCell, instance.getStructureProfile().toString());
|
||||
|
@ -280,7 +280,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
XhtmlNode descCell = row.td();
|
||||
addMarkdown(descCell, instance.getDescription());
|
||||
if (instance.hasContainedInstance()) {
|
||||
descCell.b().tx("Contains: ");
|
||||
descCell.b().tx(/*!#*/"Contains: ");
|
||||
int containedCount = 1;
|
||||
for (ExampleScenarioInstanceContainedInstanceComponent contained: instance.getContainedInstance()) {
|
||||
String key = "i_" + contained.getInstanceReference();
|
||||
|
@ -341,26 +341,26 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
public void renderProcess(XhtmlNode x, ExampleScenarioProcessComponent process, String prefix, Map<String, ExampleScenarioActorComponent> actors, Map<String, ExampleScenarioInstanceComponent> instances) throws IOException {
|
||||
XhtmlNode div = x.div();
|
||||
div.an("p_" + prefix);
|
||||
div.b().tx("Process: " + process.getTitle());
|
||||
div.b().tx(/*!#*/"Process: " + process.getTitle());
|
||||
if (process.hasDescription())
|
||||
addMarkdown(div, process.getDescription());
|
||||
if (process.hasPreConditions()) {
|
||||
div.para().b().i().tx("Pre-conditions:");
|
||||
div.para().b().i().tx(/*!#*/"Pre-conditions:");
|
||||
addMarkdown(div, process.getPreConditions());
|
||||
}
|
||||
if (process.hasPostConditions()) {
|
||||
div.para().b().i().tx("Post-conditions:");
|
||||
div.para().b().i().tx(/*!#*/"Post-conditions:");
|
||||
addMarkdown(div, process.getPostConditions());
|
||||
}
|
||||
XhtmlNode tbl = div.table("table-striped table-bordered").style("width:100%");
|
||||
XhtmlNode thead = tbl.tr();
|
||||
thead.th().addText("Step");
|
||||
thead.th().addText("Name");
|
||||
thead.th().addText("Description");
|
||||
thead.th().addText("Initator");
|
||||
thead.th().addText("Receiver");
|
||||
thead.th().addText("Request");
|
||||
thead.th().addText("Response");
|
||||
thead.th().addText(/*!#*/"Step");
|
||||
thead.th().addText(/*!#*/"Name");
|
||||
thead.th().addText(/*!#*/"Description");
|
||||
thead.th().addText(/*!#*/"Initator");
|
||||
thead.th().addText(/*!#*/"Receiver");
|
||||
thead.th().addText(/*!#*/"Request");
|
||||
thead.th().addText(/*!#*/"Response");
|
||||
int stepCount = 1;
|
||||
for (ExampleScenarioProcessStepComponent step: process.getStep()) {
|
||||
renderStep(tbl, step, stepPrefix(prefix, step, stepCount), actors, instances);
|
||||
|
@ -407,13 +407,13 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
prefixCell.tx(stepLabel.substring(stepLabel.indexOf(".") + 1));
|
||||
if (step.hasProcess()) {
|
||||
XhtmlNode n = row.td().colspan(6);
|
||||
n.tx("See subprocess" );
|
||||
n.tx(/*!#*/"See subprocess" );
|
||||
n.ah("#p_" + stepLabel, step.getProcess().getTitle());
|
||||
n.tx(" below");
|
||||
n.tx(" "+/*!#*/"below");
|
||||
|
||||
} else if (step.hasWorkflow()) {
|
||||
XhtmlNode n = row.td().colspan(6);
|
||||
n.tx("See other scenario ");
|
||||
n.tx(/*!#*/"See other scenario ");
|
||||
String link = new ContextUtilities(context.getWorker()).getLinkForUrl(context.getLink(KnownLinkType.SPEC), step.getWorkflow());
|
||||
n.ah(link, step.getProcess().getTitle());
|
||||
|
||||
|
@ -438,7 +438,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
int altNum = 1;
|
||||
for (ExampleScenarioProcessStepAlternativeComponent alt : step.getAlternative()) {
|
||||
XhtmlNode altHeading = tbl.tr().colspan(7).td();
|
||||
altHeading.para().i().tx("Alternative " + alt.getTitle());
|
||||
altHeading.para().i().tx(/*!#*/"Alternative " + alt.getTitle());
|
||||
if (alt.hasDescription())
|
||||
addMarkdown(altHeading, alt.getDescription());
|
||||
int stepCount = 1;
|
||||
|
@ -458,7 +458,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
return;
|
||||
ExampleScenarioActorComponent actor = actors.get(actorId);
|
||||
if (actor==null)
|
||||
throw new FHIRException("Unable to find referenced actor " + actorId);
|
||||
throw new FHIRException(/*!#*/"Unable to find referenced actor " + actorId);
|
||||
actorCell.ah("#a_" + actor.getKey(), actor.getDescription()).tx(actor.getTitle());
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
return;
|
||||
ExampleScenarioInstanceComponent instance = instances.get(instanceRef.getInstanceReference());
|
||||
if (instance==null)
|
||||
throw new FHIRException("Unable to find referenced instance " + instanceRef.getInstanceReference());
|
||||
throw new FHIRException(/*!#*/"Unable to find referenced instance " + instanceRef.getInstanceReference());
|
||||
if (instanceRef.hasVersionReference()) {
|
||||
ExampleScenarioInstanceVersionComponent theVersion = null;
|
||||
for (ExampleScenarioInstanceVersionComponent version: instance.getVersion()) {
|
||||
|
@ -478,7 +478,7 @@ public class ExampleScenarioRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
if (theVersion==null)
|
||||
throw new FHIRException("Unable to find referenced version " + instanceRef.getVersionReference() + " within instance " + instanceRef.getInstanceReference());
|
||||
throw new FHIRException(/*!#*/"Unable to find referenced version " + instanceRef.getVersionReference() + " within instance " + instanceRef.getInstanceReference());
|
||||
instanceCell.ah("#i_" + instance.getKey() + "v_"+ theVersion.getKey() , theVersion.getDescription()).tx(theVersion.getTitle());
|
||||
|
||||
} else
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ImplementationGuideRenderer extends ResourceRenderer {
|
|||
|
||||
public boolean render(XhtmlNode x, ImplementationGuide ig) throws FHIRFormatError, DefinitionException, IOException {
|
||||
x.h2().addText(ig.getName());
|
||||
x.para().tx("The official URL for this implementation guide is: ");
|
||||
x.para().tx(/*!#*/"The official URL for this implementation guide is: ");
|
||||
x.pre().tx(ig.getUrl());
|
||||
addMarkdown(x, ig.getDescription());
|
||||
return true;
|
||||
|
|
|
@ -49,32 +49,32 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
boolean email = hasCT(authors, "email") || hasCT(editors, "email") || hasCT(reviewers, "email") || hasCT(endorsers, "email");
|
||||
boolean phone = hasCT(authors, "phone") || hasCT(editors, "phone") || hasCT(reviewers, "phone") || hasCT(endorsers, "phone");
|
||||
boolean url = hasCT(authors, "url") || hasCT(editors, "url") || hasCT(reviewers, "url") || hasCT(endorsers, "url");
|
||||
x.h2().tx("Participants");
|
||||
x.h2().tx(/*!#*/"Participants");
|
||||
XhtmlNode t = x.table("grid");
|
||||
if (authors != null) {
|
||||
for (BaseWrapper cd : authors.getValues()) {
|
||||
participantRow(t, "Author", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Author", cd, email, phone, url);
|
||||
}
|
||||
}
|
||||
if (authors != null) {
|
||||
for (BaseWrapper cd : editors.getValues()) {
|
||||
participantRow(t, "Editor", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Editor", cd, email, phone, url);
|
||||
}
|
||||
}
|
||||
if (authors != null) {
|
||||
for (BaseWrapper cd : reviewers.getValues()) {
|
||||
participantRow(t, "Reviewer", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Reviewer", cd, email, phone, url);
|
||||
}
|
||||
}
|
||||
if (authors != null) {
|
||||
for (BaseWrapper cd : endorsers.getValues()) {
|
||||
participantRow(t, "Endorser", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Endorser", cd, email, phone, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertyWrapper artifacts = lib.getChildByName("relatedArtifact");
|
||||
if (artifacts != null && artifacts.hasValues()) {
|
||||
x.h2().tx("Related Artifacts");
|
||||
x.h2().tx(/*!#*/"Related Artifacts");
|
||||
XhtmlNode t = x.table("grid");
|
||||
boolean label = false;
|
||||
boolean display = false;
|
||||
|
@ -90,7 +90,7 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
}
|
||||
PropertyWrapper parameters = lib.getChildByName("parameter");
|
||||
if (parameters != null && parameters.hasValues()) {
|
||||
x.h2().tx("Parameters");
|
||||
x.h2().tx(/*!#*/"Parameters");
|
||||
XhtmlNode t = x.table("grid");
|
||||
boolean doco = false;
|
||||
for (BaseWrapper p : parameters.getValues()) {
|
||||
|
@ -102,14 +102,14 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
}
|
||||
PropertyWrapper dataRequirements = lib.getChildByName("dataRequirement");
|
||||
if (dataRequirements != null && dataRequirements.hasValues()) {
|
||||
x.h2().tx("Data Requirements");
|
||||
x.h2().tx(/*!#*/"Data Requirements");
|
||||
for (BaseWrapper p : dataRequirements.getValues()) {
|
||||
renderDataRequirement(x, (DataRequirement) p.getBase());
|
||||
}
|
||||
}
|
||||
PropertyWrapper contents = lib.getChildByName("content");
|
||||
if (contents != null) {
|
||||
x.h2().tx("Contents");
|
||||
x.h2().tx(/*!#*/"Contents");
|
||||
boolean isCql = false;
|
||||
int counter = 0;
|
||||
for (BaseWrapper p : contents.getValues()) {
|
||||
|
@ -151,23 +151,23 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
boolean email = hasCT(lib.getAuthor(), "email") || hasCT(lib.getEditor(), "email") || hasCT(lib.getReviewer(), "email") || hasCT(lib.getEndorser(), "email");
|
||||
boolean phone = hasCT(lib.getAuthor(), "phone") || hasCT(lib.getEditor(), "phone") || hasCT(lib.getReviewer(), "phone") || hasCT(lib.getEndorser(), "phone");
|
||||
boolean url = hasCT(lib.getAuthor(), "url") || hasCT(lib.getEditor(), "url") || hasCT(lib.getReviewer(), "url") || hasCT(lib.getEndorser(), "url");
|
||||
x.h2().tx("Participants");
|
||||
x.h2().tx(/*!#*/"Participants");
|
||||
XhtmlNode t = x.table("grid");
|
||||
for (ContactDetail cd : lib.getAuthor()) {
|
||||
participantRow(t, "Author", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Author", cd, email, phone, url);
|
||||
}
|
||||
for (ContactDetail cd : lib.getEditor()) {
|
||||
participantRow(t, "Editor", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Editor", cd, email, phone, url);
|
||||
}
|
||||
for (ContactDetail cd : lib.getReviewer()) {
|
||||
participantRow(t, "Reviewer", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Reviewer", cd, email, phone, url);
|
||||
}
|
||||
for (ContactDetail cd : lib.getEndorser()) {
|
||||
participantRow(t, "Endorser", cd, email, phone, url);
|
||||
participantRow(t, /*!#*/"Endorser", cd, email, phone, url);
|
||||
}
|
||||
}
|
||||
if (lib.hasRelatedArtifact()) {
|
||||
x.h2().tx("Related Artifacts");
|
||||
x.h2().tx(/*!#*/"Related Artifacts");
|
||||
XhtmlNode t = x.table("grid");
|
||||
boolean label = false;
|
||||
boolean display = false;
|
||||
|
@ -182,7 +182,7 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
if (lib.hasParameter()) {
|
||||
x.h2().tx("Parameters");
|
||||
x.h2().tx(/*!#*/"Parameters");
|
||||
XhtmlNode t = x.table("grid");
|
||||
boolean doco = false;
|
||||
for (ParameterDefinition p : lib.getParameter()) {
|
||||
|
@ -193,13 +193,13 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
if (lib.hasDataRequirement()) {
|
||||
x.h2().tx("Data Requirements");
|
||||
x.h2().tx(/*!#*/"Data Requirements");
|
||||
for (DataRequirement p : lib.getDataRequirement()) {
|
||||
renderDataRequirement(x, p);
|
||||
}
|
||||
}
|
||||
if (lib.hasContent()) {
|
||||
x.h2().tx("Contents");
|
||||
x.h2().tx(/*!#*/"Contents");
|
||||
boolean isCql = false;
|
||||
int counter = 0;
|
||||
for (Attachment att : lib.getContent()) {
|
||||
|
@ -356,7 +356,7 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
p.tx(att.getTitle());
|
||||
p.tx(": ");
|
||||
}
|
||||
p.code().tx("No Content");
|
||||
p.code().tx(/*!#*/"No Content");
|
||||
p.tx(" (");
|
||||
p.code().tx(att.getContentType());
|
||||
p.tx(lang(att));
|
||||
|
@ -405,10 +405,10 @@ public class LibraryRenderer extends ResourceRenderer {
|
|||
p.tx(att.getTitle());
|
||||
p.tx(": ");
|
||||
}
|
||||
p.code().tx("Content not shown - (");
|
||||
p.code().tx(/*!#*/"Content not shown - (");
|
||||
p.code().tx(att.getContentType());
|
||||
p.tx(lang(att));
|
||||
p.tx(", size = "+Utilities.describeSize(att.getData().length)+")");
|
||||
p.tx(/*!#*/", size = "+Utilities.describeSize(att.getData().length)+")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,33 +40,33 @@ public class ListRenderer extends ResourceRenderer {
|
|||
XhtmlNode tr = t.tr();
|
||||
XhtmlNode td = tr.td();
|
||||
if (list.has("date")) {
|
||||
td.tx("Date: "+list.get("date").dateTimeValue().toHumanDisplay());
|
||||
td.tx(/*!#*/"Date: "+list.get("date").dateTimeValue().toHumanDisplay());
|
||||
}
|
||||
if (list.has("mode")) {
|
||||
td.tx("Mode: "+list.get("mode").primitiveValue());
|
||||
td.tx(/*!#*/"Mode: "+list.get("mode").primitiveValue());
|
||||
}
|
||||
if (list.has("status")) {
|
||||
td.tx("Status: "+list.get("status").primitiveValue());
|
||||
td.tx(/*!#*/"Status: "+list.get("status").primitiveValue());
|
||||
}
|
||||
if (list.has("code")) {
|
||||
td.tx("Code: "+displayBase(list.get("code")));
|
||||
td.tx(/*!#*/"Code: "+displayBase(list.get("code")));
|
||||
}
|
||||
tr = t.tr();
|
||||
td = tr.td();
|
||||
if (list.has("subject")) {
|
||||
td.tx("Subject: ");
|
||||
td.tx(/*!#*/"Subject: ");
|
||||
shortForRef(td, list.get("subject"));
|
||||
}
|
||||
if (list.has("encounter")) {
|
||||
td.tx("Encounter: ");
|
||||
td.tx(/*!#*/"Encounter: ");
|
||||
shortForRef(td, list.get("encounter"));
|
||||
}
|
||||
if (list.has("source")) {
|
||||
td.tx("Source: ");
|
||||
td.tx(/*!#*/"Source: ");
|
||||
shortForRef(td, list.get("encounter"));
|
||||
}
|
||||
if (list.has("orderedBy")) {
|
||||
td.tx("Order: "+displayBase(list.get("orderedBy")));
|
||||
td.tx(/*!#*/"Order: "+displayBase(list.get("orderedBy")));
|
||||
}
|
||||
// for (Annotation a : list.getNote()) {
|
||||
// renderAnnotation(a, x);
|
||||
|
@ -81,15 +81,15 @@ public class ListRenderer extends ResourceRenderer {
|
|||
}
|
||||
t = x.table("grid");
|
||||
tr = t.tr().style("backgound-color: #eeeeee");
|
||||
tr.td().b().tx("Items");
|
||||
tr.td().b().tx(/*!#*/"Items");
|
||||
if (date) {
|
||||
tr.td().tx("Date");
|
||||
tr.td().tx(/*!#*/"Date");
|
||||
}
|
||||
if (flag) {
|
||||
tr.td().tx("Flag");
|
||||
tr.td().tx(/*!#*/"Flag");
|
||||
}
|
||||
if (deleted) {
|
||||
tr.td().tx("Deleted");
|
||||
tr.td().tx(/*!#*/"Deleted");
|
||||
}
|
||||
for (BaseWrapper e : list.children("entry")) {
|
||||
tr = t.tr();
|
||||
|
@ -113,16 +113,16 @@ public class ListRenderer extends ResourceRenderer {
|
|||
XhtmlNode t = x.table("clstu");
|
||||
XhtmlNode tr = t.tr();
|
||||
if (list.hasDate()) {
|
||||
tr.td().tx("Date: "+list.getDate().toLocaleString());
|
||||
tr.td().tx(/*!#*/"Date: "+list.getDate().toLocaleString());
|
||||
}
|
||||
if (list.hasMode()) {
|
||||
tr.td().tx("Mode: "+list.getMode().getDisplay());
|
||||
tr.td().tx(/*!#*/"Mode: "+list.getMode().getDisplay());
|
||||
}
|
||||
if (list.hasStatus()) {
|
||||
tr.td().tx("Status: "+list.getStatus().getDisplay());
|
||||
tr.td().tx(/*!#*/"Status: "+list.getStatus().getDisplay());
|
||||
}
|
||||
if (list.hasCode()) {
|
||||
tr.td().tx("Code: "+display(list.getCode()));
|
||||
tr.td().tx(/*!#*/"Code: "+display(list.getCode()));
|
||||
}
|
||||
tr = t.tr();
|
||||
if (list.hasSubject()) {
|
||||
|
@ -130,7 +130,7 @@ public class ListRenderer extends ResourceRenderer {
|
|||
shortForRef(tr.td().txN("Subject: "), list.getSubjectFirstRep());
|
||||
} else {
|
||||
XhtmlNode td = tr.td();
|
||||
td.txN("Subject: ");
|
||||
td.txN(/*!#*/"Subject: ");
|
||||
int i = 0;
|
||||
for (Reference subj : list.getSubject()) {
|
||||
if (i == list.getSubject().size() - 1) {
|
||||
|
@ -143,13 +143,13 @@ public class ListRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
if (list.hasEncounter()) {
|
||||
shortForRef(tr.td().txN("Encounter: "), list.getEncounter());
|
||||
shortForRef(tr.td().txN(/*!#*/"Encounter: "), list.getEncounter());
|
||||
}
|
||||
if (list.hasSource()) {
|
||||
shortForRef(tr.td().txN("Source: "), list.getEncounter());
|
||||
shortForRef(tr.td().txN(/*!#*/"Source: "), list.getEncounter());
|
||||
}
|
||||
if (list.hasOrderedBy()) {
|
||||
tr.td().tx("Order: "+display(list.getOrderedBy()));
|
||||
tr.td().tx(/*!#*/"Order: "+display(list.getOrderedBy()));
|
||||
}
|
||||
for (Annotation a : list.getNote()) {
|
||||
renderAnnotation(x, a);
|
||||
|
@ -164,15 +164,15 @@ public class ListRenderer extends ResourceRenderer {
|
|||
}
|
||||
t = x.table("grid");
|
||||
tr = t.tr().style("backgound-color: #eeeeee");
|
||||
tr.td().b().tx("Items");
|
||||
tr.td().b().tx(/*!#*/"Items");
|
||||
if (date) {
|
||||
tr.td().tx("Date");
|
||||
tr.td().tx(/*!#*/"Date");
|
||||
}
|
||||
if (flag) {
|
||||
tr.td().tx("Flag");
|
||||
tr.td().tx(/*!#*/"Flag");
|
||||
}
|
||||
if (deleted) {
|
||||
tr.td().tx("Deleted");
|
||||
tr.td().tx(/*!#*/"Deleted");
|
||||
}
|
||||
for (ListResourceEntryComponent e : list.getEntry()) {
|
||||
tr = t.tr();
|
||||
|
|
|
@ -30,33 +30,33 @@ public class NamingSystemRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public boolean render(XhtmlNode x, NamingSystem ns) throws FHIRFormatError, DefinitionException, IOException {
|
||||
x.h3().tx("Summary");
|
||||
x.h3().tx(/*!#*/"Summary");
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
row(tbl, "Defining URL", ns.getUrl());
|
||||
row(tbl, /*!#*/"Defining URL", ns.getUrl());
|
||||
if (ns.hasVersion()) {
|
||||
row(tbl, "Version", ns.getVersion());
|
||||
row(tbl, /*!#*/"Version", ns.getVersion());
|
||||
}
|
||||
if (ns.hasName()) {
|
||||
row(tbl, "Name", gt(ns.getNameElement()));
|
||||
row(tbl, /*!#*/"Name", gt(ns.getNameElement()));
|
||||
}
|
||||
if (ns.hasTitle()) {
|
||||
row(tbl, "Title", gt(ns.getTitleElement()));
|
||||
row(tbl, /*!#*/"Title", gt(ns.getTitleElement()));
|
||||
}
|
||||
row(tbl, "Status", ns.getStatus().toCode());
|
||||
row(tbl, /*!#*/"Status", ns.getStatus().toCode());
|
||||
if (ns.hasDescription()) {
|
||||
addMarkdown(row(tbl, "Definition"), ns.getDescription());
|
||||
addMarkdown(row(tbl, /*!#*/"Definition"), ns.getDescription());
|
||||
}
|
||||
if (ns.hasPublisher()) {
|
||||
row(tbl, "Publisher", gt(ns.getPublisherElement()));
|
||||
row(tbl, /*!#*/"Publisher", gt(ns.getPublisherElement()));
|
||||
}
|
||||
if (ns.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
|
||||
renderCommitteeLink(row(tbl, "Committee"), ns);
|
||||
}
|
||||
if (CodeSystemUtilities.hasOID(ns)) {
|
||||
row(tbl, "OID", CodeSystemUtilities.getOID(ns)).tx("("+translate("ns.summary", "for OID based terminology systems")+")");
|
||||
row(tbl, /*!#*/"OID", CodeSystemUtilities.getOID(ns)).tx("("+(/*!#*/"for OID based terminology systems")+")");
|
||||
}
|
||||
if (ns.hasCopyright()) {
|
||||
addMarkdown(row(tbl, "Copyright"), ns.getCopyright());
|
||||
addMarkdown(row(tbl, /*!#*/"Copyright"), ns.getCopyright());
|
||||
}
|
||||
boolean hasPreferred = false;
|
||||
boolean hasPeriod = false;
|
||||
|
@ -66,19 +66,19 @@ public class NamingSystemRenderer extends ResourceRenderer {
|
|||
hasPeriod = hasPeriod || id.hasPeriod();
|
||||
hasComment = hasComment || id.hasComment();
|
||||
}
|
||||
x.h3().tx("Identifiers");
|
||||
x.h3().tx(/*!#*/"Identifiers");
|
||||
tbl = x.table("grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx(translate("ns.summary", "Type"));
|
||||
tr.td().b().tx(translate("ns.summary", "Value"));
|
||||
tr.td().b().tx((/*!#*/"Type"));
|
||||
tr.td().b().tx((/*!#*/"Value"));
|
||||
if (hasPreferred) {
|
||||
tr.td().b().tx(translate("ns.summary", "Preferred"));
|
||||
tr.td().b().tx((/*!#*/"Preferred"));
|
||||
}
|
||||
if (hasPeriod) {
|
||||
tr.td().b().tx(translate("ns.summary", "Period"));
|
||||
tr.td().b().tx((/*!#*/"Period"));
|
||||
}
|
||||
if (hasComment) {
|
||||
tr.td().b().tx(translate("ns.summary", "Comment"));
|
||||
tr.td().b().tx((/*!#*/"Comment"));
|
||||
}
|
||||
for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
|
||||
tr = tbl.tr();
|
||||
|
@ -100,7 +100,7 @@ public class NamingSystemRenderer extends ResourceRenderer {
|
|||
private XhtmlNode row(XhtmlNode tbl, String name) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
XhtmlNode td = tr.td();
|
||||
td.tx(translate("ns.summary", name));
|
||||
td.tx((name));
|
||||
return tr.td();
|
||||
}
|
||||
private XhtmlNode row(XhtmlNode tbl, String name, String value) {
|
||||
|
|
|
@ -353,21 +353,21 @@ public class ObligationsRenderer {
|
|||
|
||||
XhtmlNode tr = new XhtmlNode(NodeType.Element, "tr");
|
||||
children.add(tr);
|
||||
tr.td().style("font-size: 11px").b().tx("Obligations");
|
||||
tr.td().style("font-size: 11px").b().tx(/*!#*/"Obligations");
|
||||
if (actor) {
|
||||
tr.td().style("font-size: 11px").tx("Actor");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Actor");
|
||||
}
|
||||
if (elementId) {
|
||||
tr.td().style("font-size: 11px").tx("Elements");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Elements");
|
||||
}
|
||||
if (usage) {
|
||||
tr.td().style("font-size: 11px").tx("Usage");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Usage");
|
||||
}
|
||||
if (doco) {
|
||||
tr.td().style("font-size: 11px").tx("Documentation");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Documentation");
|
||||
}
|
||||
if (filter) {
|
||||
tr.td().style("font-size: 11px").tx("Filter");
|
||||
tr.td().style("font-size: 11px").tx(/*!#*/"Filter");
|
||||
}
|
||||
for (ObligationDetail ob : obligations) {
|
||||
tr = new XhtmlNode(NodeType.Element, "tr");
|
||||
|
|
|
@ -44,22 +44,22 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
|
|||
if (context.isHeader()) {
|
||||
x.h2().addText(opd.getName());
|
||||
x.para().addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName());
|
||||
x.para().tx("The official URL for this operation definition is: ");
|
||||
x.para().tx(/*!#*/"The official URL for this operation definition is: ");
|
||||
x.pre().tx(opd.getUrl());
|
||||
addMarkdown(x, opd.getDescription());}
|
||||
|
||||
if (opd.getSystem())
|
||||
x.para().tx("URL: [base]/$"+opd.getCode());
|
||||
x.para().tx(/*!#*/"URL: [base]/$"+opd.getCode());
|
||||
for (Enumeration<VersionIndependentResourceTypesAll> c : opd.getResource()) {
|
||||
if (opd.getType())
|
||||
x.para().tx("URL: [base]/"+c.getCode()+"/$"+opd.getCode());
|
||||
x.para().tx(/*!#*/"URL: [base]/"+c.getCode()+"/$"+opd.getCode());
|
||||
if (opd.getInstance())
|
||||
x.para().tx("URL: [base]/"+c.getCode()+"/[id]/$"+opd.getCode());
|
||||
x.para().tx(/*!#*/"URL: [base]/"+c.getCode()+"/[id]/$"+opd.getCode());
|
||||
}
|
||||
|
||||
if (opd.hasInputProfile()) {
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("Input parameters Profile: ");
|
||||
p.tx(/*!#*/"Input parameters Profile: ");
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, opd.getInputProfile(), opd);
|
||||
if (sd == null) {
|
||||
p.pre().tx(opd.getInputProfile());
|
||||
|
@ -69,7 +69,7 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (opd.hasOutputProfile()) {
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("Output parameters Profile: ");
|
||||
p.tx(/*!#*/"Output parameters Profile: ");
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, opd.getOutputProfile(), opd);
|
||||
if (sd == null) {
|
||||
p.pre().tx(opd.getOutputProfile());
|
||||
|
@ -77,16 +77,16 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
|
|||
p.ah(sd.getWebPath()).tx(sd.present());
|
||||
}
|
||||
}
|
||||
x.para().tx("Parameters");
|
||||
x.para().tx(/*!#*/"Parameters");
|
||||
XhtmlNode tbl = x.table( "grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx("Use");
|
||||
tr.td().b().tx("Name");
|
||||
tr.td().b().tx("Scope");
|
||||
tr.td().b().tx("Cardinality");
|
||||
tr.td().b().tx("Type");
|
||||
tr.td().b().tx("Binding");
|
||||
tr.td().b().tx("Documentation");
|
||||
tr.td().b().tx(/*!#*/"Use");
|
||||
tr.td().b().tx(/*!#*/"Name");
|
||||
tr.td().b().tx(/*!#*/"Scope");
|
||||
tr.td().b().tx(/*!#*/"Cardinality");
|
||||
tr.td().b().tx(/*!#*/"Type");
|
||||
tr.td().b().tx(/*!#*/"Binding");
|
||||
tr.td().b().tx(/*!#*/"Documentation");
|
||||
for (OperationDefinitionParameterComponent p : opd.getParameter()) {
|
||||
genOpParam(tbl, "", p, opd);
|
||||
}
|
||||
|
|
|
@ -41,17 +41,17 @@ public class OperationOutcomeRenderer extends ResourceRenderer {
|
|||
hasSource = hasSource || ExtensionHelper.hasExtension(i, ToolingExtensions.EXT_ISSUE_SOURCE);
|
||||
}
|
||||
if (success)
|
||||
x.para().tx("All OK");
|
||||
x.para().tx(/*!#*/"All OK");
|
||||
if (op.getIssue().size() > 0) {
|
||||
XhtmlNode tbl = x.table("grid"); // on the basis that we'll most likely be rendered using the standard fhir css, but it doesn't really matter
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().b().tx("Severity");
|
||||
tr.td().b().tx("Location");
|
||||
tr.td().b().tx("Code");
|
||||
tr.td().b().tx("Details");
|
||||
tr.td().b().tx("Diagnostics");
|
||||
tr.td().b().tx(/*!#*/"Severity");
|
||||
tr.td().b().tx(/*!#*/"Location");
|
||||
tr.td().b().tx(/*!#*/"Code");
|
||||
tr.td().b().tx(/*!#*/"Details");
|
||||
tr.td().b().tx(/*!#*/"Diagnostics");
|
||||
if (hasSource)
|
||||
tr.td().b().tx("Source");
|
||||
tr.td().b().tx(/*!#*/"Source");
|
||||
for (OperationOutcomeIssueComponent i : op.getIssue()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().addText(i.getSeverity().toString());
|
||||
|
@ -82,12 +82,12 @@ public class OperationOutcomeRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public String display(OperationOutcome oo) {
|
||||
return "todo";
|
||||
return /*!#*/"todo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String display(ResourceWrapper r) throws UnsupportedEncodingException, IOException {
|
||||
return "Not done yet";
|
||||
return /*!#*/"Not done yet";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ParametersRenderer extends ResourceRenderer {
|
|||
|
||||
@Override
|
||||
public boolean render(XhtmlNode x, Resource r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
|
||||
x.h2().tx("Parameters");
|
||||
x.h2().tx(/*!#*/"Parameters");
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
params(tbl, ((Parameters) r).getParameter(), 0);
|
||||
return false;
|
||||
|
@ -49,7 +49,7 @@ public class ParametersRenderer extends ResourceRenderer {
|
|||
|
||||
@Override
|
||||
public boolean render(XhtmlNode x, ResourceWrapper params) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
|
||||
x.h2().tx("Parameters");
|
||||
x.h2().tx(/*!#*/"Parameters");
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
PropertyWrapper pw = getProperty(params, "parameter");
|
||||
if (valued(pw)) {
|
||||
|
@ -95,7 +95,7 @@ public class ParametersRenderer extends ResourceRenderer {
|
|||
|
||||
public XhtmlNode render(Parameters params) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
|
||||
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
|
||||
div.h2().tx("Parameters");
|
||||
div.h2().tx(/*!#*/"Parameters");
|
||||
XhtmlNode tbl = div.table("grid");
|
||||
params(tbl, params.getParameter(), 0);
|
||||
return div;
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
|
|||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.PropertyWrapper;
|
||||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
@ -224,18 +225,18 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
b.append(display(name));
|
||||
b.append(" ");
|
||||
if (dob == null) {
|
||||
b.append("(no stated gender)");
|
||||
b.append("(no stated gender)"/*!#*/);
|
||||
} else {
|
||||
b.append(gender);
|
||||
}
|
||||
b.append(", ");
|
||||
if (dob == null) {
|
||||
b.append("DoB Unknown");
|
||||
b.append("DoB Unknown"/*!#*/);
|
||||
} else {
|
||||
b.append("DoB: "+display(dob));
|
||||
b.append(/*!#*/"DoB: "+display(dob));
|
||||
}
|
||||
if (id != null) {
|
||||
b.append(" ( ");
|
||||
b.append(" "+/*!#*/"( ");
|
||||
b.append(display(id));
|
||||
b.append(")");
|
||||
}
|
||||
|
@ -244,21 +245,21 @@ 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("Anonymous 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("(no stated gender)");
|
||||
x.tx(/*!#*/"(no stated gender)");
|
||||
} else {
|
||||
x.tx(gender);
|
||||
}
|
||||
x.tx(", ");
|
||||
if (dob == null) {
|
||||
x.tx("DoB Unknown");
|
||||
x.tx(/*!#*/"DoB Unknown");
|
||||
} else {
|
||||
x.tx("DoB: ");
|
||||
x.tx(/*!#*/"DoB: ");
|
||||
render(x, dob);
|
||||
}
|
||||
if (id != null) {
|
||||
|
@ -269,7 +270,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean render(XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException {
|
||||
public boolean render(XhtmlNode x, ResourceWrapper r) throws IOException, FHIRException, EOperationOutcome {
|
||||
// banner
|
||||
describe(makeBanner(x.para()), r);
|
||||
x.hr();
|
||||
|
@ -295,9 +296,22 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
if (tbl.isEmpty()) {
|
||||
x.remove(tbl);
|
||||
}
|
||||
if (r.has("contained") && context.isTechnicalMode()) {
|
||||
x.hr();
|
||||
x.para().b().tx(/*!#*/"Contained Resources");
|
||||
addContained(x, r.getContained());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addContained(XhtmlNode x, List<ResourceWrapper> list) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
|
||||
for (ResourceWrapper c : list) {
|
||||
x.hr();
|
||||
x.an(c.getId());
|
||||
new RendererFactory().factory(c, context).render(x, c);
|
||||
}
|
||||
}
|
||||
|
||||
private void addExtensions(XhtmlNode tbl, ResourceWrapper r) throws UnsupportedEncodingException, FHIRException, IOException {
|
||||
Map<String, List<Extension>> extensions = new HashMap<>();
|
||||
PropertyWrapper pw = getProperty(r, "extension");
|
||||
|
@ -378,13 +392,13 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
};
|
||||
if (ids.size() == 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Other Id:", "Other Ids (see the one above)");
|
||||
nameCell(tr, /*!#*/"Other Id:", /*!#*/"Other Ids (see the one above)");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
render(r, td, ids.get(0));
|
||||
} else if (ids.size() > 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Other Ids:", "Other Ids (see the one above)");
|
||||
nameCell(tr, /*!#*/"Other Ids:", /*!#*/"Other Ids (see the one above)");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
XhtmlNode ul = td.ul();
|
||||
|
@ -411,16 +425,16 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (langs.size() == 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Language:", "Languages spoken");
|
||||
nameCell(tr, /*!#*/"Language:", /*!#*/"Languages spoken");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
render(r, td, langs.get(0));
|
||||
if (prefLang != null) {
|
||||
td.tx(" (preferred)");
|
||||
td.tx(" "+/*!#*/"(preferred)");
|
||||
}
|
||||
} else if (langs.size() > 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Languages:", "Languages spoken");
|
||||
nameCell(tr, /*!#*/"Languages:", /*!#*/"Languages spoken");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
XhtmlNode ul = td.ul();
|
||||
|
@ -428,7 +442,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
XhtmlNode li = ul.li();
|
||||
render(r, li, i);
|
||||
if (i == prefLang) {
|
||||
li.tx(" (preferred)");
|
||||
li.tx(" "+/*!#*/"(preferred)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -440,13 +454,13 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
PropertyWrapper pw = getProperty(r, "generalPractitioner");
|
||||
if (pw != null) {
|
||||
for (BaseWrapper t : pw.getValues()) {
|
||||
refs.add(new NamedReferance("General Practitioner", (Reference) t.getBase(), t));
|
||||
refs.add(new NamedReferance(/*!#*/"General Practitioner", (Reference) t.getBase(), t));
|
||||
}
|
||||
}
|
||||
pw = getProperty(r, "managingOrganization");
|
||||
if (pw != null) {
|
||||
for (BaseWrapper t : pw.getValues()) {
|
||||
refs.add(new NamedReferance("Managing Organization", (Reference) t.getBase(), t));
|
||||
refs.add(new NamedReferance(/*!#*/"Managing Organization", (Reference) t.getBase(), t));
|
||||
}
|
||||
}
|
||||
pw = getProperty(r, "link");
|
||||
|
@ -470,7 +484,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
|
||||
if (refs.size() > 0) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Links:", "Patient Links");
|
||||
nameCell(tr, /*!#*/"Links:", /*!#*/"Patient Links");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
XhtmlNode ul = td.ul();
|
||||
|
@ -485,10 +499,10 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
|
||||
private String describeLinkedRecord(String type) {
|
||||
switch (type) {
|
||||
case "replaced-by" : return "This record replaced by";
|
||||
case "replaces": return "This record replaces";
|
||||
case "refer": return "Please refer to";
|
||||
case "seealso": return "Also see";
|
||||
case "replaced-by" : return /*!#*/"This record replaced by";
|
||||
case "replaces": return /*!#*/"This record replaces";
|
||||
case "refer": return /*!#*/"Please refer to";
|
||||
case "seealso": return /*!#*/"Also see";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
@ -550,9 +564,9 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
XhtmlNode tr = tbl.tr();
|
||||
if (rels.size() == 1) {
|
||||
nameCell(tr, (rels.get(0).getCodingFirstRep().hasDisplay() ? rels.get(0).getCodingFirstRep().getDisplay() : display(rels.get(0)))+":", "Nominated Contact: "+display(rels.get(0)));
|
||||
nameCell(tr, (rels.get(0).getCodingFirstRep().hasDisplay() ? rels.get(0).getCodingFirstRep().getDisplay() : display(rels.get(0)))+":", /*!#*/"Nominated Contact: "+display(rels.get(0)));
|
||||
} else {
|
||||
nameCell(tr, "Contact", "Patient contact");
|
||||
nameCell(tr, /*!#*/"Contact", /*!#*/"Patient contact");
|
||||
}
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
|
@ -562,15 +576,15 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
li = ul.li();
|
||||
render(r, li, name);
|
||||
if (gender != null) {
|
||||
li.tx(" ("+gender+")");
|
||||
li.tx(" "+/*!#*/"("+gender+")");
|
||||
}
|
||||
} else if (gender != null) {
|
||||
li = ul.li();
|
||||
li.tx("Gender: "+gender);
|
||||
li.tx(/*!#*/"Gender: "+gender);
|
||||
}
|
||||
if (rels.size() > 1) {
|
||||
li = ul.li();
|
||||
li.tx("Relationships: ");
|
||||
li.tx(/*!#*/"Relationships: ");
|
||||
boolean first = true;
|
||||
for (CodeableConcept rel : rels) {
|
||||
if (first) first = false; else li.tx(", ");
|
||||
|
@ -585,12 +599,12 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (organization != null) {
|
||||
li = ul.li();
|
||||
li.tx("Organization: ");
|
||||
li.tx(/*!#*/"Organization: ");
|
||||
render(r, li, organization);
|
||||
}
|
||||
if (period != null) {
|
||||
li = ul.li();
|
||||
li.tx("Valid Period: ");
|
||||
li.tx(/*!#*/"Valid Period: ");
|
||||
render(r, li, period);
|
||||
}
|
||||
}
|
||||
|
@ -610,13 +624,13 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
};
|
||||
if (names.size() == 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Alt. Name:", "Alternate names (see the one above)");
|
||||
nameCell(tr, /*!#*/"Alt. Name:", /*!#*/"Alternate names (see the one above)");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
render(r, td, names.get(0));
|
||||
} else if (names.size() > 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Alt Names:", "Alternate names (see the one above)");
|
||||
nameCell(tr, /*!#*/"Alt Names:", /*!#*/"Alternate names (see the one above)");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
XhtmlNode ul = td.ul();
|
||||
|
@ -639,7 +653,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (tels.size() + adds.size() == 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Contact Detail:", "Ways to contact the Patient");
|
||||
nameCell(tr, /*!#*/"Contact Detail:", /*!#*/"Ways to contact the Patient");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
if (adds.isEmpty()) {
|
||||
|
@ -649,7 +663,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
}
|
||||
} else if (tels.size() + adds.size() > 1) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
nameCell(tr, "Contact Details:", "Ways to contact the Patient");
|
||||
nameCell(tr, /*!#*/"Contact Details:", /*!#*/"Ways to contact the Patient");
|
||||
XhtmlNode td = tr.td();
|
||||
td.colspan("3");
|
||||
XhtmlNode ul = td.ul();
|
||||
|
@ -684,7 +698,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
PropertyWrapper a = r.getChildByName("active");
|
||||
if (a.hasValues()) {
|
||||
pos++;
|
||||
nameCell(tr, "Active:", "Record is active");
|
||||
nameCell(tr, /*!#*/"Active:", /*!#*/"Record is active");
|
||||
XhtmlNode td = tr.td();
|
||||
if (pos == count) {
|
||||
td.colspan("3");
|
||||
|
@ -696,7 +710,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
PropertyWrapper a = r.getChildByName("deceased[x]");
|
||||
if (a.hasValues()) {
|
||||
pos++;
|
||||
nameCell(tr, "Deceased:", "Known status of Patient");
|
||||
nameCell(tr, /*!#*/"Deceased:", /*!#*/"Known status of Patient");
|
||||
XhtmlNode td = tr.td();
|
||||
if (pos == count) {
|
||||
td.colspan("3");
|
||||
|
@ -711,7 +725,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
if (pos == 3) {
|
||||
tr = tbl.tr();
|
||||
}
|
||||
nameCell(tr, "Marital Status:", "Known Marital status of Patient");
|
||||
nameCell(tr, /*!#*/"Marital Status:", /*!#*/"Known Marital status of Patient");
|
||||
XhtmlNode td = tr.td();
|
||||
if (pos == count) {
|
||||
td.colspan("3");
|
||||
|
@ -726,7 +740,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
if (pos == 3) {
|
||||
tr = tbl.tr();
|
||||
}
|
||||
nameCell(tr, "Multiple Birth:", "Known multipleBirth status of Patient");
|
||||
nameCell(tr, /*!#*/"Multiple Birth:", /*!#*/"Known multipleBirth status of Patient");
|
||||
XhtmlNode td = tr.td();
|
||||
if (pos == count) {
|
||||
td.colspan("3");
|
||||
|
@ -769,7 +783,7 @@ public class PatientRenderer extends ResourceRenderer {
|
|||
String n = UUID.randomUUID().toString().toLowerCase()+ext;
|
||||
TextFile.bytesToFile(att.getData(), new File(Utilities.path(context.getDestDir(), n)));
|
||||
context.registerFile(n);
|
||||
td.img(n, "patient photo");
|
||||
td.img(n, /*!#*/"patient photo");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -107,9 +107,10 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
boolean idDone = false;
|
||||
XhtmlNode p = x.para();
|
||||
if (context.isAddGeneratedNarrativeHeader()) {
|
||||
p.b().tx("Generated Narrative: "+r.fhirType()+(context.isContained() ? " #"+r.getId() : ""));
|
||||
p.b().tx(/*!#*/"Generated Narrative: "+r.fhirType()+(context.isContained() ? " #"+r.getId() : ""));
|
||||
if (!Utilities.noString(r.getId())) {
|
||||
p.an(r.getId());
|
||||
p.an("hc"+r.getId());
|
||||
}
|
||||
idDone = true;
|
||||
}
|
||||
|
@ -119,11 +120,12 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (!Utilities.noString(r.getId()) && !idDone) {
|
||||
x.para().an(r.getId());
|
||||
x.para().an("hc"+r.getId());
|
||||
}
|
||||
try {
|
||||
StructureDefinition sd = r.getDefinition();
|
||||
if (sd == null) {
|
||||
throw new FHIRException("Cannot find definition for "+r.fhirType());
|
||||
throw new FHIRException(/*!#*/"Cannot find definition for "+r.fhirType());
|
||||
} else {
|
||||
ElementDefinition ed = sd.getSnapshot().getElement().get(0);
|
||||
containedIds.clear();
|
||||
|
@ -131,9 +133,9 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
generateByProfile(r, sd, r.root(), sd.getSnapshot().getElement(), ed, context.getProfileUtilities().getChildList(sd, ed), x, r.fhirType(), context.isTechnicalMode(), 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error Generating Narrative for "+r.fhirType()+"/"+r.getId()+": "+e.getMessage());
|
||||
System.out.println(/*!#*/"Error Generating Narrative for "+r.fhirType()+"/"+r.getId()+": "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
x.para().b().style("color: maroon").tx("Exception generating Narrative: "+e.getMessage());
|
||||
x.para().b().style("color: maroon").tx(/*!#*/"Exception generating Narrative: "+e.getMessage());
|
||||
}
|
||||
return hasExtensions;
|
||||
}
|
||||
|
@ -479,7 +481,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
Reference r = (Reference) e;
|
||||
if (r.getReference() != null && r.getReference().contains("#")) {
|
||||
if (containedIds.contains(r.getReference().substring(1))) {
|
||||
x.ah(r.getReference()).tx("See "+r.getReference());
|
||||
x.ah("#hc"+r.getReference().substring(1)).tx("See "+r.getReference());
|
||||
} else {
|
||||
// in this case, we render the resource in line
|
||||
ResourceWrapper rw = null;
|
||||
|
@ -493,7 +495,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
} else {
|
||||
String ref = context.getResolver() != null ?context.getResolver().urlForContained(context, res.fhirType(), res.getId(), rw.fhirType(), rw.getId()) : null;
|
||||
if (ref == null) {
|
||||
x.an(rw.getId());
|
||||
x.an("hc"+rw.getId());
|
||||
RenderingContext ctxtc = context.copy();
|
||||
ctxtc.setAddGeneratedNarrativeHeader(false);
|
||||
ctxtc.setContained(true);
|
||||
|
@ -831,19 +833,12 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
if ("DomainResource.contained".equals(child.getBase().getPath())) {
|
||||
if (round2) {
|
||||
for (BaseWrapper v : p.getValues()) {
|
||||
if (v.getBase() != null && !RendererFactory.hasSpecificRenderer(v.fhirType())) {
|
||||
if (v.getResource() != null && !RendererFactory.hasSpecificRenderer(v.fhirType())) {
|
||||
x.hr();
|
||||
RenderingContext ctxt = context.copy();
|
||||
ctxt.setContained(true);
|
||||
ResourceRenderer rnd = RendererFactory.factory(v.fhirType(), ctxt);
|
||||
ResourceWrapper rw = null;
|
||||
if (v.getBase() instanceof org.hl7.fhir.r5.elementmodel.Element) {
|
||||
rw = new ElementWrappers.ResourceWrapperMetaElement(ctxt, (org.hl7.fhir.r5.elementmodel.Element) v.getBase());
|
||||
} else if (v.getBase() instanceof Resource){
|
||||
rw = new DirectWrappers.ResourceWrapperDirect(ctxt, (Resource) v.getBase());
|
||||
} else {
|
||||
throw new FHIRException("Not handled: base = "+v.getBase().getClass().getName());
|
||||
}
|
||||
ResourceWrapper rw = v.getResource();
|
||||
rnd.render(x.blockquote(), rw);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ public class ProvenanceRenderer extends ResourceRenderer {
|
|||
if (!prv.getTarget().isEmpty()) {
|
||||
if (prv.getTarget().size() == 1) {
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("Provenance for ");
|
||||
p.tx(/*!#*/"Provenance for ");
|
||||
renderReference(prv, p, prv.getTargetFirstRep());
|
||||
} else {
|
||||
x.para().tx("Provenance for:");
|
||||
x.para().tx(/*!#*/"Provenance for:");
|
||||
XhtmlNode ul = x.ul();
|
||||
for (Reference ref : prv.getTarget()) {
|
||||
renderReference(prv, ul.li(), ref);
|
||||
|
@ -40,12 +40,12 @@ public class ProvenanceRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
// summary table
|
||||
x.para().tx("Summary");
|
||||
x.para().tx(/*!#*/"Summary");
|
||||
XhtmlNode t = x.table("grid");
|
||||
XhtmlNode tr;
|
||||
if (prv.hasOccurred()) {
|
||||
tr = t.tr();
|
||||
tr.td().tx("Occurrence");
|
||||
tr.td().tx(/*!#*/"Occurrence");
|
||||
if (prv.hasOccurredPeriod()) {
|
||||
renderPeriod(tr.td(), prv.getOccurredPeriod());
|
||||
} else {
|
||||
|
@ -54,12 +54,12 @@ public class ProvenanceRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (prv.hasRecorded()) {
|
||||
tr = t.tr();
|
||||
tr.td().tx("Recorded");
|
||||
tr.td().tx(/*!#*/"Recorded");
|
||||
tr.td().addText(prv.getRecordedElement().toHumanDisplay());
|
||||
}
|
||||
if (prv.hasPolicy()) {
|
||||
tr = t.tr();
|
||||
tr.td().tx("Policy");
|
||||
tr.td().tx(/*!#*/"Policy");
|
||||
if (prv.getPolicy().size() == 1) {
|
||||
renderUri(tr.td(), prv.getPolicy().get(0));
|
||||
} else {
|
||||
|
@ -71,12 +71,12 @@ public class ProvenanceRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (prv.hasLocation()) {
|
||||
tr = t.tr();
|
||||
tr.td().tx("Location");
|
||||
tr.td().tx(/*!#*/"Location");
|
||||
renderReference(prv, tr.td(), prv.getLocation());
|
||||
}
|
||||
if (prv.hasActivity()) {
|
||||
tr = t.tr();
|
||||
tr.td().tx("Activity");
|
||||
tr.td().tx(/*!#*/"Activity");
|
||||
renderCodeableConcept(tr.td(), prv.getActivity(), false);
|
||||
}
|
||||
|
||||
|
@ -88,18 +88,18 @@ public class ProvenanceRenderer extends ResourceRenderer {
|
|||
hasRole = hasRole || a.hasRole();
|
||||
hasOnBehalfOf = hasOnBehalfOf || a.hasOnBehalfOf();
|
||||
}
|
||||
x.para().b().tx("Agents");
|
||||
x.para().b().tx(/*!#*/"Agents");
|
||||
t = x.table("grid");
|
||||
tr = t.tr();
|
||||
if (hasType) {
|
||||
tr.td().b().tx("Type");
|
||||
tr.td().b().tx(/*!#*/"Type");
|
||||
}
|
||||
if (hasRole) {
|
||||
tr.td().b().tx("Role");
|
||||
tr.td().b().tx(/*!#*/"Role");
|
||||
}
|
||||
tr.td().b().tx("who");
|
||||
tr.td().b().tx(/*!#*/"who");
|
||||
if (hasOnBehalfOf) {
|
||||
tr.td().b().tx("On Behalf Of");
|
||||
tr.td().b().tx(/*!#*/"On Behalf Of");
|
||||
}
|
||||
for (ProvenanceAgentComponent a : prv.getAgent()) {
|
||||
tr = t.tr();
|
||||
|
@ -147,12 +147,12 @@ public class ProvenanceRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public String display(Provenance prv) throws UnsupportedEncodingException, IOException {
|
||||
return "Provenance for "+displayReference(prv, prv.getTargetFirstRep());
|
||||
return /*!#*/"Provenance for "+displayReference(prv, prv.getTargetFirstRep());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String display(ResourceWrapper r) throws UnsupportedEncodingException, IOException {
|
||||
return "Not done yet";
|
||||
return /*!#*/"Not done yet";
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
|
@ -67,9 +68,9 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
boolean doOpts = context.getDefinitionsTarget() == null && hasAnyOptions(q.getItem());
|
||||
|
||||
if (doOpts) {
|
||||
x.b().tx("Structure");
|
||||
x.b().tx(/*!#*/"Structure");
|
||||
}
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), context.getRules() == GenerationRules.IG_PUBLISHER);
|
||||
model.setAlternating(true);
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
|
@ -78,14 +79,14 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table");
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Cardinality"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "The type of the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"LinkId", /*!#*/"The linkId for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Text", /*!#*/"Text for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Cardinality", /*!#*/"Minimum and Maximum # of times the the itemcan appear in the instance", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Type", /*!#*/"The type of the item", null, 0));
|
||||
if (hasFlags) {
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Other attributes of the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Flags", /*!#*/"Other attributes of the item", null, 0));
|
||||
}
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Description & Constraints", /*!#*/"Additional information about the item", null, 0));
|
||||
|
||||
boolean hasExt = false;
|
||||
// first we add a root for the questionaire itself
|
||||
|
@ -104,7 +105,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
private void renderOptions(Questionnaire q, XhtmlNode x) {
|
||||
if (hasAnyOptions(q.getItem())) {
|
||||
x.hr();
|
||||
x.para().b().tx("Option Sets");
|
||||
x.para().b().tx(/*!#*/"Option Sets");
|
||||
renderOptions(q.getItem(), x);
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
useSelect = useSelect || opt.getInitialSelected();
|
||||
}
|
||||
x.an("opt-item."+i.getLinkId());
|
||||
x.para().b().tx("Answer options for "+i.getLinkId());
|
||||
x.para().b().tx(/*!#*/"Answer options for "+i.getLinkId());
|
||||
XhtmlNode ul = x.ul();
|
||||
for (QuestionnaireItemAnswerOptionComponent opt : i.getAnswerOption()) {
|
||||
XhtmlNode li = ul.li();
|
||||
|
@ -208,11 +209,11 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
Row r = gen.new Row();
|
||||
rows.add(r);
|
||||
|
||||
r.setIcon("icon_q_root.gif", "QuestionnaireRoot");
|
||||
r.setIcon("icon_q_root.gif", /*!#*/"QuestionnaireRoot");
|
||||
r.getCells().add(gen.new Cell(null, null, q.getName(), null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, q.getDescription(), null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, "Questionnaire", null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, /*!#*/"Questionnaire", null, null));
|
||||
if (hasFlags) {
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
}
|
||||
|
@ -224,14 +225,15 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
return Utilities.pathURL(context.getLink(KnownLinkType.SPEC), path);
|
||||
}
|
||||
|
||||
private String getSDCLink(String path) {
|
||||
if (Utilities.isAbsoluteUrl(path)) {
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, path);
|
||||
if (sd != null) {
|
||||
return sd.getWebPath();
|
||||
} else {
|
||||
return path.replace("StructureDefinition/", "StructureDefinition-")+".html";
|
||||
}
|
||||
private String getSDCLink(String url, String path) {
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, url);
|
||||
if (sd == null) {
|
||||
sd = context.getContext().fetchResource(StructureDefinition.class, path);
|
||||
}
|
||||
if (sd != null && sd.hasWebPath()) {
|
||||
return sd.getWebPath();
|
||||
} else if (Utilities.isAbsoluteUrl(path)) {
|
||||
return path.replace("StructureDefinition/", "StructureDefinition-")+".html";
|
||||
} else {
|
||||
return Utilities.pathURL("http://hl7.org/fhir/uv/sdc", path); // for now?
|
||||
}
|
||||
|
@ -261,45 +263,45 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
Cell flags = gen.new Cell();
|
||||
r.getCells().add(flags);
|
||||
if (i.getReadOnly()) {
|
||||
flags.addPiece(gen.new Piece(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "questionnaire-definitions.html#Questionnaire.item.readOnly"), null, "Is Readonly").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-readonly.png"))));
|
||||
flags.addPiece(gen.new Piece(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "questionnaire-definitions.html#Questionnaire.item.readOnly"), null, /*!#*/"Is Readonly").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-readonly.png"))));
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-isSubject.html"), null, "Can change the subject of the questionnaire").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-subject.png"))));
|
||||
flags.addPiece(gen.new Piece(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "StructureDefinition-sdc-questionnaire-isSubject.html"), null, /*!#*/"Can change the subject of the questionnaire").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-subject.png"))));
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
flags.addPiece(gen.new Piece(getSpecLink("extension-questionnaire-hidden.html"), null, "Is a hidden item").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-hidden.png"))));
|
||||
flags.addPiece(gen.new Piece(getSpecLink("extension-questionnaire-hidden.html"), null, /*!#*/"Is a hidden item").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-hidden.png"))));
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-optionalDisplay.html"), null, "Is optional to display").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-optional.png"))));
|
||||
flags.addPiece(gen.new Piece(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "StructureDefinition-sdc-questionnaire-optionalDisplay.html"), null, /*!#*/"Is optional to display").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-optional.png"))));
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
|
||||
flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-observationLinkPeriod.html"), null, "Is linked to an observation").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-observation.png"))));
|
||||
flags.addPiece(gen.new Piece(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "StructureDefinition-sdc-questionnaire-observationLinkPeriod.html"), null, /*!#*/"Is linked to an observation").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-observation.png"))));
|
||||
}
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_CHOICE_ORIENT)) {
|
||||
String code = ToolingExtensions.readStringExtension(i, ToolingExtensions.EXT_Q_CHOICE_ORIENT);
|
||||
flags.addPiece(gen.new Piece(getSpecLink("extension-questionnaire-choiceorientation.html"), null, "Orientation: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-" + code + ".png"))));
|
||||
flags.addPiece(gen.new Piece(getSpecLink("extension-questionnaire-choiceorientation.html"), null, /*!#*/"Orientation: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-" + code + ".png"))));
|
||||
}
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_DISPLAY_CAT)) {
|
||||
CodeableConcept cc = i.getExtensionByUrl(ToolingExtensions.EXT_Q_DISPLAY_CAT).getValueCodeableConcept();
|
||||
String code = cc.getCode("http://hl7.org/fhir/questionnaire-display-category");
|
||||
flags.addPiece(gen.new Piece("https://hl7.org/fhir/R4/extension-questionnaire-displayCategory.html", null, "Category: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-" + code + ".png"))));
|
||||
flags.addPiece(gen.new Piece("https://hl7.org/fhir/R4/extension-questionnaire-displayCategory.html", null, /*!#*/"Category: "+code).addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", getImgPath("icon-qi-" + code + ".png"))));
|
||||
}
|
||||
}
|
||||
Cell defn = gen.new Cell();
|
||||
r.getCells().add(defn);
|
||||
|
||||
if (i.hasMaxLength()) {
|
||||
defn.getPieces().add(gen.new Piece(null, "Max Length: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Max Length: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, Integer.toString(i.getMaxLength()), null));
|
||||
}
|
||||
if (i.hasDefinition()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Definition: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Definition: ", null));
|
||||
genDefinitionLink(gen, i, defn, q);
|
||||
}
|
||||
if (i.hasEnableWhen()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
Piece p = gen.new Piece(null, "Enable When: ", null);
|
||||
Piece p = gen.new Piece(null, /*!#*/"Enable When: ", null);
|
||||
defn.getPieces().add(p);
|
||||
if (i.getEnableWhen().size() == 1) {
|
||||
XhtmlNode x = new XhtmlNode(NodeType.Element, "span");
|
||||
|
@ -315,7 +317,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (i.hasAnswerValueSet()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Value Set: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Value Set: ", null));
|
||||
if (!Utilities.noString(i.getAnswerValueSet()) && i.getAnswerValueSet().startsWith("#")) {
|
||||
ValueSet vs = (ValueSet) q.getContained(i.getAnswerValueSet().substring(1));
|
||||
if (vs == null) {
|
||||
|
@ -334,7 +336,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (i.hasAnswerOption()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Options: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Options: ", null));
|
||||
if (context.getDefinitionsTarget() == null) {
|
||||
// if we don't have a definitions target, we'll add them below.
|
||||
defn.getPieces().add(gen.new Piece("#opt-item."+i.getLinkId(), Integer.toString(i.getAnswerOption().size())+" "+Utilities.pluralize("option", i.getAnswerOption().size()), null));
|
||||
|
@ -345,7 +347,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
if (i.hasInitial()) {
|
||||
for (QuestionnaireItemInitialComponent v : i.getInitial()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Initial Value: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Initial Value: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, v.getValue().fhirType(), null));
|
||||
defn.getPieces().add(gen.new Piece(null, " = ", null));
|
||||
if (v.getValue().isPrimitive()) {
|
||||
|
@ -373,26 +375,26 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Expressions: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Expressions: ", null));
|
||||
Piece p = gen.new Piece("ul");
|
||||
defn.getPieces().add(p);
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Initial Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Initial Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext")) {
|
||||
addExpression(p, e.getValueExpression(), "Item Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Item Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Enable When", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Enable When", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Calculated Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Calculated Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Candidates", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Candidates", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,13 +449,18 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
private void addExpression(Piece p, Expression exp, String label, String url) {
|
||||
XhtmlNode x = new XhtmlNode(NodeType.Element, "li").style("font-size: 11px");
|
||||
p.addHtml(x);
|
||||
x.ah(url).tx(label);
|
||||
CanonicalResource cr = (CanonicalResource) context.getContext().fetchResource(Resource.class, url);
|
||||
if (cr != null && cr.hasWebPath()) {
|
||||
x.ah(cr.getWebPath()).tx(label);
|
||||
} else {
|
||||
x.ah(url).tx(label);
|
||||
}
|
||||
x.tx(": ");
|
||||
x.code(exp.getExpression());
|
||||
}
|
||||
|
||||
private boolean renderLogic(XhtmlNode x, Questionnaire q) throws FHIRException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), true);
|
||||
model.setAlternating(true);
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
|
@ -462,8 +469,8 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table");
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"LinkId", /*!#*/"The linkId for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Description & Constraints", /*!#*/"Additional information about the item", null, 0));
|
||||
|
||||
boolean hasExt = false;
|
||||
if (!q.hasItem()) {
|
||||
|
@ -489,22 +496,22 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
r.getCells().add(defn);
|
||||
|
||||
if (i.hasMaxLength()) {
|
||||
defn.getPieces().add(gen.new Piece(null, "Max Length: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Max Length: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, Integer.toString(i.getMaxLength()), null));
|
||||
}
|
||||
if (i.hasDefinition()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Definition: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Definition: ", null));
|
||||
genDefinitionLink(gen, i, defn, q);
|
||||
}
|
||||
if (i.hasEnableWhen()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Enable When: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, "todo", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Enable When: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"todo", null));
|
||||
}
|
||||
if (i.hasAnswerValueSet()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Value Set: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Value Set: ", null));
|
||||
if (Utilities.noString(i.getAnswerValueSet()) && i.getAnswerValueSet().startsWith("#")) {
|
||||
ValueSet vs = (ValueSet) q.getContained(i.getAnswerValueSet().substring(1));
|
||||
if (vs == null) {
|
||||
|
@ -523,13 +530,13 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (i.hasAnswerOption()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Options: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Options: ", null));
|
||||
defn.getPieces().add(gen.new Piece(context.getDefinitionsTarget()+"#item."+i.getLinkId(), Integer.toString(i.getAnswerOption().size())+" "+Utilities.pluralize("option", i.getAnswerOption().size()), null));
|
||||
}
|
||||
if (i.hasInitial()) {
|
||||
for (QuestionnaireItemInitialComponent v : i.getInitial()) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Initial Value: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Initial Value: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, v.getValue().fhirType(), null));
|
||||
defn.getPieces().add(gen.new Piece(null, " = ", null));
|
||||
if (v.getValue().isPrimitive()) {
|
||||
|
@ -557,26 +564,26 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
|
||||
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
|
||||
defn.getPieces().add(gen.new Piece(null, "Expressions: ", null));
|
||||
defn.getPieces().add(gen.new Piece(null, /*!#*/"Expressions: ", null));
|
||||
Piece p = gen.new Piece("ul");
|
||||
defn.getPieces().add(p);
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Initial Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Initial Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext")) {
|
||||
addExpression(p, e.getValueExpression(), "Item Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Item Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Enable When", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Enable When", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Calculated Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Calculated Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression");
|
||||
}
|
||||
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression")) {
|
||||
addExpression(p, e.getValueExpression(), "Candidates", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression");
|
||||
addExpression(p, e.getValueExpression(), /*!#*/"Candidates", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +640,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
p.span(null, "linkId: "+i.getLinkId()).tx(i.getText());
|
||||
if (i.getRequired()) {
|
||||
p.span("color: red", "Mandatory").tx("*");
|
||||
p.span("color: red", /*!#*/"Mandatory").tx("*");
|
||||
}
|
||||
|
||||
XhtmlNode input = null;
|
||||
|
@ -712,39 +719,39 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
|
||||
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
|
||||
hasFlag = true;
|
||||
flags.ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject"), "Can change the subject of the questionnaire").img(getImgPath("icon-qi-subject.png"), "icon");
|
||||
flags.ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "StructureDefinition-sdc-questionnaire-isSubject.html"), /*!#*/"Can change the subject of the questionnaire").img(getImgPath("icon-qi-subject.png"), "icon");
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
hasFlag = true;
|
||||
flags.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "extension-questionnaire-hidden.html"), "Is a hidden item").img(getImgPath("icon-qi-hidden.png"), "icon");
|
||||
flags.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "extension-questionnaire-hidden.html"), /*!#*/"Is a hidden item").img(getImgPath("icon-qi-hidden.png"), "icon");
|
||||
d.style("background-color: #eeeeee");
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
hasFlag = true;
|
||||
flags.ah(getSDCLink(ToolingExtensions.EXT_Q_OTP_DISP), "Is optional to display").img(getImgPath("icon-qi-optional.png"), "icon");
|
||||
flags.ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "StructureDefinition-sdc-questionnaire-optionalDisplay.html"), /*!#*/"Is optional to display").img(getImgPath("icon-qi-optional.png"), "icon");
|
||||
}
|
||||
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
|
||||
hasFlag = true;
|
||||
flags.ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod"), "Is linked to an observation").img(getImgPath("icon-qi-observation.png"), "icon");
|
||||
flags.ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "StructureDefinition-sdc-questionnaire-observationLinkPeriod.html"), /*!#*/"Is linked to an observation").img(getImgPath("icon-qi-observation.png"), "icon");
|
||||
}
|
||||
if (i.hasExtension(ToolingExtensions.EXT_Q_DISPLAY_CAT)) {
|
||||
CodeableConcept cc = i.getExtensionByUrl(ToolingExtensions.EXT_Q_DISPLAY_CAT).getValueCodeableConcept();
|
||||
String code = cc.getCode("http://hl7.org/fhir/questionnaire-display-category");
|
||||
hasFlag = true;
|
||||
flags.ah("https://hl7.org/fhir/R4/extension-questionnaire-displayCategory.html", "Category: "+code).img(getImgPath("icon-qi-" + code + ".png"), "icon");
|
||||
flags.ah("https://hl7.org/fhir/R4/extension-questionnaire-displayCategory.html", /*!#*/"Category: "+code).img(getImgPath("icon-qi-" + code + ".png"), "icon");
|
||||
}
|
||||
|
||||
if (i.hasMaxLength()) {
|
||||
item(ul, "Max Length", Integer.toString(i.getMaxLength()));
|
||||
item(ul, /*!#*/"Max Length", Integer.toString(i.getMaxLength()));
|
||||
}
|
||||
if (i.hasDefinition()) {
|
||||
genDefinitionLink(item(ul, "Definition"), i, q);
|
||||
genDefinitionLink(item(ul, /*!#*/"Definition"), i, q);
|
||||
}
|
||||
if (i.hasEnableWhen()) {
|
||||
item(ul, "Enable When", "todo");
|
||||
item(ul, /*!#*/"Enable When", "todo");
|
||||
}
|
||||
if (i.hasAnswerValueSet()) {
|
||||
XhtmlNode ans = item(ul, "Answers");
|
||||
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 || !vs.hasWebPath()) {
|
||||
|
@ -762,10 +769,10 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
if (i.hasAnswerOption()) {
|
||||
item(ul, "Answers", Integer.toString(i.getAnswerOption().size())+" "+Utilities.pluralize("option", i.getAnswerOption().size()), context.getDefinitionsTarget()+"#item."+i.getLinkId());
|
||||
item(ul, /*!#*/"Answers", Integer.toString(i.getAnswerOption().size())+" "+Utilities.pluralize("option", i.getAnswerOption().size()), context.getDefinitionsTarget()+"#item."+i.getLinkId());
|
||||
}
|
||||
if (i.hasInitial()) {
|
||||
XhtmlNode vi = item(ul, "Initial Values");
|
||||
XhtmlNode vi = item(ul, /*!#*/"Initial Values");
|
||||
boolean first = true;
|
||||
for (QuestionnaireItemInitialComponent v : i.getInitial()) {
|
||||
if (first) first = false; else vi.tx(", ");
|
||||
|
@ -876,13 +883,13 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
|
||||
public String display(Questionnaire q) throws UnsupportedEncodingException, IOException {
|
||||
return "Questionnaire "+q.present();
|
||||
return /*!#*/"Questionnaire "+q.present();
|
||||
}
|
||||
|
||||
private boolean renderLinks(XhtmlNode x, Questionnaire q) {
|
||||
x.para().tx("Try this questionnaire out:");
|
||||
x.para().tx(/*!#*/"Try this questionnaire out:");
|
||||
XhtmlNode ul = x.ul();
|
||||
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library");
|
||||
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx(/*!#*/"NLM Forms Library");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -901,42 +908,42 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
XhtmlNode td = tbl.tr().td("structure").colspan("2").span(null, null).attribute("class", "self-link-parent");
|
||||
td.an(q.getId());
|
||||
td.img(getImgPath("icon_q_root.gif"), "icon");
|
||||
td.tx(" Questionnaire ");
|
||||
td.tx(" "+/*!#*/"Questionnaire ");
|
||||
td.b().tx(q.getId());
|
||||
|
||||
// general information
|
||||
defn(tbl, "URL", q.getUrl());
|
||||
defn(tbl, "Version", q.getVersion());
|
||||
defn(tbl, "Name", q.getName());
|
||||
defn(tbl, "Title", q.getTitle());
|
||||
defn(tbl, /*!#*/"URL", q.getUrl());
|
||||
defn(tbl, /*!#*/"Version", q.getVersion());
|
||||
defn(tbl, /*!#*/"Name", q.getName());
|
||||
defn(tbl, /*!#*/"Title", q.getTitle());
|
||||
if (q.hasDerivedFrom()) {
|
||||
td = defn(tbl, "Derived From");
|
||||
td = defn(tbl, /*!#*/"Derived From");
|
||||
boolean first = true;
|
||||
for (CanonicalType c : q.getDerivedFrom()) {
|
||||
if (first) first = false; else td.tx(", ");
|
||||
td.tx(c.asStringValue()); // todo: make these a reference
|
||||
}
|
||||
}
|
||||
defn(tbl, "Status", q.getStatus().getDisplay());
|
||||
defn(tbl, "Experimental", q.getExperimental());
|
||||
defn(tbl, "Publication Date", q.getDateElement().primitiveValue());
|
||||
defn(tbl, "Approval Date", q.getApprovalDateElement().primitiveValue());
|
||||
defn(tbl, "Last Review Date", q.getLastReviewDateElement().primitiveValue());
|
||||
defn(tbl, /*!#*/"Status", q.getStatus().getDisplay());
|
||||
defn(tbl, /*!#*/"Experimental", q.getExperimental());
|
||||
defn(tbl, /*!#*/"Publication Date", q.getDateElement().primitiveValue());
|
||||
defn(tbl, /*!#*/"Approval Date", q.getApprovalDateElement().primitiveValue());
|
||||
defn(tbl, /*!#*/"Last Review Date", q.getLastReviewDateElement().primitiveValue());
|
||||
if (q.hasEffectivePeriod()) {
|
||||
renderPeriod(defn(tbl, "Effective Period"), q.getEffectivePeriod());
|
||||
renderPeriod(defn(tbl, /*!#*/"Effective Period"), q.getEffectivePeriod());
|
||||
}
|
||||
|
||||
if (q.hasSubjectType()) {
|
||||
td = defn(tbl, "Subject Type");
|
||||
td = defn(tbl, /*!#*/"Subject Type");
|
||||
boolean first = true;
|
||||
for (CodeType c : q.getSubjectType()) {
|
||||
if (first) first = false; else td.tx(", ");
|
||||
td.tx(c.asStringValue());
|
||||
}
|
||||
}
|
||||
defn(tbl, "Description", q.getDescription());
|
||||
defn(tbl, "Purpose", q.getPurpose());
|
||||
defn(tbl, "Copyright", q.getCopyright());
|
||||
defn(tbl, /*!#*/"Description", q.getDescription());
|
||||
defn(tbl, /*!#*/"Purpose", q.getPurpose());
|
||||
defn(tbl, /*!#*/"Copyright", q.getCopyright());
|
||||
if (q.hasCode()) {
|
||||
td = defn(tbl, Utilities.pluralize("Code", q.getCode().size()));
|
||||
boolean first = true;
|
||||
|
@ -961,37 +968,37 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
td.b().tx(qi.getLinkId());
|
||||
|
||||
// general information
|
||||
defn(tbl, "Link Id", qi.getLinkId());
|
||||
defn(tbl, "Prefix", qi.getPrefix());
|
||||
defn(tbl, "Text", qi.getText());
|
||||
defn(tbl, "Type", qi.getType().getDisplay());
|
||||
defn(tbl, "Required", qi.getRequired(), true);
|
||||
defn(tbl, "Repeats", qi.getRepeats(), true);
|
||||
defn(tbl, "Read Only", qi.getReadOnly(), false);
|
||||
defn(tbl, /*!#*/"Link Id", qi.getLinkId());
|
||||
defn(tbl, /*!#*/"Prefix", qi.getPrefix());
|
||||
defn(tbl, /*!#*/"Text", qi.getText());
|
||||
defn(tbl, /*!#*/"Type", qi.getType().getDisplay());
|
||||
defn(tbl, /*!#*/"Required", qi.getRequired(), true);
|
||||
defn(tbl, /*!#*/"Repeats", qi.getRepeats(), true);
|
||||
defn(tbl, /*!#*/"Read Only", qi.getReadOnly(), false);
|
||||
if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
|
||||
defn(tbl, "Subject", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "This element changes who the subject of the question is", null);
|
||||
defn(tbl, /*!#*/"Subject", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "This element changes who the subject of the question is", null);
|
||||
}
|
||||
|
||||
// content control
|
||||
defn(tbl, "Max Length", qi.getMaxLength());
|
||||
defn(tbl, /*!#*/"Max Length", qi.getMaxLength());
|
||||
if (qi.hasAnswerValueSet()) {
|
||||
defn(tbl, "Value Set", qi.getDefinition(), context.getWorker().findTxResource(ValueSet.class, qi.getAnswerValueSet(), q));
|
||||
defn(tbl, /*!#*/"Value Set", qi.getDefinition(), context.getWorker().findTxResource(ValueSet.class, qi.getAnswerValueSet(), q));
|
||||
}
|
||||
if (qi.hasAnswerOption()) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().tx("Allowed Answers");
|
||||
tr.td().tx(/*!#*/"Allowed Answers");
|
||||
XhtmlNode ul = tr.td().ul();
|
||||
for (QuestionnaireItemAnswerOptionComponent ans : qi.getAnswerOption()) {
|
||||
XhtmlNode li = ul.li();
|
||||
render(li, ans.getValue());
|
||||
if (ans.getInitialSelected()) {
|
||||
li.tx(" (initially selected)");
|
||||
li.tx(" "+/*!#*/"(initially selected)");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (qi.hasInitial()) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Initial Answer", qi.getInitial().size()));
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Initial Answer", qi.getInitial().size()));
|
||||
if (qi.getInitial().size() == 1) {
|
||||
render(tr.td(), qi.getInitialFirstRep().getValue());
|
||||
} else {
|
||||
|
@ -1010,20 +1017,20 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
render(tr.td(), qi.getExtensionByUrl(ToolingExtensions.EXT_Q_DISPLAY_CAT).getValue());
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(qi, ToolingExtensions.EXT_Q_HIDDEN)) {
|
||||
defn(tbl, "Hidden Item", ToolingExtensions.EXT_Q_DISPLAY_CAT, "This item is a hidden question", null);
|
||||
defn(tbl, /*!#*/"Hidden Item", ToolingExtensions.EXT_Q_DISPLAY_CAT, "This item is a hidden question", null);
|
||||
}
|
||||
if (ToolingExtensions.readBoolExtension(qi, ToolingExtensions.EXT_Q_OTP_DISP)) {
|
||||
defn(tbl, "Hidden Item", ToolingExtensions.EXT_Q_OTP_DISP, "This item is optional to display", null);
|
||||
defn(tbl, /*!#*/"Hidden Item", ToolingExtensions.EXT_Q_OTP_DISP, "This item is optional to display", null);
|
||||
}
|
||||
|
||||
// formal definitions
|
||||
if (qi.hasDefinition()) {
|
||||
genDefinitionLink(defn(tbl, "Definition"), qi, q);
|
||||
genDefinitionLink(defn(tbl, /*!#*/"Definition"), qi, q);
|
||||
}
|
||||
|
||||
if (qi.hasCode()) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Code", qi.getCode().size()));
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Code", qi.getCode().size()));
|
||||
XhtmlNode ul = tr.td().ul();
|
||||
for (Coding c : qi.getCode()) {
|
||||
renderCodingWithDetails(ul.li(), c);
|
||||
|
@ -1031,22 +1038,27 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (qi.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod").tx("Observation Link Period");
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, ToolingExtensions.EXT_O_LINK_PERIOD);
|
||||
if (sd != null && sd.hasWebPath()) {
|
||||
tr.td().ah(sd.getWebPath()).tx(/*!#*/"Observation Link Period");
|
||||
} else {
|
||||
tr.td().ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod").tx(/*!#*/"Observation Link Period");
|
||||
}
|
||||
render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod").getValue());
|
||||
}
|
||||
|
||||
// dynamic management
|
||||
if (qi.hasEnableWhen()) {
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().tx("Enable When");
|
||||
tr.td().tx(/*!#*/"Enable When");
|
||||
td = tr.td();
|
||||
if (qi.getEnableWhen().size() == 1) {
|
||||
renderEnableWhen(td, qi.getEnableWhen().get(0));
|
||||
} else {
|
||||
if (qi.hasEnableBehavior()) {
|
||||
td.tx(qi.getEnableBehavior().getDisplay()+" are true:");
|
||||
td.tx(qi.getEnableBehavior().getDisplay()+" "+/*!#*/"are true:");
|
||||
} else {
|
||||
td.tx("?? are true:");
|
||||
td.tx(/*!#*/"?? are true:");
|
||||
}
|
||||
XhtmlNode ul = td.ul();
|
||||
for (QuestionnaireItemEnableWhenComponent ew : qi.getEnableWhen()) {
|
||||
|
@ -1071,11 +1083,11 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
|
||||
private void defn(XhtmlNode tbl, String name, String url, Resource res) throws UnsupportedEncodingException, IOException {
|
||||
if (res != null && res.hasWebPath()) {
|
||||
defn(tbl, "Definition", RendererFactory.factory(res, context).display(res), res.getWebPath());
|
||||
defn(tbl, /*!#*/"Definition", RendererFactory.factory(res, context).display(res), res.getWebPath());
|
||||
} else if (Utilities.isAbsoluteUrlLinkable(url)) {
|
||||
defn(tbl, "Definition", url, url);
|
||||
defn(tbl, /*!#*/"Definition", url, url);
|
||||
} {
|
||||
defn(tbl, "Definition", url);
|
||||
defn(tbl, /*!#*/"Definition", url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// case DEFNS: return renderDefns(x, q);
|
||||
case TREE: return renderTree(x, q);
|
||||
default:
|
||||
throw new Error("Unknown QuestionnaireResponse Renderer Mode");
|
||||
throw new Error(/*!#*/"Unknown QuestionnaireResponse Renderer Mode");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,12 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// case DEFNS: return renderDefns(x, q);
|
||||
case TREE: return renderTree(x, qr);
|
||||
default:
|
||||
throw new Error("Unknown QuestionnaireResponse Renderer Mode");
|
||||
throw new Error(/*!#*/"Unknown QuestionnaireResponse Renderer Mode");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean renderTree(XhtmlNode x, ResourceWrapper qr) throws UnsupportedEncodingException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+qr.getId(), false);
|
||||
model.setAlternating(true);
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
|
@ -71,10 +71,10 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table");
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Answer"), translate("sd.hint", "The type of the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"LinkId", /*!#*/"The linkId for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Text", /*!#*/"Text for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Definition", /*!#*/"Minimum and Maximum # of times the the itemcan appear in the instance", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Answer", /*!#*/"The type of the item", null, 0));
|
||||
|
||||
boolean hasExt = false;
|
||||
// first we add a root for the questionaire itself
|
||||
|
@ -89,7 +89,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public boolean renderTree(XhtmlNode x, QuestionnaireResponse q) throws UnsupportedEncodingException, IOException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), true);
|
||||
model.setAlternating(true);
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
|
@ -98,10 +98,10 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table");
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Answer"), translate("sd.hint", "The type of the item"), null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"LinkId", /*!#*/"The linkId for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Text", /*!#*/"Text for the item", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Definition", /*!#*/"Minimum and Maximum # of times the the itemcan appear in the instance", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), /*!#*/"Answer", /*!#*/"The type of the item", null, 0));
|
||||
|
||||
boolean hasExt = false;
|
||||
// first we add a root for the questionaire itself
|
||||
|
@ -120,10 +120,10 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
Row r = gen.new Row();
|
||||
rows.add(r);
|
||||
|
||||
r.setIcon("icon_q_root.gif", "QuestionnaireResponseRoot");
|
||||
r.setIcon("icon_q_root.gif", /*!#*/"QuestionnaireResponseRoot");
|
||||
r.getCells().add(gen.new Cell(null, null, q.getId(), null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, "QuestionnaireResponse", null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, /*!#*/"QuestionnaireResponse", null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
return r;
|
||||
}
|
||||
|
@ -136,18 +136,18 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
String ref = b == null ? null : b.primitiveValue();
|
||||
Questionnaire q = context.getContext().fetchResource(Questionnaire.class, ref);
|
||||
|
||||
r.setIcon("icon_q_root.gif", "QuestionnaireResponseRoot");
|
||||
r.setIcon("icon_q_root.gif", /*!#*/"QuestionnaireResponseRoot");
|
||||
r.getCells().add(gen.new Cell(null, null, qr.getId(), null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
if (ref == null ) {
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
r.getCells().add(gen.new Cell("Questionnaire:", null, "None specified", null, null));
|
||||
r.getCells().add(gen.new Cell(/*!#*/"Questionnaire:", null, /*!#*/"None specified", null, null));
|
||||
} else if (q == null || !q.hasWebPath()) {
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
r.getCells().add(gen.new Cell("Questionnaire:", null, ref, null, null));
|
||||
r.getCells().add(gen.new Cell(/*!#*/"Questionnaire:", null, ref, null, null));
|
||||
} else{
|
||||
r.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
r.getCells().add(gen.new Cell("Questionnaire:", q.getWebPath(), q.present(), null, null));
|
||||
r.getCells().add(gen.new Cell(/*!#*/"Questionnaire:", q.getWebPath(), q.present(), null, null));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -168,9 +168,9 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
if (hasItem) {
|
||||
r.setIcon("icon-q-group.png", "Group");
|
||||
r.setIcon("icon-q-group.png", /*!#*/"Group");
|
||||
} else {
|
||||
r.setIcon("icon-q-string.png", "Item");
|
||||
r.setIcon("icon-q-string.png", /*!#*/"Item");
|
||||
}
|
||||
String linkId = i.has("linkId") ? i.get("linkId").primitiveValue() : "??";
|
||||
String text = i.has("text") ? i.get("text").primitiveValue() : "";
|
||||
|
@ -235,9 +235,9 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
hasItem = a.hasItem();
|
||||
}
|
||||
if (hasItem) {
|
||||
r.setIcon("icon-q-group.png", "Group");
|
||||
r.setIcon("icon-q-group.png", /*!#*/"Group");
|
||||
} else {
|
||||
r.setIcon("icon-q-string.png", "Item");
|
||||
r.setIcon("icon-q-string.png", /*!#*/"Item");
|
||||
}
|
||||
r.getCells().add(gen.new Cell(null, context.getDefinitionsTarget() == null ? "" : context.getDefinitionsTarget()+"#item."+i.getLinkId(), i.getLinkId(), null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, i.getText(), null, null));
|
||||
|
@ -327,7 +327,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
public boolean renderForm(XhtmlNode x, ResourceWrapper q) throws UnsupportedEncodingException, IOException {
|
||||
boolean hasExt = false;
|
||||
XhtmlNode d = x.div();
|
||||
d.tx("todo");
|
||||
d.tx(/*!#*/"todo");
|
||||
// boolean hasPrefix = false;
|
||||
// for (QuestionnaireItemComponent c : q.getItem()) {
|
||||
// hasPrefix = hasPrefix || doesItemHavePrefix(c);
|
||||
|
@ -370,7 +370,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// }
|
||||
// p.span(null, "linkId: "+i.getLinkId()).tx(i.getText());
|
||||
// if (i.getRequired()) {
|
||||
// p.span("color: red", "Mandatory").tx("*");
|
||||
// p.span("color: red", /*!#*/"Mandatory").tx("*");
|
||||
// }
|
||||
//
|
||||
// XhtmlNode input = null;
|
||||
|
@ -605,16 +605,16 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// }
|
||||
//
|
||||
private boolean renderLinks(XhtmlNode x, QuestionnaireResponse q) {
|
||||
x.para().tx("Try this QuestionnaireResponse out:");
|
||||
x.para().tx(/*!#*/"Try this QuestionnaireResponse out:");
|
||||
XhtmlNode ul = x.ul();
|
||||
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library");
|
||||
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx(/*!#*/"NLM Forms Library");
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean renderLinks(XhtmlNode x, ResourceWrapper q) {
|
||||
x.para().tx("Try this QuestionnaireResponse out:");
|
||||
x.para().tx(/*!#*/"Try this QuestionnaireResponse out:");
|
||||
XhtmlNode ul = x.ul();
|
||||
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library");
|
||||
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx(/*!#*/"NLM Forms Library");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -711,13 +711,13 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// }
|
||||
// if (qi.hasAnswerOption()) {
|
||||
// XhtmlNode tr = tbl.tr();
|
||||
// tr.td().tx("Allowed Answers");
|
||||
// tr.td().tx(/*!#*/"Allowed Answers");
|
||||
// XhtmlNode ul = tr.td().ul();
|
||||
// for (QuestionnaireItemAnswerOptionComponent ans : qi.getAnswerOption()) {
|
||||
// XhtmlNode li = ul.li();
|
||||
// render(li, ans.getValue());
|
||||
// if (ans.getInitialSelected()) {
|
||||
// li.tx(" (initially selected)");
|
||||
// li.tx(/*!#*/" (initially selected)");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@ -738,7 +738,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// // appearance
|
||||
// if (qi.hasExtension(" http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory")) {
|
||||
// XhtmlNode tr = tbl.tr();
|
||||
// tr.td().ah("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory").tx("Display Category");
|
||||
// tr.td().ah("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory").tx(/*!#*/"Display Category");
|
||||
// render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-displayCategory").getValue());
|
||||
// }
|
||||
// if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-hidden")) {
|
||||
|
@ -763,14 +763,14 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
// }
|
||||
// if (qi.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-observationLinkPeriod")) {
|
||||
// XhtmlNode tr = tbl.tr();
|
||||
// tr.td().ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-observationLinkPeriod").tx("Observation Link Period");
|
||||
// tr.td().ah(getSDCLink("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-observationLinkPeriod").tx(/*!#*/"Observation Link Period");
|
||||
// render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-observationLinkPeriod").getValue());
|
||||
// }
|
||||
//
|
||||
// // dynamic management
|
||||
// if (qi.hasEnableWhen()) {
|
||||
// XhtmlNode tr = tbl.tr();
|
||||
// tr.td().tx("Enable When");
|
||||
// tr.td().tx(/*!#*/"Enable When");
|
||||
// td = tr.td();
|
||||
// if (qi.getEnableWhen().size() == 1) {
|
||||
// renderEnableWhen(td, qi.getEnableWhen().get(0));
|
||||
|
@ -876,12 +876,12 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
|
||||
@Override
|
||||
public String display(Resource r) throws UnsupportedEncodingException, IOException {
|
||||
return "todo";
|
||||
return /*!#*/"todo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String display(ResourceWrapper r) throws UnsupportedEncodingException, IOException {
|
||||
return "Not done yet";
|
||||
return /*!#*/"Not done yet";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,15 @@
|
|||
package org.hl7.fhir.r5.renderers;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.hl7.fhir.r5.comparison.VersionComparisonAnnotation;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.utils.TranslatingUtilities;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||
import org.hl7.fhir.utilities.StandardsStatus;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -33,7 +35,7 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
|||
* @author graha
|
||||
*
|
||||
*/
|
||||
public class Renderer extends TranslatingUtilities {
|
||||
public class Renderer {
|
||||
|
||||
protected RenderingContext context;
|
||||
|
||||
|
@ -46,42 +48,14 @@ public class Renderer extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
|
||||
protected static final String RENDER_BUNDLE_HEADER_ROOT = "RENDER_BUNDLE_HEADER_ROOT";
|
||||
protected static final String RENDER_BUNDLE_HEADER_ENTRY = "RENDER_BUNDLE_HEADER_ENTRY";
|
||||
protected static final String RENDER_BUNDLE_HEADER_ENTRY_URL = "RENDER_BUNDLE_HEADER_ENTRY_URL";
|
||||
protected static final String RENDER_BUNDLE_RESOURCE = "RENDER_BUNDLE_RESOURCE";
|
||||
protected static final String RENDER_BUNDLE_SEARCH = "RENDER_BUNDLE_SEARCH";
|
||||
protected static final String RENDER_BUNDLE_SEARCH_MODE = "RENDER_BUNDLE_SEARCH_MODE";
|
||||
protected static final String RENDER_BUNDLE_SEARCH_SCORE = "RENDER_BUNDLE_SEARCH_SCORE";
|
||||
protected static final String RENDER_BUNDLE_RESPONSE = "RENDER_BUNDLE_RESPONSE";
|
||||
protected static final String RENDER_BUNDLE_LOCATION = "RENDER_BUNDLE_LOCATION";
|
||||
protected static final String RENDER_BUNDLE_ETAG = "RENDER_BUNDLE_ETAG";
|
||||
protected static final String RENDER_BUNDLE_LAST_MOD = "RENDER_BUNDLE_LAST_MOD";
|
||||
protected static final String RENDER_BUNDLE_REQUEST = "RENDER_BUNDLE_REQUEST";
|
||||
protected static final String RENDER_BUNDLE_IF_NON_MATCH = "RENDER_BUNDLE_IF_NON_MATCH";
|
||||
protected static final String RENDER_BUNDLE_IF_MOD = "RENDER_BUNDLE_IF_MOD";
|
||||
protected static final String RENDER_BUNDLE_IF_MATCH = "RENDER_BUNDLE_IF_MATCH";
|
||||
protected static final String RENDER_BUNDLE_IF_NONE = "RENDER_BUNDLE_IF_NONE";
|
||||
protected static final String RENDER_BUNDLE_DOCUMENT_CONTENT = "RENDER_BUNDLE_DOCUMENT_CONTENT";
|
||||
protected static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_URD = "RENDER_BUNDLE_HEADER_DOC_ENTRY_URD";
|
||||
protected static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_U = "RENDER_BUNDLE_HEADER_DOC_ENTRY_U";
|
||||
protected static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_RD = "RENDER_BUNDLE_HEADER_DOC_ENTRY_RD";
|
||||
|
||||
/** the plan here is to make this have it's own implementation of messages, rather than using the
|
||||
* validator messages, for better alignment with publisher I18n strategy
|
||||
*
|
||||
* @param theMessage
|
||||
* @param theMessageArguments
|
||||
* @return
|
||||
*/
|
||||
protected String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||
return context.getWorker().formatMessage(theMessage, theMessageArguments);
|
||||
return context.formatMessage(theMessage, theMessageArguments);
|
||||
}
|
||||
|
||||
public void genStandardsStatus(XhtmlNode td, StandardsStatus ss) {
|
||||
if (ss != null) {
|
||||
td.tx(" ");
|
||||
XhtmlNode a = td.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "versions.html#std-process"), "Standards Status = "+ss.toDisplay());
|
||||
XhtmlNode a = td.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "versions.html#std-process"), /*!#*/"Standards Status = "+ss.toDisplay());
|
||||
a.style("padding-left: 3px; padding-right: 3px; border: 1px grey solid; font-weight: bold; color: black; background-color: "+ss.getColor());
|
||||
a.tx(ss.getAbbrev());
|
||||
}
|
||||
|
@ -98,21 +72,21 @@ public class Renderer extends TranslatingUtilities {
|
|||
switch (vca.getType()) {
|
||||
case Added:
|
||||
XhtmlNode spanOuter = x.span("border: solid 1px #dddddd; margin: 2px; padding: 2px", null);
|
||||
XhtmlNode spanInner = spanOuter.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+context.getChangeVersion());
|
||||
XhtmlNode spanInner = spanOuter.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been added since "+context.getChangeVersion());
|
||||
spanInner.img("icon-change-add.png", "icon");
|
||||
spanInner.tx(" Added:");
|
||||
spanInner.tx(" "+/*!#*/"Added:");
|
||||
return spanOuter;
|
||||
case Changed:
|
||||
spanOuter = x.span("border: solid 1px #dddddd; margin: 2px; padding: 2px", null);
|
||||
spanInner = spanOuter.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+context.getChangeVersion()+(vca.getOriginal() != null ? " (was '"+vca.getOriginal()+"')" : ""));
|
||||
spanInner = spanOuter.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been changed since "+context.getChangeVersion()+(vca.getOriginal() != null ? " (was '"+vca.getOriginal()+"')" : ""));
|
||||
spanInner.img("icon-change-edit.png", "icon");
|
||||
spanInner.tx(" Changed:");
|
||||
spanInner.tx(" "+/*!#*/"Changed:");
|
||||
return spanOuter;
|
||||
case Deleted:
|
||||
spanOuter = x.span("border: solid 1px #dddddd; margin: 2px; padding: 2px", null);
|
||||
spanInner = spanOuter.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been removed since "+context.getChangeVersion());
|
||||
spanInner = spanOuter.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been removed since "+context.getChangeVersion());
|
||||
spanInner.img("icon-change-remove.png", "icon");
|
||||
spanInner.tx(" Removed:");
|
||||
spanInner.tx(" "+/*!#*/"Removed:");
|
||||
return spanOuter.strikethrough();
|
||||
default:
|
||||
return x;
|
||||
|
@ -130,21 +104,21 @@ public class Renderer extends TranslatingUtilities {
|
|||
switch (vca.getType()) {
|
||||
case Added:
|
||||
XhtmlNode divOuter = x.div("border: solid 1px #dddddd; margin: 2px; padding: 2px");
|
||||
XhtmlNode spanInner = divOuter.para().style("margin: 0").span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+context.getChangeVersion());
|
||||
XhtmlNode spanInner = divOuter.para().style("margin: 0").span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been added since "+context.getChangeVersion());
|
||||
spanInner.img("icon-change-add.png", "icon");
|
||||
spanInner.tx(" Added:");
|
||||
spanInner.tx(" "+/*!#*/"Added:");
|
||||
return divOuter;
|
||||
case Changed:
|
||||
divOuter = x.div("border: solid 1px #dddddd; margin: 2px; padding: 2px");
|
||||
spanInner = divOuter.para().style("margin: 0").span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+context.getChangeVersion()+(vca.getOriginal() != null ? " (was '"+(vca.getOriginal())+"')" : ""));
|
||||
spanInner = divOuter.para().style("margin: 0").span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been changed since "+context.getChangeVersion()+(vca.getOriginal() != null ? " (was '"+(vca.getOriginal())+"')" : ""));
|
||||
spanInner.img("icon-change-edit.png", "icon");
|
||||
spanInner.tx(" Changed:");
|
||||
spanInner.tx(" "+/*!#*/"Changed:");
|
||||
return divOuter;
|
||||
case Deleted:
|
||||
divOuter = x.div("border: solid 1px #dddddd; margin: 2px; padding: 2px");
|
||||
spanInner = divOuter.para().style("margin: 0").span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been removed since "+context.getChangeVersion());
|
||||
spanInner = divOuter.para().style("margin: 0").span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been removed since "+context.getChangeVersion());
|
||||
spanInner.img("icon-change-remove.png", "icon");
|
||||
spanInner.tx(" Removed:");
|
||||
spanInner.tx(" "+/*!#*/"Removed:");
|
||||
return divOuter.strikethrough();
|
||||
default:
|
||||
return x;
|
||||
|
@ -166,27 +140,27 @@ public class Renderer extends TranslatingUtilities {
|
|||
tr.style("border: solid 1px #dddddd; margin: 2px; padding: 2px");
|
||||
}
|
||||
XhtmlNode td = tr.td();
|
||||
XhtmlNode span = td.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This row of content has been added since "+context.getChangeVersion());
|
||||
XhtmlNode span = td.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px",/*!#*/"This row of content has been added since "+context.getChangeVersion());
|
||||
span.img("icon-change-add.png", "icon");
|
||||
span.tx(" Added:");
|
||||
span.tx(" "+/*!#*/"Added:");
|
||||
XhtmlNode x = new XhtmlNode(NodeType.Element, "holder");
|
||||
x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This row of content has been added since "+context.getChangeVersion()).tx(" ");
|
||||
x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This row of content has been added since "+context.getChangeVersion()).tx(" ");
|
||||
tr.styleCells(x);
|
||||
return td;
|
||||
case Changed:
|
||||
td = tr.td();
|
||||
span = td.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This row of content has been changed since"+context.getChangeVersion()+(vca.getOriginal() != null ? " (was '"+vca.getOriginal()+"')" : ""));
|
||||
span = td.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This row of content has been changed since"+context.getChangeVersion()+(vca.getOriginal() != null ? " (was '"+vca.getOriginal()+"')" : ""));
|
||||
span.img("icon-change-edit.png", "icon");
|
||||
span.tx(" Changed:");
|
||||
span.tx(" "+/*!#*/"Changed:");
|
||||
return td;
|
||||
case Deleted:
|
||||
tr.style("text-decoration: line-through");
|
||||
td = tr.td();
|
||||
span = td.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been removed since "+context.getChangeVersion());
|
||||
span = td.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been removed since "+context.getChangeVersion());
|
||||
span.img("icon-change-remove.png", "icon");
|
||||
span.tx(" Removed:");
|
||||
span.tx(" "+/*!#*/"Removed:");
|
||||
x = new XhtmlNode(NodeType.Element, "holder");
|
||||
x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px; text-decoration: none", "This row of content has been added since "+context.getChangeVersion()).tx(" ");
|
||||
x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px; text-decoration: none", /*!#*/"This row of content has been added since "+context.getChangeVersion()).tx(" ");
|
||||
tr.styleCells(x);
|
||||
return td;
|
||||
default:
|
||||
|
@ -199,24 +173,24 @@ public class Renderer extends TranslatingUtilities {
|
|||
VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(VersionComparisonAnnotation.USER_DATA_NAME);
|
||||
switch (self.getType()) {
|
||||
case Added:
|
||||
XhtmlNode spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version);
|
||||
XhtmlNode spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been added since "+version);
|
||||
spanInner.img("icon-change-add.png", "icon");
|
||||
spanInner.tx(" Added");
|
||||
spanInner.tx(" "+/*!#*/"Added");
|
||||
return;
|
||||
case Changed:
|
||||
if (self.getComp().noChangeOtherThanMetadata(metadataFields)) {
|
||||
x.span("color: #eeeeee").tx("n/c");
|
||||
return;
|
||||
} else {
|
||||
spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+version+(self.getOriginal() != null ? " (was '"+(self.getOriginal())+"')" : ""));
|
||||
spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been changed since "+version+(self.getOriginal() != null ? " (was '"+(self.getOriginal())+"')" : ""));
|
||||
spanInner.img("icon-change-edit.png", "icon");
|
||||
spanInner.tx(" Changed");
|
||||
spanInner.tx(" "+/*!#*/"Changed");
|
||||
}
|
||||
return;
|
||||
case Deleted:
|
||||
spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version);
|
||||
spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", /*!#*/"This content has been added since "+version);
|
||||
spanInner.img("icon-change-remove.png", "icon");
|
||||
spanInner.tx(" Removed");
|
||||
spanInner.tx(" "+/*!#*/"Removed");
|
||||
return;
|
||||
default:
|
||||
x.span("color: #eeeeee").tx("n/c");
|
||||
|
@ -227,4 +201,20 @@ public class Renderer extends TranslatingUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public String egt(@SuppressWarnings("rawtypes") Enumeration<? extends Enum> value) {
|
||||
if (value == null || !value.hasPrimitiveValue()) {
|
||||
return null;
|
||||
} else {
|
||||
return (value == null || !value.hasPrimitiveValue()) ? null : value.asStringValue();
|
||||
}
|
||||
}
|
||||
|
||||
public String toStr(int value) {
|
||||
return Integer.toString(value);
|
||||
}
|
||||
|
||||
public String toStr(Date value) {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,14 +43,14 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
if (req.getActor().size() == 1) {
|
||||
ActorDefinition acd = context.getWorker().fetchResource(ActorDefinition.class, req.getActor().get(0).getValue(), req);
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("These requirements apply to the actor ");
|
||||
p.tx(/*!#*/"These requirements apply to the actor ");
|
||||
if (acd == null) {
|
||||
p.code(req.getActor().get(0).getValue());
|
||||
} else {
|
||||
p.ah(acd.getWebPath()).tx(acd.present());
|
||||
}
|
||||
} else {
|
||||
x.para().tx("These requirements apply to the following actors:");
|
||||
x.para().tx(/*!#*/"These requirements apply to the following actors:");
|
||||
XhtmlNode ul = x.ul();
|
||||
for (CanonicalType a : req.getActor()) {
|
||||
ActorDefinition acd = context.getWorker().fetchResource(ActorDefinition.class, a.getValue(), req);
|
||||
|
@ -66,14 +66,14 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
if (req.getDerivedFrom().size() == 1) {
|
||||
Requirements reqd = context.getWorker().fetchResource(Requirements.class, req.getDerivedFrom().get(0).getValue(), req);
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("These requirements derive from ");
|
||||
p.tx(/*!#*/"These requirements derive from ");
|
||||
if (reqd == null) {
|
||||
p.code(req.getDerivedFrom().get(0).getValue());
|
||||
} else {
|
||||
p.ah(reqd.getWebPath()).tx(reqd.present());
|
||||
}
|
||||
} else {
|
||||
x.para().tx("These requirements are derived from the following requirements:");
|
||||
x.para().tx(/*!#*/"These requirements are derived from the following requirements:");
|
||||
XhtmlNode ul = x.ul();
|
||||
for (CanonicalType a : req.getDerivedFrom()) {
|
||||
Requirements reqd = context.getWorker().fetchResource(Requirements.class, a.getValue(), req);
|
||||
|
@ -87,7 +87,7 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (req.hasReference()) {
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("References: ");
|
||||
p.tx(/*!#*/"References: ");
|
||||
int i = 0;
|
||||
for (UrlType c : req.getReference()) {
|
||||
i++;
|
||||
|
@ -121,11 +121,11 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
td = tr.td();
|
||||
addMarkdown(td, stmt.getRequirement());
|
||||
if (stmt.hasDerivedFrom() || stmt.hasSatisfiedBy() || stmt.hasReference() || stmt.hasSource()) {
|
||||
td.para().tx("Links:");
|
||||
td.para().tx(/*!#*/"Links:");
|
||||
XhtmlNode ul = td.ul();
|
||||
if (stmt.hasDerivedFrom()) {
|
||||
XhtmlNode li = ul.li();
|
||||
li.tx("Derived From: ");
|
||||
li.tx(/*!#*/"Derived From: ");
|
||||
String url = stmt.getDerivedFrom();
|
||||
String key = url.contains("#") ? url.substring(url.indexOf("#")+1) : "";
|
||||
if (url.contains("#")) { url = url.substring(0, url.indexOf("#")); };
|
||||
|
@ -143,7 +143,7 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (stmt.hasSatisfiedBy()) {
|
||||
XhtmlNode li = ul.li();
|
||||
li.tx("Satisfied By: ");
|
||||
li.tx(/*!#*/"Satisfied By: ");
|
||||
first = true;
|
||||
for (UrlType c : stmt.getSatisfiedBy()) {
|
||||
if (first) first = false; else li.tx(", ");
|
||||
|
@ -162,7 +162,7 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (stmt.hasReference()) {
|
||||
XhtmlNode li = ul.li();
|
||||
li.tx("References: ");
|
||||
li.tx(/*!#*/"References: ");
|
||||
int i = 0;
|
||||
for (UrlType c : stmt.getReference()) {
|
||||
i++;
|
||||
|
@ -176,7 +176,7 @@ public class RequirementsRenderer extends ResourceRenderer {
|
|||
}
|
||||
if (stmt.hasSource()) {
|
||||
XhtmlNode li = ul.li();
|
||||
li.tx("Source: ");
|
||||
li.tx(/*!#*/"Source: ");
|
||||
first = true;
|
||||
for (Reference c : stmt.getSource()) {
|
||||
if (first) first = false; else li.tx(", ");
|
||||
|
|
|
@ -92,6 +92,12 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
|
||||
boolean hasExtensions;
|
||||
hasExtensions = render(x, r);
|
||||
String an = r.fhirType()+"_"+r.getId();
|
||||
if (context.isAddName()) {
|
||||
if (!hasAnchorName(x, an)) {
|
||||
injectAnchorName(x, an);
|
||||
}
|
||||
}
|
||||
inject(r, x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED);
|
||||
}
|
||||
|
||||
|
@ -99,12 +105,53 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
assert r.getContext() == context;
|
||||
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
|
||||
boolean hasExtensions = render(x, r);
|
||||
|
||||
String an = r.fhirType()+"_"+r.getId();
|
||||
if (context.isAddName()) {
|
||||
if (!hasAnchorName(x, an)) {
|
||||
injectAnchorName(x, an);
|
||||
}
|
||||
}
|
||||
if (r.hasNarrative()) {
|
||||
r.injectNarrative(x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public XhtmlNode checkNarrative(ResourceWrapper r) throws IOException, FHIRException, EOperationOutcome {
|
||||
assert r.getContext() == context;
|
||||
XhtmlNode x = r.getNarrative();
|
||||
String an = r.fhirType()+"_"+r.getId();
|
||||
if (context.isAddName()) {
|
||||
if (!hasAnchorName(x, an)) {
|
||||
injectAnchorName(x, an);
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
private void injectAnchorName(XhtmlNode x, String an) {
|
||||
XhtmlNode ip = x;
|
||||
while (ip.hasChildren() && "div".equals(ip.getChildNodes().get(0).getName())) {
|
||||
ip = ip.getChildNodes().get(0);
|
||||
}
|
||||
ip.addTag(0, "a").setAttribute("name", an).tx(" ");
|
||||
}
|
||||
|
||||
protected boolean hasAnchorName(XhtmlNode x, String an) {
|
||||
if ("a".equals(x.getName()) && an.equals(x.getAttribute("name"))) {
|
||||
return true;
|
||||
}
|
||||
if (x.hasChildren()) {
|
||||
for (XhtmlNode c : x.getChildNodes()) {
|
||||
if (hasAnchorName(c, an)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract boolean render(XhtmlNode x, Resource r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome;
|
||||
|
||||
public boolean render(XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
|
||||
|
@ -163,11 +210,11 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
CanonicalResource cr = (CanonicalResource) target;
|
||||
if (url.contains("|")) {
|
||||
if (target.hasWebPath()) {
|
||||
x.ah(target.getWebPath()).tx(cr.present()+" (version "+cr.getVersion()+")");
|
||||
x.ah(target.getWebPath()).tx(cr.present()+/*!#*/" (version "+cr.getVersion()+")");
|
||||
} else {
|
||||
url = url.substring(0, url.indexOf("|"));
|
||||
x.code().tx(url);
|
||||
x.tx(": "+cr.present()+" (version "+cr.getVersion()+")");
|
||||
x.tx(": "+cr.present()+/*!#*/" (version "+cr.getVersion()+")");
|
||||
}
|
||||
} else {
|
||||
if (target.hasWebPath()) {
|
||||
|
@ -235,14 +282,14 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
if (tr != null && tr.getReference() != null) {
|
||||
link = tr.getReference();
|
||||
} else if (r.getReference().contains("?")) {
|
||||
text.append("Conditional Reference: ");
|
||||
text.append(/*!#*/"Conditional Reference: ");
|
||||
} else {
|
||||
link = r.getReference();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tr != null && tr.getReference() != null && tr.getReference().startsWith("#")) {
|
||||
text.append("See above (");
|
||||
text.append(/*!#*/"See above (");
|
||||
}
|
||||
// what to display: if text is provided, then that. if the reference was resolved, then show the name, or the generated narrative
|
||||
String display = r.hasDisplayElement() ? r.getDisplay() : null;
|
||||
|
@ -286,7 +333,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
} else if (name != null) {
|
||||
text.append(name);
|
||||
} else {
|
||||
text.append(". Description: (todo)");
|
||||
text.append(/*!#*/". Description: (todo)");
|
||||
}
|
||||
}
|
||||
if (tr != null && tr.getReference() != null && tr.getReference().startsWith("#")) {
|
||||
|
@ -309,19 +356,21 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
if (tr != null && tr.getReference() != null) {
|
||||
c = x.ah(tr.getReference());
|
||||
} else if (r.getReference().contains("?")) {
|
||||
x.tx("Conditional Reference: ");
|
||||
x.tx(/*!#*/"Conditional Reference: ");
|
||||
c = x.code("");
|
||||
} else {
|
||||
c = x.ah(r.getReference());
|
||||
}
|
||||
} else if ("#".equals(r.getReference())) {
|
||||
c = x.ah("#");
|
||||
} else {
|
||||
c = x.ah(r.getReference());
|
||||
c = x.ah("#hc"+r.getReference().substring(1));
|
||||
}
|
||||
} else {
|
||||
c = x.span(null, null);
|
||||
}
|
||||
if (tr != null && tr.getReference() != null && tr.getReference().startsWith("#")) {
|
||||
c.tx("See above (");
|
||||
c.tx(/*!#*/"See above (");
|
||||
}
|
||||
// what to display: if text is provided, then that. if the reference was resolved, then show the name, or the generated narrative
|
||||
String display = r.hasDisplayElement() ? r.getDisplay() : null;
|
||||
|
@ -365,7 +414,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
} else if (name != null) {
|
||||
c.addText(name);
|
||||
} else {
|
||||
c.tx(". Generated Summary: ");
|
||||
c.tx(/*!#*/". Generated Summary: ");
|
||||
if (tr != null) {
|
||||
new ProfileDrivenRenderer(context).generateResourceSummary(c, tr.getResource(), true, r.getReference().startsWith("#"), true);
|
||||
}
|
||||
|
@ -397,7 +446,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
if (r.has("display")) {
|
||||
c.addText(r.get("display").primitiveValue());
|
||||
if (tr != null && tr.getResource() != null) {
|
||||
c.tx(". Generated Summary: ");
|
||||
c.tx(/*!#*/". Generated Summary: ");
|
||||
new ProfileDrivenRenderer(context).generateResourceSummary(c, tr.getResource(), true, v.startsWith("#"), false);
|
||||
}
|
||||
} else if (tr != null && tr.getResource() != null) {
|
||||
|
@ -438,7 +487,11 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
String bundleUrl = null;
|
||||
Element br = bundleElement.getNamedChild("resource", false);
|
||||
if (br.getChildValue("id") != null) {
|
||||
bundleUrl = "#" + br.fhirType() + "_" + br.getChildValue("id");
|
||||
if ("Bundle".equals(br.fhirType())) {
|
||||
bundleUrl = "#";
|
||||
} else {
|
||||
bundleUrl = "#" + br.fhirType() + "_" + br.getChildValue("id");
|
||||
}
|
||||
} else {
|
||||
bundleUrl = "#" +fullUrlToAnchor(bundleElement.getChildValue("fullUrl"));
|
||||
}
|
||||
|
@ -472,12 +525,12 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
|
||||
protected void generateCopyright(XhtmlNode x, CanonicalResource cs) {
|
||||
XhtmlNode p = x.para();
|
||||
p.b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Copyright Statement:", context.getLang()));
|
||||
p.b().tx(getContext().formatMessage(RenderingContext.RENDER_RESOURCE_COPYRIGHT));
|
||||
smartAddText(p, " " + cs.getCopyright());
|
||||
}
|
||||
|
||||
public String displayReference(Resource res, Reference r) throws UnsupportedEncodingException, IOException {
|
||||
return "todo";
|
||||
return /*!#*/"todo";
|
||||
}
|
||||
|
||||
|
||||
|
@ -522,10 +575,10 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
|
||||
protected String describeStatus(PublicationStatus status, boolean experimental) {
|
||||
switch (status) {
|
||||
case ACTIVE: return experimental ? "Experimental" : "Active";
|
||||
case DRAFT: return "draft";
|
||||
case RETIRED: return "retired";
|
||||
default: return "Unknown";
|
||||
case ACTIVE: return experimental ? /*!#*/"Experimental" : /*!#*/"Active";
|
||||
case DRAFT: return /*!#*/"draft";
|
||||
case RETIRED: return /*!#*/"retired";
|
||||
default: return /*!#*/"Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,7 +612,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
|
||||
String id = getPrimitiveValue(r, "id");
|
||||
if (doId) {
|
||||
div.an(id);
|
||||
div.an("hc"+id);
|
||||
}
|
||||
|
||||
String lang = getPrimitiveValue(r, "language");
|
||||
|
@ -571,35 +624,35 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
|
||||
if (id != null || lang != null || versionId != null || lastUpdated != null) {
|
||||
XhtmlNode p = plateStyle(div.para());
|
||||
p.tx("Resource ");
|
||||
p.tx(/*!#*/"Resource ");
|
||||
p.tx(r.fhirType());
|
||||
p.tx(" ");
|
||||
if (id != null) {
|
||||
p.tx("\""+id+"\" ");
|
||||
}
|
||||
if (versionId != null) {
|
||||
p.tx("Version \""+versionId+"\" ");
|
||||
p.tx(/*!#*/"Version \""+versionId+"\" ");
|
||||
}
|
||||
if (lastUpdated != null) {
|
||||
p.tx("Updated \"");
|
||||
p.tx(/*!#*/"Updated \"");
|
||||
renderDateTime(p, lastUpdated);
|
||||
p.tx("\" ");
|
||||
}
|
||||
if (lang != null) {
|
||||
p.tx(" (Language \""+lang+"\") ");
|
||||
p.tx(/*!#*/" (Language \""+lang+"\") ");
|
||||
}
|
||||
}
|
||||
if (ir != null) {
|
||||
plateStyle(div.para()).b().tx("Special rules apply: "+ir+"!");
|
||||
plateStyle(div.para()).b().tx(/*!#*/"Special rules apply: "+ir+"!");
|
||||
}
|
||||
if (source != null) {
|
||||
plateStyle(div.para()).tx("Information Source: "+source+"!");
|
||||
plateStyle(div.para()).tx(/*!#*/"Information Source: "+source+"!");
|
||||
}
|
||||
if (meta != null) {
|
||||
PropertyWrapper pl = meta.getChildByName("profile");
|
||||
if (pl.hasValues()) {
|
||||
XhtmlNode p = plateStyle(div.para());
|
||||
p.tx(Utilities.pluralize("Profile", pl.getValues().size())+": ");
|
||||
p.tx(Utilities.pluralize(/*!#*/"Profile", pl.getValues().size())+": ");
|
||||
boolean first = true;
|
||||
for (BaseWrapper bw : pl.getValues()) {
|
||||
if (first) first = false; else p.tx(", ");
|
||||
|
@ -609,7 +662,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
PropertyWrapper tl = meta.getChildByName("tag");
|
||||
if (tl.hasValues()) {
|
||||
XhtmlNode p = plateStyle(div.para());
|
||||
p.tx(Utilities.pluralize("Tag", tl.getValues().size())+": ");
|
||||
p.tx(Utilities.pluralize(/*!#*/"Tag", tl.getValues().size())+": ");
|
||||
boolean first = true;
|
||||
for (BaseWrapper bw : tl.getValues()) {
|
||||
if (first) first = false; else p.tx(", ");
|
||||
|
@ -623,7 +676,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
PropertyWrapper sl = meta.getChildByName("security");
|
||||
if (sl.hasValues()) {
|
||||
XhtmlNode p = plateStyle(div.para());
|
||||
p.tx(Utilities.pluralize("Security Label", tl.getValues().size())+": ");
|
||||
p.tx(Utilities.pluralize(/*!#*/"Security Label", tl.getValues().size())+": ");
|
||||
boolean first = true;
|
||||
for (BaseWrapper bw : sl.getValues()) {
|
||||
if (first) first = false; else p.tx(", ");
|
||||
|
@ -655,7 +708,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
render(dr);
|
||||
} catch (Exception e) {
|
||||
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
|
||||
x.para().tx("Error rendering: "+e.getMessage());
|
||||
x.para().tx(/*!#*/"Error rendering: "+e.getMessage());
|
||||
dr.setText(null);
|
||||
inject(dr, x, NarrativeStatus.GENERATED);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
genStandardsStatus(h2, ss);
|
||||
}
|
||||
XhtmlNode p = x.para();
|
||||
p.tx("Parameter ");
|
||||
p.tx(/*!#*/"Parameter ");
|
||||
p.code().tx(spd.getCode());
|
||||
p.tx(":");
|
||||
p.code().tx(spd.getType().toCode());
|
||||
|
@ -55,7 +55,7 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
|
||||
XhtmlNode tbl = x.table("grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Resource", spd.getBase().size()));
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Resource", spd.getBase().size()));
|
||||
XhtmlNode td = tr.td();
|
||||
for (Enumeration<VersionIndependentResourceTypesAll> t : spd.getBase()) {
|
||||
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.getCode());
|
||||
|
@ -68,23 +68,23 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Expression");
|
||||
tr.td().tx(/*!#*/"Expression");
|
||||
if (spd.hasExpression()) {
|
||||
tr.td().code().tx(spd.getExpression());
|
||||
} else {
|
||||
tr.td().tx("(none)");
|
||||
tr.td().tx(/*!#*/"(none)");
|
||||
}
|
||||
if (spd.hasProcessingMode()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Processing Mode");
|
||||
tr.td().tx(/*!#*/"Processing Mode");
|
||||
tr.td().tx(spd.getProcessingMode().getDisplay());
|
||||
}
|
||||
if (spd.hasTarget()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx(Utilities.pluralize("Target Resources", spd.getTarget().size()));
|
||||
tr.td().tx(Utilities.pluralize(/*!#*/"Target Resources", spd.getTarget().size()));
|
||||
td = tr.td();
|
||||
if (isAllConcreteResources(spd.getTarget())) {
|
||||
td.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "resourcelist.html")).tx("All Resources");
|
||||
td.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "resourcelist.html")).tx(/*!#*/"All Resources");
|
||||
} else {
|
||||
for (Enumeration<VersionIndependentResourceTypesAll> t : spd.getTarget()) {
|
||||
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.getCode());
|
||||
|
@ -99,28 +99,28 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Multiples");
|
||||
tr.td().tx(/*!#*/"Multiples");
|
||||
XhtmlNode ul = tr.td().ul();
|
||||
if (!spd.hasMultipleAnd()) {
|
||||
ul.li().tx("multipleAnd: It's up to the server whether the parameter may repeat in order to specify multiple values that must all be true");
|
||||
ul.li().tx(/*!#*/"multipleAnd: It's up to the server whether the parameter may repeat in order to specify multiple values that must all be true");
|
||||
} else if (spd.getMultipleAnd()) {
|
||||
ul.li().tx("multipleAnd: The parameter may repeat in order to specify multiple values that must all be true");
|
||||
ul.li().tx(/*!#*/"multipleAnd: The parameter may repeat in order to specify multiple values that must all be true");
|
||||
} else {
|
||||
ul.li().tx("multipleAnd: The parameter may only appear once");
|
||||
ul.li().tx(/*!#*/"multipleAnd: The parameter may only appear once");
|
||||
}
|
||||
if (!spd.hasMultipleOr()) {
|
||||
ul.li().tx("multipleOr: It's up to the server whether the parameter can have multiple values (separated by comma) where at least one must be true");
|
||||
ul.li().tx(/*!#*/"multipleOr: It's up to the server whether the parameter can have multiple values (separated by comma) where at least one must be true");
|
||||
} else if (spd.getMultipleOr()) {
|
||||
ul.li().tx("multipleOr: The parameter may have multiple values (separated by comma) where at least one must be true");
|
||||
ul.li().tx(/*!#*/"multipleOr: The parameter may have multiple values (separated by comma) where at least one must be true");
|
||||
} else {
|
||||
ul.li().tx("multipleOr: The parameter may only have one value (no comma separators)");
|
||||
ul.li().tx(/*!#*/"multipleOr: The parameter may only have one value (no comma separators)");
|
||||
}
|
||||
|
||||
if (spd.hasComparator()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Comparators");
|
||||
tr.td().tx(/*!#*/"Comparators");
|
||||
td = tr.td();
|
||||
td.tx("Allowed: ");
|
||||
td.tx(/*!#*/"Allowed: ");
|
||||
for (Enumeration<SearchComparator> t : spd.getComparator()) {
|
||||
td.sep(", ");
|
||||
td.tx(t.asStringValue());
|
||||
|
@ -128,9 +128,9 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (spd.hasModifier()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Modifiers");
|
||||
tr.td().tx(/*!#*/"Modifiers");
|
||||
td = tr.td();
|
||||
td.tx("Allowed: ");
|
||||
td.tx(/*!#*/"Allowed: ");
|
||||
for (Enumeration<SearchModifierCode> t : spd.getModifier()) {
|
||||
td.sep(", ");
|
||||
td.tx(t.asStringValue());
|
||||
|
@ -138,9 +138,9 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
}
|
||||
if (spd.hasChain()) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("Chains");
|
||||
tr.td().tx(/*!#*/"Chains");
|
||||
td = tr.td();
|
||||
td.tx("Allowed: ");
|
||||
td.tx(/*!#*/"Allowed: ");
|
||||
for (StringType t : spd.getChain()) {
|
||||
td.sep(", ");
|
||||
td.tx(t.asStringValue());
|
||||
|
@ -148,7 +148,7 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
}
|
||||
|
||||
if (spd.hasComponent()) {
|
||||
x.para().b().tx("Components");
|
||||
x.para().b().tx(/*!#*/"Components");
|
||||
tbl = x.table("grid");
|
||||
for (SearchParameterComponentComponent t : spd.getComponent()) {
|
||||
tr = tbl.tr();
|
||||
|
@ -167,7 +167,7 @@ public class SearchParameterRenderer extends TerminologyRenderer {
|
|||
private boolean isAllConcreteResources(List<Enumeration<VersionIndependentResourceTypesAll>> list) {
|
||||
for (String s : context.getWorker().getResourceNames()) {
|
||||
StructureDefinition sd = context.getWorker().fetchTypeDefinition(s);
|
||||
if (!sd.getAbstract() && !Utilities.existsInList(sd.getType(), "Parameters")) {
|
||||
if (!sd.getAbstract() && !Utilities.existsInList(sd.getType(), /*!#*/"Parameters")) {
|
||||
boolean found = false;
|
||||
for (Enumeration<VersionIndependentResourceTypesAll> c : list) {
|
||||
found = found || sd.getName().equals(c.getCode());
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue