use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class ResourceRenderer method generateCopyright.
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()));
smartAddText(p, " " + cs.getCopyright());
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class ResourceRenderer method renderCommitteeLink.
protected void renderCommitteeLink(XhtmlNode x, CanonicalResource cr) {
String code = ToolingExtensions.readStringExtension(cr, ToolingExtensions.EXT_WORKGROUP);
CodeSystem cs = context.getWorker().fetchCodeSystem("http://terminology.hl7.org/CodeSystem/hl7-work-group");
if (cs == null || !cs.hasUserData("path"))
x.tx(code);
else {
ConceptDefinitionComponent cd = CodeSystemUtilities.findCode(cs.getConcept(), code);
if (cd == null) {
x.tx(code);
} else {
x.ah(cs.getUserString("path") + "#" + cs.getId() + "-" + cd.getCode()).tx(cd.getDisplay());
}
}
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class TerminologyRenderer method AddVsRef.
protected void AddVsRef(String value, XhtmlNode li) {
Resource res = null;
if (rcontext != null) {
BundleEntryComponent be = rcontext.resolve(value);
if (be != null) {
res = be.getResource();
}
}
if (res != null && !(res instanceof CanonicalResource)) {
li.addText(value);
return;
}
CanonicalResource vs = (CanonicalResource) res;
if (vs == null)
vs = getContext().getWorker().fetchResource(ValueSet.class, value);
if (vs == null)
vs = getContext().getWorker().fetchResource(StructureDefinition.class, value);
// vs = context.getWorker().fetchResource(DataElement.class, value);
if (vs == null)
vs = getContext().getWorker().fetchResource(Questionnaire.class, value);
if (vs != null) {
String ref = (String) vs.getUserData("path");
ref = context.fixReference(ref);
XhtmlNode a = li.ah(ref == null ? "?ngen-11?" : ref.replace("\\", "/"));
a.addText(value);
} else {
CodeSystem cs = getContext().getWorker().fetchCodeSystem(value);
if (cs != null) {
String ref = (String) cs.getUserData("path");
ref = context.fixReference(ref);
XhtmlNode a = li.ah(ref == null ? "?ngen-12?" : ref.replace("\\", "/"));
a.addText(value);
} else if (value.equals("http://snomed.info/sct") || value.equals("http://snomed.info/id")) {
XhtmlNode a = li.ah(value);
a.tx("SNOMED-CT");
} else {
if (value.startsWith("http://hl7.org") && !Utilities.existsInList(value, "http://hl7.org/fhir/sid/icd-10-us"))
System.out.println("Unable to resolve value set " + value);
li.addText(value);
}
}
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class ValueSetRenderer method findReleventMaps.
private List<UsedConceptMap> findReleventMaps(ValueSet vs) throws FHIRException {
List<UsedConceptMap> res = new ArrayList<UsedConceptMap>();
for (CanonicalResource md : getContext().getWorker().allConformanceResources()) {
if (md instanceof ConceptMap) {
ConceptMap cm = (ConceptMap) md;
if (isSource(vs, cm.getSource())) {
ConceptMapRenderInstructions re = findByTarget(cm.getTarget());
if (re != null) {
ValueSet vst = cm.hasTarget() ? getContext().getWorker().fetchResource(ValueSet.class, cm.hasTargetCanonicalType() ? cm.getTargetCanonicalType().getValue() : cm.getTargetUriType().asStringValue()) : null;
res.add(new UsedConceptMap(re, vst == null ? cm.getUserString("path") : vst.getUserString("path"), cm));
}
}
}
}
return res;
// Map<ConceptMap, String> mymaps = new HashMap<ConceptMap, String>();
// for (ConceptMap a : context.getWorker().findMapsForSource(vs.getUrl())) {
// String url = "";
// ValueSet vsr = context.getWorker().fetchResource(ValueSet.class, ((Reference) a.getTarget()).getReference());
// if (vsr != null)
// url = (String) vsr.getUserData("filename");
// mymaps.put(a, url);
// }
// Map<ConceptMap, String> mymaps = new HashMap<ConceptMap, String>();
// for (ConceptMap a : context.getWorker().findMapsForSource(cs.getValueSet())) {
// String url = "";
// ValueSet vsr = context.getWorker().fetchResource(ValueSet.class, ((Reference) a.getTarget()).getReference());
// if (vsr != null)
// url = (String) vsr.getUserData("filename");
// mymaps.put(a, url);
// }
// also, look in the contained resources for a concept map
// for (Resource r : cs.getContained()) {
// if (r instanceof ConceptMap) {
// ConceptMap cm = (ConceptMap) r;
// if (((Reference) cm.getSource()).getReference().equals(cs.getValueSet())) {
// String url = "";
// ValueSet vsr = context.getWorker().fetchResource(ValueSet.class, ((Reference) cm.getTarget()).getReference());
// if (vsr != null)
// url = (String) vsr.getUserData("filename");
// mymaps.put(cm, url);
// }
// }
// }
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method addPrimitiveTypeRow.
@SuppressWarnings("rawtypes")
private Row addPrimitiveTypeRow(HierarchicalTableGenerator gen, List<Row> rows, StructuralMatch<Element> t, CapabilityStatementComparison comparison) {
Row r = gen.new Row();
rows.add(r);
r.getCells().add(gen.new Cell(null, null, t.getName(), null, null));
PrimitiveType left = t.hasLeft() ? (PrimitiveType) t.getLeft() : null;
PrimitiveType right = t.hasRight() ? (PrimitiveType) t.getRight() : null;
CanonicalResource crL = left == null ? null : (CanonicalResource) session.getContextLeft().fetchResource(Resource.class, left.primitiveValue());
CanonicalResource crR = right == null ? null : (CanonicalResource) session.getContextRight().fetchResource(Resource.class, right.primitiveValue());
String refL = crL != null && crL.hasUserData("path") ? crL.getUserString("path") : null;
String dispL = crL != null && refL != null ? crL.present() : left == null ? "" : left.primitiveValue();
String refR = crR != null && crR.hasUserData("path") ? crR.getUserString("path") : null;
String dispR = crR != null && refR != null ? crR.present() : right == null ? "" : right.primitiveValue();
r.getCells().add(style(gen.new Cell(null, refL, dispL, null, null), left != null ? left.primitiveValue() : null, right != null ? right.primitiveValue() : null, true));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(style(gen.new Cell(null, refR, dispR, null, null), left != null ? left.primitiveValue() : null, right != null ? right.primitiveValue() : null, false));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(cellForMessages(gen, t.getMessages()));
return r;
}
Aggregations