use of org.hl7.fhir.r4b.model.Identifier in project beneficiary-fhir-data by CMSgov.
the class R4PatientResourceProviderIT method searchForExistingPatientByMbiHashIncludeIdentifiersTrue.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider#searchByIdentifier(ca.uhn.fhir.rest.param.TokenParam)}
* works as expected for a {@link Patient} that does exist in the DB, including identifiers to
* return the unhashed HICN and MBI.
*/
@Test
public void searchForExistingPatientByMbiHashIncludeIdentifiersTrue() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClient("true", "true");
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Bundle searchResults = fhirClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndIdentifier(TransformerConstants.CODING_BBAPI_BENE_MBI_HASH, beneficiary.getMbiHash().get())).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
Patient patientFromSearchResult = (Patient) searchResults.getEntry().get(0).getResource();
/*
* Ensure the unhashed values for MBI is present.
*/
Boolean mbiUnhashedPresent = false;
Iterator<Identifier> identifiers = patientFromSearchResult.getIdentifier().iterator();
while (identifiers.hasNext()) {
Identifier identifier = identifiers.next();
if (identifier.getSystem().equals(TransformerConstants.CODING_BBAPI_MEDICARE_BENEFICIARY_ID_UNHASHED)) {
mbiUnhashedPresent = true;
}
}
assertTrue(mbiUnhashedPresent);
}
use of org.hl7.fhir.r4b.model.Identifier in project kindling by HL7.
the class Publisher method resolve.
@Override
public javax.xml.transform.Source resolve(String href, String base) throws TransformerException {
if (!href.startsWith("http://fhir.healthintersections.com.au/open/ValueSet/$expand"))
return null;
try {
Map<String, String> params = splitQuery(new URL(href));
ValueSet vs = page.getValueSets().get(params.get("identifier"));
if (vs == null) {
page.log("unable to resolve " + params.get("identifier"), LogMessageType.Process);
return null;
}
vs = page.expandValueSet(vs, true);
if (vs == null) {
page.log("unable to expand " + params.get("identifier"), LogMessageType.Process);
return null;
}
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
new XmlParser().compose(bytes, vs, false);
bytes.close();
return new StreamSource(new ByteArrayInputStream(bytes.toByteArray()));
} catch (Exception e) {
throw new TransformerException(e);
}
}
use of org.hl7.fhir.r4b.model.Identifier in project kindling by HL7.
the class PageProcessor method generateConstraintsTable.
private void generateConstraintsTable(String path, ElementDefn e, Map<String, String> invs, boolean base, String prefix) throws Exception {
for (Invariant inv : e.getInvariants().values()) {
String s = "";
if (base)
s = "<tr><td><b title=\"Formal Invariant Identifier\">" + inv.getId() + "</b></td><td>" + presentLevel(inv) + "</td><td>(base)</td><td>" + Utilities.escapeXml(inv.getEnglish()) + "</td><td><span style=\"font-family: Courier New, monospace\">" + Utilities.escapeXml(inv.getExpression()) + "</span>";
else
s = "<tr><td><b title=\"Formal Invariant Identifier\">" + inv.getId() + "</b></td><td>" + presentLevel(inv) + "</td><td>" + path + "</td><td>" + Utilities.escapeXml(inv.getEnglish()) + "</td><td><span style=\"font-family: Courier New, monospace\">" + Utilities.escapeXml(inv.getExpression()) + "</span>";
if (!Utilities.noString(inv.getExplanation()))
s = s + "<br/>This is (only) a best practice guideline because: <blockquote>" + processMarkdown("best practice guideline", inv.getExplanation(), prefix) + "</blockquote>";
s = s + "</td></tr>";
invs.put(inv.getId(), s);
}
for (ElementDefn c : e.getElements()) {
generateConstraintsTable(path + "." + c.getName(), c, invs, false, prefix);
}
}
use of org.hl7.fhir.r4b.model.Identifier in project kindling by HL7.
the class PageProcessor method generateConstraints.
private void generateConstraints(String path, ElementDefn e, Map<String, String> invs, boolean base, String prefix) throws Exception {
for (Invariant inv : e.getInvariants().values()) {
String s = "";
if (base)
s = "<li>" + presentLevel(inv) + " <b title=\"Formal Invariant Identifier\">" + inv.getId() + "</b>: " + Utilities.escapeXml(inv.getEnglish()) + " (<a href=\"http://hl7.org/fhirpath\">expression</a>: <span style=\"font-family: Courier New, monospace\">" + Utilities.escapeXml(inv.getExpression()) + "</span>)";
else
s = "<li>" + presentLevel(inv) + " <b title=\"Formal Invariant Identifier\">" + inv.getId() + "</b>: On " + path + ": " + Utilities.escapeXml(inv.getEnglish()) + " (<a href=\"http://hl7.org/fhirpath\">expression</a> on " + presentPath(path) + ": <span style=\"font-family: Courier New, monospace\">" + Utilities.escapeXml(inv.getExpression()) + "</span>)";
if (!Utilities.noString(inv.getExplanation()))
s = s + ". This is (only) a best practice guideline because: <blockquote>" + processMarkdown("best practice guideline", inv.getExplanation(), prefix) + "</blockquote>";
invs.put(inv.getId(), s + "</li>");
}
for (ElementDefn c : e.getElements()) {
generateConstraints(path + "." + c.getName(), c, invs, false, prefix);
}
}
use of org.hl7.fhir.r4b.model.Identifier 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);
}
Aggregations