use of org.hl7.fhir.utilities.graphql.Value 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.utilities.graphql.Value 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.utilities.graphql.Value in project kindling by HL7.
the class SpreadSheetReloader method parseType.
private void parseType(ElementDefinition ed, String value, String hierarchy) throws Exception {
ed.getType().clear();
ed.setContentReferenceElement(null);
if (ed.getPath().equals("Resource.id")) {
ed.addType().setCode("http://hl7.org/fhirpath/System.String").addExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", new UriType("id"));
} else {
if (Utilities.noString(value)) {
if (ed.getPath().contains(".")) {
ed.addType().setCode("BackboneElement");
}
} else if (value.startsWith("#")) {
ed.setContentReference(value);
} else {
List<TypeRef> tl = new TypeParser(version).parse(value, false, null, context, false);
for (TypeRef tr : tl) {
TypeRefComponent t = ed.addType().setCode(tr.getName());
if ("SimpleQuantity".equals(t.getCode())) {
t.setCode("Quantity");
t.addProfile("http://hl7.org/fhir/StructureDefinition/SimpleQuantity");
}
for (String p : tr.getParams()) {
if (p.equals("Definition")) {
t.addExtension(BuildExtensions.EXT_PATTERN, new CanonicalType("http://hl7.org/fhir/StructureDefinition/Definition"));
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/ActivityDefinition");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/EventDefinition");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/EvidenceVariable");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Measure");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/OperationDefinition");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/PlanDefinition");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Questionnaire");
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/SubscriptionTopic");
} else {
t.addTargetProfile("http://hl7.org/fhir/StructureDefinition/" + p);
}
}
if (Utilities.existsInList(tr.getName(), "canonical", "Reference") && !Utilities.noString(hierarchy)) {
t.addExtension(BuildExtensions.EXT_HIERARCHY, new BooleanType(Utilities.existsInList(hierarchy, "true", "True", "TRUE", "1", "y", "Y")));
}
}
}
}
}
use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class SpreadSheetReloader method parseBinding.
private void parseBinding(ElementDefinition ed, String value, XSSFSheet bindings) {
if (Utilities.noString(value)) {
ed.setBinding(null);
} else {
XSSFRow cols = bindings.getRow(0);
XSSFRow row = lookupRow(bindings, cols, CN_BINDING_NAME, value);
if (row == null) {
throw new FHIRException("Unable to find binding " + value + " in " + xlsx);
}
ElementDefinitionBindingComponent bs = ed.getBinding();
bs.removeExtension(BuildExtensions.EXT_NAME);
readExt(bs, row, cols, CN_BINDING_NAME, BuildExtensions.EXT_BINDING_NAME, ExtensionType.String);
readExt(bs, row, cols, CN_DEFINITION, BuildExtensions.EXT_DEFINITION, ExtensionType.String);
bs.setStrength(BindingStrength.fromCode(getValue(row, cols, CN_STRENGTH)));
bs.setValueSet(getValue(row, cols, CN_VALUE_SET));
readExt(bs, row, cols, CN_OID, BuildExtensions.EXT_VS_OID, ExtensionType.String);
readExt(bs, row, cols, CN_URI, BuildExtensions.EXT_URI, ExtensionType.String);
readExt(bs, row, cols, CN_WEBSITE_EMAIL, BuildExtensions.EXT_WEBSITE, ExtensionType.Uri);
readExt(bs, row, cols, CN_V2, BuildExtensions.EXT_V2_MAP, ExtensionType.String);
readExt(bs, row, cols, CN_V3, BuildExtensions.EXT_V3_MAP, ExtensionType.String);
readExt(bs, row, cols, CN_COPYRIGHT, BuildExtensions.EXT_COPYRIGHT, ExtensionType.String);
readExt(bs, row, cols, CN_COMMITTEE_NOTES, BuildExtensions.EXT_COMMITTEE_NOTES, ExtensionType.Markdown);
}
}
use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class ExtensionDefinitionValidator method checkNoValueAndExtensions.
private void checkNoValueAndExtensions(StructureDefinition sd) throws FHIRException {
boolean hasValue = false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().startsWith("Extension.value")) {
if (!ed.getMax().equals("0")) {
hasValue = true;
}
}
}
if (hasValue) {
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().equals("Extension.extension")) {
ed.setMax("0");
}
if (ed.getPath().startsWith("Extension.extension.")) {
throw new FHIRException("The extension " + sd.getUrl() + " has both value and extensions");
}
}
boolean found = false;
int ip = 0;
for (ElementDefinition ed : sd.getDifferential().getElement()) {
if (ed.getPath().equals("Extension.extension")) {
ed.setMax("0");
found = true;
}
if (ed.getPath().equals("Extension") || ed.getPath().equals("Extension.id"))
ip++;
}
if (!found) {
ElementDefinition ed = new ElementDefinition();
ed.setPath("Extension.extension");
ed.setMax("0");
sd.getDifferential().getElement().add(ip, ed);
}
}
}
Aggregations