use of org.hl7.fhir.r5.model.ContactDetail in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method getValidContact.
private ContactDetail getValidContact() {
HumanName ctName = new HumanName();
ctName.setUse(NameUse.OFFICIAL);
ctName.setFamily("FamilyName");
List<CodeableConcept> ctRelList = new ArrayList<>();
ctRelList.add(createCoding("family", "Family", SystemURL.VS_PATIENT_CONTACT_REL));
ContactDetail contact = new ContactDetail();
contact.setName(ctName.toString());
contact.addTelecom(staticElHelper.getValidTelecom());
return contact;
}
use of org.hl7.fhir.r5.model.ContactDetail in project gpconnect-demonstrator by nhsconnect.
the class OrganizationResourceProvider method getValidContact.
private ContactDetail getValidContact() {
HumanName orgCtName = new HumanName();
orgCtName.setUse(NameUse.USUAL);
orgCtName.setFamily("FamilyName");
Coding coding = new Coding().setSystem(SystemURL.VS_CC_ORG_CT_ENTITYTYPE).setDisplay("ADMIN");
CodeableConcept orgCtPurpose = new CodeableConcept().addCoding(coding);
ContactDetail orgContact = new ContactDetail();
orgContact.setNameElement(orgCtName.getFamilyElement());
orgContact.addTelecom(getValidTelecom());
return orgContact;
}
use of org.hl7.fhir.r5.model.ContactDetail in project kindling by HL7.
the class Publisher method generateCodeSystemRegistry.
private void generateCodeSystemRegistry() throws FileNotFoundException, IOException, Exception {
XmlParser xml = new XmlParser();
xml.setOutputStyle(OutputStyle.PRETTY);
Bundle bnd = (Bundle) xml.parse(new CSFileInputStream(Utilities.path(page.getFolders().srcDir, "namingsystem", "namingsystem-terminologies.xml")));
for (BundleEntryComponent entry : bnd.getEntry()) {
NamingSystem ns = (NamingSystem) entry.getResource();
entry.setFullUrl("http://hl7.org/fhir/NamingSystem/" + ns.getId());
String url = null;
for (NamingSystemUniqueIdComponent t : ns.getUniqueId()) {
if (t.getType() == NamingSystemIdentifierType.URI)
url = t.getValue();
}
if (url != null) {
if (url.startsWith("http://hl7.org/fhir"))
page.getDefinitions().addNs(url, "System " + ns.getName(), "terminologies-systems.html#" + url);
page.getDefinitions().addNs(entry.getFullUrl(), ns.getId(), "terminologies-systems.html#" + url);
}
}
List<String> names = new ArrayList<String>();
Set<String> urls = new HashSet<>();
names.addAll(page.getCodeSystems().keys());
Collections.sort(names);
for (String n : names) {
CodeSystem cs = page.getCodeSystems().get(n);
if (cs != null && !urls.contains(cs.getUrl()) && cs.hasUrl() && !cs.getUrl().startsWith("http://terminology.hl7.org")) {
urls.add(cs.getUrl());
if (cs.hasName()) {
NamingSystem ns = new NamingSystem();
ns.setId(cs.getId());
ns.setName(cs.getName());
ns.setStatus(cs.getStatus());
if (!ns.hasStatus())
ns.setStatus(PublicationStatus.DRAFT);
ns.setKind(NamingSystemType.CODESYSTEM);
ns.setPublisher(cs.getPublisher());
for (ContactDetail c : cs.getContact()) {
ContactDetail nc = ns.addContact();
nc.setName(c.getName());
for (ContactPoint cc : c.getTelecom()) {
nc.getTelecom().add(cc);
}
}
ns.setDate(cs.getDate());
if (!ns.hasDate())
ns.setDate(page.getGenDate().getTime());
ns.setDescription(cs.getDescription());
ns.addUniqueId().setType(NamingSystemIdentifierType.URI).setValue(cs.getUrl()).setPreferred(true);
String oid = CodeSystemUtilities.getOID(cs);
if (oid != null) {
if (oid.startsWith("urn:oid:"))
oid = oid.substring(8);
ns.addUniqueId().setType(NamingSystemIdentifierType.OID).setValue(oid).setPreferred(false);
}
ns.setUserData("path", cs.getUserData("path"));
bnd.addEntry().setResource(ns).setFullUrl("http://hl7.org/fhir/" + ns.fhirType() + "/" + ns.getId());
}
}
}
xml.compose(new FileOutputStream(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.xml")), bnd);
cloneToXhtml("namingsystem-terminologies", "Terminology Registry", false, "resource-instance:NamingSystem", "Terminology Registry", null, wg("vocab"));
xml.setOutputStyle(OutputStyle.CANONICAL);
xml.compose(new FileOutputStream(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.canonical.xml")), bnd);
JsonParser json = new JsonParser();
json.setOutputStyle(OutputStyle.PRETTY);
json.compose(new FileOutputStream(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.json")), bnd);
jsonToXhtml("namingsystem-terminologies", "Terminology Registry", TextFile.fileToString(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.json")), "resource-instance:NamingSystem", "Terminology Registry", null, wg("vocab"));
json.setOutputStyle(OutputStyle.CANONICAL);
json.compose(new FileOutputStream(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.canonical.json")), bnd);
RdfParser rdf = new RdfParser();
rdf.setOutputStyle(OutputStyle.PRETTY);
rdf.compose(new FileOutputStream(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.ttl")), bnd);
ttlToXhtml("namingsystem-terminologies", "Terminology Registry", TextFile.fileToString(Utilities.path(page.getFolders().dstDir, "namingsystem-terminologies.ttl")), "resource-instance:NamingSystem", "Terminology Registry", null, wg("vocab"));
StringBuilder b = new StringBuilder();
b.append("<table class=\"grid\">\r\n");
b.append(" <tr>");
b.append("<td><b>Name</b></td>");
b.append("<td><b>Uri</b></td>");
b.append("<td><b>OID</b></td>");
b.append("</tr>\r\n");
for (BundleEntryComponent entry : bnd.getEntry()) {
NamingSystem ns = (NamingSystem) entry.getResource();
String uri = "";
String oid = "";
for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
if (id.getType() == NamingSystemIdentifierType.URI)
uri = id.getValue();
if (id.getType() == NamingSystemIdentifierType.OID)
oid = id.getValue();
}
String link = "terminologies-systems.html#" + uri;
if (ns.getUserData("path") != null)
link = ns.getUserString("path");
b.append(" <tr>");
b.append("<td><a href=\"" + link + "\">" + Utilities.escapeXml(ns.getName()) + "</a></td>");
b.append("<td>" + Utilities.escapeXml(uri) + "</td>");
b.append("<td>" + Utilities.escapeXml(oid) + "</td>");
b.append("</tr>\r\n");
}
b.append("</table>\r\n");
String html = TextFile.fileToString(page.getFolders().templateDir + "template-example.html").replace("<%example%>", b.toString()).replace("<%example-usage%>", "");
html = page.processPageIncludes("namingsystem-terminologies.html", html, "resource-instance:NamingSystem", null, bnd, null, "Example", null, null, page.getDefinitions().getWorkgroups().get("fhir"));
TextFile.stringToFile(html, page.getFolders().dstDir + "namingsystem-terminologies.html");
cachePage("namingsystem-terminologies.html", html, "Registered Code Systems", false);
}
use of org.hl7.fhir.r5.model.ContactDetail in project kindling by HL7.
the class PageProcessor method cdHeader.
private String cdHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("Contact Detail", "contactdetail.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Examples", "contactdetail-examples.html", mode == null || "examples".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "contactdetail-definitions.html", mode == null || "definitions".equals(mode)));
b.append(makeHeaderTab("Mappings", "contactdetail-mappings.html", mode == null || "mappings".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
use of org.hl7.fhir.r5.model.ContactDetail in project kindling by HL7.
the class ValueSetGenerator method loadOperationOutcomeValueSet.
public void loadOperationOutcomeValueSet(BindingSpecification cd) throws Exception {
ValueSet vs = new ValueSet();
cd.setValueSet(vs);
cd.setBindingMethod(BindingMethod.ValueSet);
vs.setId("operation-outcome");
vs.setUrl("http://hl7.org/fhir/ValueSet/" + vs.getId());
vs.setName("OperationOutcomeCodes");
vs.setTitle("Operation Outcome Codes");
vs.setPublisher("HL7 (FHIR Project)");
vs.setVersion(version);
vs.setUserData("filename", "valueset-" + vs.getId());
if (!vs.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
vs.addExtension().setUrl(ToolingExtensions.EXT_WORKGROUP).setValue(new CodeType("fhir"));
} else {
String ec = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_WORKGROUP);
if (!ec.equals("fhir"))
System.out.println("ValueSet " + vs.getUrl() + " WG mismatch 11: is " + ec + ", want to set to " + "fhir");
}
vs.setUserData("path", "valueset-" + vs.getId() + ".html");
ContactDetail c = vs.addContact();
c.addTelecom().setSystem(ContactPointSystem.URL).setValue("http://hl7.org/fhir");
c.addTelecom().setSystem(ContactPointSystem.EMAIL).setValue("fhir@lists.hl7.org");
vs.setDescription("Operation Outcome codes used by FHIR test servers (see Implementation file translations.xml)");
vs.setStatus(PublicationStatus.DRAFT);
if (!vs.hasCompose())
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().addInclude().setSystem("http://terminology.hl7.org/CodeSystem/operation-outcome");
CodeSystem cs = new CodeSystem();
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.ISA);
Set<String> codes = translator.listTranslations("ecode");
for (String s : sorted(codes)) {
Map<String, String> langs = translator.translations(s);
ConceptDefinitionComponent cv = cs.addConcept();
cv.setCode(s);
cv.setDisplay(langs.get("en"));
for (String lang : langs.keySet()) {
if (!lang.equals("en")) {
String value = langs.get(lang);
ConceptDefinitionDesignationComponent dc = cv.addDesignation();
dc.setLanguage(lang);
dc.setValue(value);
dc.getUse().setSystem("http://terminology.hl7.org/CodeSystem/designation-usage").setCode("display");
}
}
}
CodeSystemConvertor.populate(cs, vs);
cs.setUrl("http://terminology.hl7.org/CodeSystem/operation-outcome");
cs.setVersion(version);
cs.setCaseSensitive(true);
cs.setContent(CodeSystemContentMode.COMPLETE);
definitions.getCodeSystems().see(cs, packageInfo);
}
Aggregations