use of org.hl7.fhir.dstu2016may.model.CodeType in project kindling by HL7.
the class SourceParser method loadCommonSearchParameters.
private void loadCommonSearchParameters() throws FHIRFormatError, FileNotFoundException, IOException {
Bundle bnd = (Bundle) new XmlParser().parse(new CSFileInputStream(Utilities.path(srcDir, "searchparameter", "common-search-parameters.xml")));
for (BundleEntryComponent be : bnd.getEntry()) {
SearchParameter sp = (SearchParameter) be.getResource();
CommonSearchParameter csp = new CommonSearchParameter();
csp.setId(sp.getId());
csp.setCode(sp.getCode());
for (CodeType ct : sp.getBase()) {
csp.getResources().add(ct.asStringValue());
definitions.getCommonSearchParameters().put(ct.asStringValue() + "::" + sp.getCode(), csp);
}
}
}
use of org.hl7.fhir.dstu2016may.model.CodeType in project kindling by HL7.
the class SpreadSheetReloader method parseStatus.
private void parseStatus(DomainResource ed, String value) {
ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_FMM_LEVEL));
ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_STANDARDS_STATUS));
ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_NORMATIVE_VERSION));
if (!Utilities.noString(value) && value.contains("/")) {
String[] p = value.split("\\/");
if (Utilities.noString(p[0].trim())) {
ed.getExtension().removeIf(ext -> ext.getUrl().equals(BuildExtensions.EXT_FMM_LEVEL));
} else {
ed.addExtension(BuildExtensions.EXT_FMM_LEVEL, new IntegerType(p[0]));
}
if (p[1].contains(";")) {
ed.addExtension(BuildExtensions.EXT_STANDARDS_STATUS, new CodeType(p[1].substring(0, p[1].indexOf(";"))));
ed.addExtension(BuildExtensions.EXT_NORMATIVE_VERSION, new CodeType(p[1].substring(p[1].indexOf("from=") + 5)));
} else {
ed.addExtension(BuildExtensions.EXT_STANDARDS_STATUS, new CodeType(p[1]));
}
}
sortExtensions(ed);
}
use of org.hl7.fhir.dstu2016may.model.CodeType in project kindling by HL7.
the class SpreadSheetReloader method parseUml.
private void parseUml(ElementDefinition ed, String value, XSSFSheet bindings) {
ed.removeExtension(BuildExtensions.EXT_UML_BREAK);
ed.removeExtension(BuildExtensions.EXT_UML_DIR);
if (!Utilities.noString(value)) {
if (value.contains("|")) {
String[] p = value.split("\\|");
if (Utilities.noString(p[0].trim())) {
ed.addExtension(BuildExtensions.EXT_UML_BREAK, new CodeType(p[1].trim()));
} else {
ed.addExtension(BuildExtensions.EXT_UML_DIR, new CodeType(p[0].trim()));
ed.addExtension(BuildExtensions.EXT_UML_BREAK, new CodeType(p[1].trim()));
}
} else {
ed.addExtension(BuildExtensions.EXT_UML_DIR, new CodeType(value));
}
}
sortExtensions(ed);
}
use of org.hl7.fhir.dstu2016may.model.CodeType in project kindling by HL7.
the class SpreadSheetReloader method readSearchParameter.
private void readSearchParameter(XSSFRow row, XSSFRow cols, SearchParameter sp) {
sp.setType(SearchParamType.fromCode(getValue(row, cols, CN_TYPE)));
sp.setExpression(getValue(row, cols, CN_EXPRESSION));
sp.setDescription(getValue(row, cols, CN_DESCRIPTION));
sp.setXpath(getValue(row, cols, CN_X_PATH));
sp.getTarget().clear();
for (String s : splitValue(row, cols, CN_TARGET_TYPES, "\\|")) {
sp.getTarget().add(new CodeType(s));
}
readExt(sp, row, cols, CN_PATH, BuildExtensions.EXT_PATH, ExtensionType.String);
readExt(sp, row, cols, CN_COMMITTEE_NOTES, BuildExtensions.EXT_COMMITTEE_NOTES, ExtensionType.String);
}
use of org.hl7.fhir.dstu2016may.model.CodeType in project kindling by HL7.
the class Regenerator method generateCP.
private void generateCP(String root, ResourceDefn r, Profile p) throws IOException {
ImplementationGuide ig = new ImplementationGuide();
ig.setId(r.getName() + "-" + p.getCategory());
ig.setTitle(p.getTitle());
ig.setStatus(PublicationStatus.ACTIVE);
ig.setDate(new Date(r.getTimestamp()));
for (String s : p.getMetadata().keySet()) {
List<String> vl = p.getMetadata().get(s);
for (String v : vl) {
if (!Utilities.noString(v)) {
switch(s) {
// case "id": ig.setId(v); break;
case "name":
ig.setName(v);
break;
case "author.name":
ig.setPublisher(v);
break;
case "code":
ig.addExtension(BuildExtensions.EXT_CODE, new CodeType(v));
break;
case "fmm":
ig.addExtension(ToolingExtensions.EXT_FMM_LEVEL, new CodeType(v));
break;
case "description":
ig.setDescription(v);
break;
case "status":
ig.setStatus(PublicationStatus.fromCode(v));
break;
case "publication.status":
break;
case "version":
ig.setVersion(v);
break;
case "display":
ig.setTitle(v);
break;
case "workgroup":
ig.addExtension(ToolingExtensions.EXT_WORKGROUP, new CodeType(v));
break;
case "date":
ig.getDateElement().setValueAsString(v);
break;
case "Experimental":
ig.setExperimental(Utilities.existsInList(v.toLowerCase(), "y", "yes", "1", "true"));
break;
default:
if (s.startsWith("fmm-") || Utilities.existsInList(s, "extension.uri", "author.reference", "published.structure", "notes", "introduction") || s.startsWith("!")) {
// ignore these
} else if (s.startsWith("summary-")) {
String n = s.substring(8);
for (ConstraintStructure cs : p.getProfiles()) {
if (n.equals(cs.getTitle()) || n.equals(cs.getId())) {
cs.setSummary(v);
}
}
} else {
System.out.println("Unknown metadata item: " + s + "=" + v);
}
}
}
}
}
if (!Utilities.noString(p.getIntroduction())) {
ig.addExtension(BuildExtensions.EXT_INTRODUCTION, new StringType(p.getIntroduction()));
}
if (!Utilities.noString(p.getNotes())) {
ig.addExtension(BuildExtensions.EXT_NOTES, new StringType(p.getNotes()));
}
for (ConstraintStructure cs : p.getProfiles()) {
CanonicalResource cr = generateProfile(root, r, p, cs);
ImplementationGuideDefinitionResourceComponent res = ig.getDefinition().addResource();
res.getReference().setReference(cr.fhirType() + "/" + cr.getId());
}
for (StructureDefinition cs : p.getExtensions()) {
CanonicalResource cr = generateExtension(root, r, p, cs.copy());
ImplementationGuideDefinitionResourceComponent res = ig.getDefinition().addResource();
res.getReference().setReference(cr.fhirType() + "/" + cr.getId());
}
for (SearchParameter cs : p.getSearchParameters()) {
CanonicalResource cr = generateSearchParameter(root, r, p, cs);
ImplementationGuideDefinitionResourceComponent res = ig.getDefinition().addResource();
res.getReference().setReference(cr.fhirType() + "/" + cr.getId());
}
for (Example cs : p.getExamples()) {
ImplementationGuideDefinitionResourceComponent res = ig.getDefinition().addResource();
generateExample(root, r, p, cs, res);
}
File fn = new File(Utilities.path(root, ig.fhirType().toLowerCase() + "-" + ig.getId() + ".gen.xml"));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), ig);
fn.setLastModified(r.getTimestamp());
}
Aggregations