use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class CDAGenerator method buildInfrastructureRoot.
private void buildInfrastructureRoot() throws DefinitionException {
StructureDefinition sd = new StructureDefinition();
sd.setId("InfrastructureRoot");
sd.setUrl("http://hl7.org/fhir/cda/StructureDefinition/InfrastructureRoot");
library.put(sd.getUrl(), sd);
sd.setName("Base Type for all classes in the CDA structure");
sd.setTitle("InfrastructureRoot");
sd.setStatus(PublicationStatus.ACTIVE);
sd.setExperimental(false);
sd.setPublisher("HL7");
sd.setDescription("Defines the base elements and attributes on all CDA elements (other than data types)");
sd.setKind(StructureDefinitionKind.LOGICAL);
sd.setType(sd.getUrl());
sd.setAbstract(true);
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:v3"));
sd.setBaseDefinition("http://hl7.org/fhir/cda/StructureDefinition/ANY");
sd.setDerivation(TypeDerivationRule.SPECIALIZATION);
ElementDefinition edb = new ElementDefinition();
edb.setPath(sd.getId());
seePath(edb);
edb.setMin(1);
edb.setMax("*");
edb.addType().setCode("Element");
sd.getDifferential().getElement().add(edb);
ElementDefinition ed = new ElementDefinition();
ed.setPath("InfrastructureRoot.realmCode");
seePath(ed);
ed.setMin(0);
ed.setMax("*");
ed.setDefinition("When valued in an instance, this attribute signals the imposition of realm-specific constraints. The value of this attribute identifies the realm in question");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CS");
sd.getDifferential().getElement().add(ed);
ed = new ElementDefinition();
ed.setPath("InfrastructureRoot.typeId");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.setDefinition("When valued in an instance, this attribute signals the imposition of constraints defined in an HL7-specified message type. This might be a common type (also known as CMET in the messaging communication environment), or content included within a wrapper. The value of this attribute provides a unique identifier for the type in question.");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
sd.getDifferential().getElement().add(ed);
ed = new ElementDefinition();
ed.setPath("InfrastructureRoot.templateId");
seePath(ed);
ed.setMin(0);
ed.setMax("*");
ed.setDefinition("When valued in an instance, this attribute signals the imposition of a set of template-defined constraints. The value of this attribute provides a unique identifier for the templates in question");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
sd.getDifferential().getElement().add(ed);
new ProfileUtilities(null, null, null).setIds(sd, true);
structures.add(sd);
}
use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class CDAGenerator method addValueAttribute.
private void addValueAttribute(List<ElementDefinition> list, String dtn, String t) {
ElementDefinition ed = new ElementDefinition();
ed.setPath(dtn + ".value");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.addType().setCode(t);
if (dtn.equals("ST"))
ed.addRepresentation(PropertyRepresentation.XMLTEXT);
else
ed.addRepresentation(PropertyRepresentation.XMLATTR);
if (dtn.equals("TS"))
ed.addExtension().setUrl("http://www.healthintersections.com.au/fhir/StructureDefinition/elementdefinition-dateformat").setValue(new StringType("v3"));
list.add(ed);
}
use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class CDAGenerator method addCDExtensions.
private void addCDExtensions(List<ElementDefinition> list, String n) {
ElementDefinition ed = new ElementDefinition();
ed.setPath(n + ".valueSet");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.addType().setCode("string");
ed.addRepresentation(PropertyRepresentation.XMLATTR);
ed.setDefinition("The valueSet extension adds an attribute for elements with a CD dataType which indicates the particular value set constraining the coded concept");
ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:sdtc"));
ed = new ElementDefinition();
ed.setPath(n + ".valueSetVersion");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.addType().setCode("string");
ed.addRepresentation(PropertyRepresentation.XMLATTR);
ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:sdtc"));
ed.setDefinition("The valueSetVersion extension adds an attribute for elements with a CD dataType which indicates the version of the particular value set constraining the coded concept.");
list.add(ed);
}
use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class BuildWorkerContext method queryForTerm.
private SnomedServerResponse queryForTerm(String code) throws Exception {
if (!triedServer || serverOk) {
triedServer = true;
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://tx.fhir.org/snomed/tool/" + SNOMED_EDITION + "/" + URLEncoder.encode(code, "UTF-8").replace("+", "%20"));
// HttpGet httpget = new HttpGet("http://local.fhir.org:960/r4/snomed/tool/"+SNOMED_EDITION+"/"+URLEncoder.encode(code, "UTF-8").replace("+", "%20")); // don't like the url encoded this way
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
InputStream instream = entity.getContent();
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document xdoc = builder.parse(instream);
// we always get back a version, and a type. What we do depends on the type
String t = xdoc.getDocumentElement().getAttribute("type");
serverOk = true;
if (t.equals("error"))
throw new Exception(xdoc.getDocumentElement().getAttribute("message"));
if (t.equals("description"))
throw new Exception("The Snomed code (\"" + code + "\") is a description id not a concept id which is not valid");
if (t.equals("concept")) {
Concept c = new Concept();
c.display = xdoc.getDocumentElement().getAttribute("display");
Element child = XMLUtil.getFirstChild(xdoc.getDocumentElement());
while (child != null) {
c.displays.add(child.getAttribute("value"));
child = XMLUtil.getNextSibling(child);
}
snomedCodes.put(code, c);
return null;
}
if (t.equals("expression")) {
SnomedServerResponse resp = new SnomedServerResponse();
resp.correctExpression = xdoc.getDocumentElement().getAttribute("expressionMinimal");
resp.display = xdoc.getDocumentElement().getAttribute("display");
if (!snomedCodes.containsKey(resp.correctExpression)) {
Concept c = new Concept();
c.display = resp.display;
snomedCodes.put(resp.correctExpression, c);
}
return resp;
}
throw new Exception("Unrecognised response from server");
} finally {
instream.close();
}
} else
return null;
}
use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.
the class PageProcessor method genExtensionTypeList.
private String genExtensionTypeList() {
StringBuilder b = new StringBuilder();
for (WildcardInformation wi : TypesUtilities.wildcards(version.toCode())) {
b.append("<li>value");
b.append(Utilities.capitalize(wi.getTypeName()));
b.append(": <a href=\"");
b.append(definitions.getSrcFile(wi.getTypeName()) + ".html#" + wi.getTypeName());
b.append("\">");
b.append(wi.getTypeName());
b.append("</a>");
if (!Utilities.noString(wi.getComment())) {
b.append(" " + wi.getComment());
}
b.append("</li>");
}
return b.toString();
}
Aggregations