use of org.hl7.fhir.dstu2016may.model.StructureMap in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method analyseGroup.
private void analyseGroup(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapAnalysis result) throws FHIRException {
log(indent + "Analyse Group : " + group.getName());
// todo: extends
// todo: check inputs
XhtmlNode tr = result.summary.addTag("tr").setAttribute("class", "diff-title");
XhtmlNode xs = tr.addTag("td");
XhtmlNode xt = tr.addTag("td");
for (StructureMapGroupInputComponent inp : group.getInput()) {
if (inp.getMode() == StructureMapInputMode.SOURCE)
noteInput(vars, inp, VariableMode.INPUT, xs);
if (inp.getMode() == StructureMapInputMode.TARGET)
noteInput(vars, inp, VariableMode.OUTPUT, xt);
}
for (StructureMapGroupRuleComponent r : group.getRule()) {
analyseRule(indent + " ", context, map, vars, group, r, result);
}
}
use of org.hl7.fhir.dstu2016may.model.StructureMap in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method analyseTransform.
private TypeDetails analyseTransform(TransformContext context, StructureMap map, StructureMapGroupRuleTargetComponent tgt, VariableForProfiling var, VariablesForProfiling vars) throws FHIRException {
switch(tgt.getTransform()) {
case CREATE:
String p = getParamString(vars, tgt.getParameter().get(0));
return new TypeDetails(CollectionStatus.SINGLETON, p);
case COPY:
return getParam(vars, tgt.getParameter().get(0));
case EVALUATE:
ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION);
if (expr == null) {
expr = fpe.parse(getParamString(vars, tgt.getParameter().get(tgt.getParameter().size() - 1)));
tgt.setUserData(MAP_WHERE_EXPRESSION, expr);
}
return fpe.check(vars, null, expr);
case TRANSLATE:
return new TypeDetails(CollectionStatus.SINGLETON, "CodeableConcept");
case CC:
ProfiledType res = new ProfiledType("CodeableConcept");
if (tgt.getParameter().size() >= 2 && isParamId(vars, tgt.getParameter().get(1))) {
TypeDetails td = vars.get(null, getParamId(vars, tgt.getParameter().get(1))).getProperty().getTypes();
if (td != null && td.hasBinding())
// todo: do we need to check that there's no implicit translation her? I don't think we do...
res.addBinding(td.getBinding());
}
return new TypeDetails(CollectionStatus.SINGLETON, res);
case C:
return new TypeDetails(CollectionStatus.SINGLETON, "Coding");
case QTY:
return new TypeDetails(CollectionStatus.SINGLETON, "Quantity");
case REFERENCE:
VariableForProfiling vrs = vars.get(VariableMode.OUTPUT, getParamId(vars, tgt.getParameterFirstRep()));
if (vrs == null)
throw new FHIRException("Unable to resolve variable \"" + getParamId(vars, tgt.getParameterFirstRep()) + "\"");
String profile = vrs.getProperty().getProfileProperty().getStructure().getUrl();
TypeDetails td = new TypeDetails(CollectionStatus.SINGLETON);
td.addType("Reference", profile);
return td;
default:
throw new Error("Transform Unknown or not handled yet: " + tgt.getTransform().toCode());
}
}
use of org.hl7.fhir.dstu2016may.model.StructureMap in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeStructureMapStructureMapContactComponent.
protected void composeStructureMapStructureMapContactComponent(Complex parent, String parentType, String name, StructureMap.StructureMapContactComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "contact", name, element, index);
if (element.hasNameElement())
composeString(t, "StructureMap", "name", element.getNameElement(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "StructureMap", "telecom", element.getTelecom().get(i), i);
}
use of org.hl7.fhir.dstu2016may.model.StructureMap in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeStructureMapStructureMapGroupRuleComponent.
protected void composeStructureMapStructureMapGroupRuleComponent(Complex parent, String parentType, String name, StructureMap.StructureMapGroupRuleComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "rule", name, element, index);
if (element.hasNameElement())
composeId(t, "StructureMap", "name", element.getNameElement(), -1);
for (int i = 0; i < element.getSource().size(); i++) composeStructureMapStructureMapGroupRuleSourceComponent(t, "StructureMap", "source", element.getSource().get(i), i);
for (int i = 0; i < element.getTarget().size(); i++) composeStructureMapStructureMapGroupRuleTargetComponent(t, "StructureMap", "target", element.getTarget().get(i), i);
for (int i = 0; i < element.getRule().size(); i++) composeStructureMapStructureMapGroupRuleComponent(t, "StructureMap", "rule", element.getRule().get(i), i);
for (int i = 0; i < element.getDependent().size(); i++) composeStructureMapStructureMapGroupRuleDependentComponent(t, "StructureMap", "dependent", element.getDependent().get(i), i);
if (element.hasDocumentationElement())
composeString(t, "StructureMap", "documentation", element.getDocumentationElement(), -1);
}
use of org.hl7.fhir.dstu2016may.model.StructureMap in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeStructureMapStructureMapGroupRuleTargetComponent.
protected void composeStructureMapStructureMapGroupRuleTargetComponent(Complex parent, String parentType, String name, StructureMap.StructureMapGroupRuleTargetComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "target", name, element, index);
if (element.hasContextElement())
composeId(t, "StructureMap", "context", element.getContextElement(), -1);
if (element.hasContextTypeElement())
composeEnum(t, "StructureMap", "contextType", element.getContextTypeElement(), -1);
if (element.hasElementElement())
composeString(t, "StructureMap", "element", element.getElementElement(), -1);
if (element.hasVariableElement())
composeId(t, "StructureMap", "variable", element.getVariableElement(), -1);
for (int i = 0; i < element.getListMode().size(); i++) composeEnum(t, "StructureMap", "listMode", element.getListMode().get(i), i);
if (element.hasListRuleIdElement())
composeId(t, "StructureMap", "listRuleId", element.getListRuleIdElement(), -1);
if (element.hasTransformElement())
composeEnum(t, "StructureMap", "transform", element.getTransformElement(), -1);
for (int i = 0; i < element.getParameter().size(); i++) composeStructureMapStructureMapGroupRuleTargetParameterComponent(t, "StructureMap", "parameter", element.getParameter().get(i), i);
}
Aggregations