use of org.hl7.fhir.r4.model.codesystems.V3ActCode.IMP in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generateComposition.
private boolean generateComposition(XhtmlNode x, ValueSet vs, boolean header) {
boolean hasExtensions = false;
if (header) {
XhtmlNode h = x.addTag("h2");
h.addText(vs.getName());
XhtmlNode p = x.addTag("p");
smartAddText(p, vs.getDescription());
if (vs.hasCopyrightElement())
generateCopyright(x, vs);
}
XhtmlNode p = x.addTag("p");
p.addText("This value set includes codes from the following code systems:");
XhtmlNode ul = x.addTag("ul");
XhtmlNode li;
for (UriType imp : vs.getCompose().getImport()) {
li = ul.addTag("li");
li.addText("Import all the codes that are contained in ");
AddVsRef(imp.getValue(), li);
}
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
hasExtensions = genInclude(ul, inc, "Include") || hasExtensions;
}
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
hasExtensions = genInclude(ul, exc, "Exclude") || hasExtensions;
}
return hasExtensions;
}
use of org.hl7.fhir.r4.model.codesystems.V3ActCode.IMP in project org.hl7.fhir.core by hapifhir.
the class ProfileComparer method unite.
private ValueSet unite(ElementDefinition ed, ProfileComparison outcome, String path, ValueSet lvs, ValueSet rvs) {
ValueSet vs = new ValueSet();
if (lvs.hasCompose()) {
for (UriType imp : lvs.getCompose().getImport()) vs.getCompose().getImport().add(imp);
for (ConceptSetComponent inc : lvs.getCompose().getInclude()) vs.getCompose().getInclude().add(inc);
if (lvs.getCompose().hasExclude()) {
outcome.messages.add(new ValidationMessage(Source.ProfileComparer, IssueType.STRUCTURE, path, "The value sets " + lvs.getUrl() + " has exclude statements, and no union involving it can be correctly determined", IssueSeverity.ERROR));
status(ed, ProfileUtilities.STATUS_ERROR);
}
}
if (rvs.hasCompose()) {
for (UriType imp : rvs.getCompose().getImport()) if (!vs.getCompose().hasImport(imp.getValue()))
vs.getCompose().getImport().add(imp);
for (ConceptSetComponent inc : rvs.getCompose().getInclude()) if (!mergeIntoExisting(vs.getCompose().getInclude(), inc))
vs.getCompose().getInclude().add(inc);
if (rvs.getCompose().hasExclude()) {
outcome.messages.add(new ValidationMessage(Source.ProfileComparer, IssueType.STRUCTURE, path, "The value sets " + lvs.getUrl() + " has exclude statements, and no union involving it can be correctly determined", IssueSeverity.ERROR));
status(ed, ProfileUtilities.STATUS_ERROR);
}
}
return vs;
}
use of org.hl7.fhir.r4.model.codesystems.V3ActCode.IMP in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method executeDependency.
private void executeDependency(String indent, TransformContext context, StructureMap map, Variables vin, StructureMapGroupComponent group, StructureMapGroupRuleDependentComponent dependent) throws Exception {
StructureMap targetMap = null;
StructureMapGroupComponent target = null;
for (StructureMapGroupComponent grp : map.getGroup()) {
if (grp.getName().equals(dependent.getName())) {
if (targetMap == null) {
targetMap = map;
target = grp;
} else
throw new FHIRException("Multiple possible matches for rule '" + dependent.getName() + "'");
}
}
for (UriType imp : map.getImport()) {
StructureMap impMap = library.get(imp.getValue());
if (impMap == null)
throw new FHIRException("Unable to find map " + imp.getValue() + " (Known Maps = " + Utilities.listCanonicalUrls(library.keySet()) + ")");
for (StructureMapGroupComponent grp : impMap.getGroup()) {
if (grp.getName().equals(dependent.getName())) {
if (targetMap == null) {
targetMap = impMap;
target = grp;
} else
throw new FHIRException("Multiple possible matches for rule '" + dependent.getName() + "'");
}
}
}
if (target == null)
throw new FHIRException("No matches found for rule '" + dependent.getName() + "'");
if (target.getInput().size() != dependent.getVariable().size()) {
throw new FHIRException("Rule '" + dependent.getName() + "' has " + Integer.toString(target.getInput().size()) + " but the invocation has " + Integer.toString(dependent.getVariable().size()) + " variables");
}
Variables v = new Variables();
for (int i = 0; i < target.getInput().size(); i++) {
StructureMapGroupInputComponent input = target.getInput().get(i);
StringType var = dependent.getVariable().get(i);
VariableMode mode = input.getMode() == StructureMapInputMode.SOURCE ? VariableMode.INPUT : VariableMode.OUTPUT;
Base vv = vin.get(mode, var.getValue());
if (vv == null)
throw new FHIRException("Rule '" + dependent.getName() + "' " + mode.toString() + " variable '" + input.getName() + "' has no value");
v.add(mode, input.getName(), vv);
}
executeGroup(indent + " ", context, targetMap, v, target);
}
Aggregations