use of org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent in project kindling by HL7.
the class CodeListToValueSetParser method getGroup.
private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
for (ConceptMapGroupComponent grp : map.getGroup()) {
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
return grp;
}
ConceptMapGroupComponent grp = map.addGroup();
grp.setSource(srcs);
grp.setTarget(tgts);
return grp;
}
use of org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent in project kindling by HL7.
the class Publisher method buildConceptMap.
private ConceptMap buildConceptMap(String path, ValueSet vs, ResourceDefn rd) throws EOperationOutcome, FHIRException, IOException {
ConceptMap cm = new ConceptMap();
cm.setUserData("path", "sc-" + vs.getUserString("path"));
cm.setUserData("resource-definition", rd);
cm.setId("sc-" + vs.getId());
cm.setUrl("http://hl7.org/fhir/ConceptMap/" + cm.getId());
cm.setVersion(page.getVersion().toCode());
cm.setName(vs.getName() + "CanonicalMap");
cm.setTitle("Canonical Mapping for \"" + vs.present() + "\"");
cm.setStatus(PublicationStatus.DRAFT);
cm.setDate(vs.getDate());
cm.setPublisher(vs.getPublisher());
cm.addContact(vs.getContactFirstRep());
cm.setDescription("Canonical Mapping for \"" + vs.getDescription() + "\"");
cm.setSource(new CanonicalType(vs.getUrl()));
cm.setTarget(new CanonicalType("http://hl7.org/fhir/ValueSet/resource-status"));
List<String> canonical = page.getDefinitions().getStatusCodes().get("@code");
List<String> self = page.getDefinitions().getStatusCodes().get(path);
ConceptMapGroupComponent grp = cm.addGroup();
grp.setTarget("http://hl7.org/fhir/resource-status");
grp.setSource(vs.getCompose().getIncludeFirstRep().getSystem());
for (int i = 0; i < self.size(); i++) {
if (!Utilities.noString(self.get(i))) {
String cc = canonical.get(i);
String sc = self.get(i);
SourceElementComponent e = grp.addElement();
e.setCode(sc);
TargetElementComponent t = e.addTarget();
t.setCode(cc);
t.setRelationship(ConceptMapRelationship.EQUIVALENT);
}
}
if (!grp.hasElement())
return null;
page.getConceptMaps().see(cm, page.packageInfo());
statusCodeConceptMaps.add(cm);
return cm;
}
use of org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent in project org.hl7.fhir.core by hapifhir.
the class ConceptMap10_30 method getGroup.
public static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
for (ConceptMapGroupComponent grp : map.getGroup()) {
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
return grp;
}
ConceptMapGroupComponent grp = map.addGroup();
grp.setSource(srcs);
grp.setTarget(tgts);
return grp;
}
use of org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent in project org.hl7.fhir.core by hapifhir.
the class SearchParameterProcessor method generate.
private void generate(String src, String dst, String srcURL, String tgtURL) throws IOException {
ConceptMap map = new ConceptMap();
map.setId("search-parameters-" + src + "-to-" + dst);
map.setUrl("http://hl7.org/fhir/interversion/ConceptMap/" + map.getId());
map.setName("SearchParameterMap" + src + dst);
map.setTitle("Search Parameter Map - " + src + " to " + dst);
map.setStatus(PublicationStatus.DRAFT);
map.setDate(new Date());
map.setExperimental(false);
map.setPublisher("HL7");
ConceptMapGroupComponent group = map.addGroup();
group.setSource("http://hl7.org/fhir/" + srcURL);
group.setTarget("http://hl7.org/fhir/" + tgtURL);
for (SPRelationship sp : list) {
String s = sp.getByCode(src);
String d = sp.getByCode(dst);
if (!Utilities.noString(s) && !Utilities.noString(d)) {
SourceElementComponent e = makeElement(s, group);
e.addTarget().setCode(d).setRelationship(ConceptMapRelationship.RELATEDTO);
}
}
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(ROOT, "ConceptMap-" + map.getId() + ".json")), map);
}
use of org.hl7.fhir.r4b.model.ConceptMap.ConceptMapGroupComponent in project org.hl7.fhir.core by hapifhir.
the class ConceptMapSpreadsheetGenerator method renderGroup.
private void renderGroup(ConceptMapGroupComponent grp, int i) {
Sheet sheet = makeSheet("Mapping Table " + Integer.toString(i));
addHeaders(sheet, "Source", "Display", "Relationship", "Target", "Display");
addRow(sheet, grp.getSource(), "", "", grp.getTarget(), "");
for (SourceElementComponent s : grp.getElement()) {
for (TargetElementComponent t : s.getTarget()) {
addRow(sheet, s.getCode(), s.getDisplay(), t.getRelationshipElement().asStringValue(), t.getCode(), t.getDisplay());
}
}
}
Aggregations