use of org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent in project org.hl7.fhir.core by hapifhir.
the class CodeSystemUtilities method setStatus.
public static void setStatus(CodeSystem cs, ConceptDefinitionComponent concept, ConceptStatus status) throws FHIRFormatError {
defineStatusProperty(cs);
ConceptPropertyComponent p = getProperty(concept, "status");
if (p != null)
p.setValue(new CodeType(status.toCode()));
else
concept.addProperty().setCode("status").setValue(new CodeType(status.toCode()));
}
use of org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent in project org.hl7.fhir.core by hapifhir.
the class CodeSystemUtilities method crossLinkConcepts.
private static void crossLinkConcepts(List<ConceptDefinitionComponent> root, List<ConceptDefinitionComponent> focus, String parent) {
for (ConceptDefinitionComponent def : focus) {
List<ConceptPropertyComponent> pcl = getPropertyValues(def, parent);
for (ConceptPropertyComponent pc : pcl) {
String code = pc.getValue().primitiveValue();
ConceptDefinitionComponent tgt = findCode(root, code);
if (!tgt.hasUserData(USER_DATA_CROSS_LINK)) {
tgt.setUserData(USER_DATA_CROSS_LINK, new ArrayList<>());
}
@SuppressWarnings("unchecked") List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) tgt.getUserData(USER_DATA_CROSS_LINK);
children.add(def);
}
if (def.hasConcept()) {
crossLinkConcepts(root, def.getConcept(), parent);
}
}
}
use of org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent in project org.hl7.fhir.core by hapifhir.
the class CodeSystemComparer method mergeProps.
private void mergeProps(ConceptDefinitionComponent cd, ConceptDefinitionComponent l, ConceptDefinitionComponent r, List<PropertyComponent> destProps, CodeSystemComparison res) {
List<ConceptPropertyComponent> matchR = new ArrayList<>();
for (ConceptPropertyComponent lp : l.getProperty()) {
ConceptPropertyComponent rp = findRightProp(r.getProperty(), lp, res);
if (rp == null) {
cd.getProperty().add(lp);
} else {
matchR.add(rp);
cd.getProperty().add(lp);
if (lp.getValue().equalsDeep(rp.getValue())) {
cd.getProperty().add(rp.setCode(res.getPropMap().get(rp.getCode())));
}
}
}
for (ConceptPropertyComponent rp : r.getProperty()) {
if (!matchR.contains(rp)) {
cd.getProperty().add(rp.setCode(res.getPropMap().get(rp.getCode())));
}
}
}
use of org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent in project org.hl7.fhir.core by hapifhir.
the class CodeSystemUtilities method setNotSelectable.
public static void setNotSelectable(CodeSystem cs, ConceptDefinitionComponent concept) throws FHIRFormatError {
defineNotSelectableProperty(cs);
ConceptPropertyComponent p = getProperty(concept, "notSelectable");
if (p != null)
p.setValue(new BooleanType(true));
else
concept.addProperty().setCode("notSelectable").setValue(new BooleanType(true));
}
use of org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent in project org.hl7.fhir.core by hapifhir.
the class CodeSystemUtilities method crossLinkConcepts.
private static void crossLinkConcepts(List<ConceptDefinitionComponent> root, List<ConceptDefinitionComponent> focus, String parent) {
for (ConceptDefinitionComponent def : focus) {
List<ConceptPropertyComponent> pcl = getPropertyValues(def, parent);
for (ConceptPropertyComponent pc : pcl) {
String code = pc.getValue().primitiveValue();
ConceptDefinitionComponent tgt = findCode(root, code);
if (!tgt.hasUserData(USER_DATA_CROSS_LINK)) {
tgt.setUserData(USER_DATA_CROSS_LINK, new ArrayList<>());
}
@SuppressWarnings("unchecked") List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) tgt.getUserData(USER_DATA_CROSS_LINK);
children.add(def);
}
if (def.hasConcept()) {
crossLinkConcepts(root, def.getConcept(), parent);
}
}
}
Aggregations