use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project ab2d by CMSgov.
the class AggregatorJobTest method createEob.
ExplanationOfBenefit createEob(int patientId) throws ParseException {
final SimpleDateFormat SDF = new SimpleDateFormat("MM/dd/yyyy");
ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
eob.getBillablePeriod().setStart(SDF.parse("02/13/1970"));
eob.getBillablePeriod().setEnd(new Date());
eob.getMeta().setLastUpdated(new Date());
eob.setPatient(new org.hl7.fhir.dstu3.model.Reference().setReference("Patient/" + patientId));
return eob;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project integration-adaptor-111 by nhsconnect.
the class CompositionMapper method mapComposition.
public Composition mapComposition(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter, List<CarePlan> carePlans, List<QuestionnaireResponse> questionnaireResponseList, ReferralRequest referralRequest, List<PractitionerRole> practitionerRoles) {
Composition composition = new Composition();
composition.setIdElement(resourceUtil.newRandomUuid());
Identifier docIdentifier = new Identifier();
docIdentifier.setUse(USUAL);
docIdentifier.setValue(clinicalDocument.getSetId().getRoot());
composition.setTitle(COMPOSITION_TITLE).setType(createCodeableConcept()).setStatus(FINAL).setEncounter(resourceUtil.createReference(encounter)).setSubject(encounter.getSubject()).setDateElement(DateUtil.parse(clinicalDocument.getEffectiveTime().getValue())).setIdentifier(docIdentifier);
if (clinicalDocument.getConfidentialityCode().isSetCode()) {
composition.setConfidentiality(Composition.DocumentConfidentiality.valueOf(clinicalDocument.getConfidentialityCode().getCode()));
}
if (isNotEmpty(clinicalDocument.getRelatedDocumentArray()) && clinicalDocument.getRelatedDocumentArray(0).getParentDocument().getIdArray(0).isSetRoot()) {
Identifier relatedDocIdentifier = new Identifier();
relatedDocIdentifier.setUse(USUAL);
relatedDocIdentifier.setValue(clinicalDocument.getRelatedDocumentArray(0).getParentDocument().getIdArray(0).getRoot());
composition.addRelatesTo().setCode(Composition.DocumentRelationshipType.REPLACES).setTarget(relatedDocIdentifier);
}
practitionerRoles.stream().forEach(it -> composition.addAuthor(it.getPractitioner()));
if (clinicalDocument.getComponent().isSetStructuredBody()) {
for (POCDMT000002UK01Component3 component3 : clinicalDocument.getComponent().getStructuredBody().getComponentArray()) {
SectionComponent sectionComponent = new SectionComponent();
addSectionChildren(sectionComponent, component3.getSection());
composition.addSection(sectionComponent);
}
}
for (CarePlan carePlan : carePlans) {
composition.addSection(buildSectionComponentFromResource(carePlan));
}
if (!referralRequest.isEmpty()) {
composition.addSection(buildSectionComponentFromResource(referralRequest));
}
if (questionnaireResponseList != null) {
addPathwaysToSection(composition, questionnaireResponseList);
}
return composition;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project integration-adaptor-111 by nhsconnect.
the class ObservationMapper method createObservation.
private Observation createObservation(Encounter encounter, List<String> sectionText) {
Observation observation = new Observation();
observation.setIdElement(resourceUtil.newRandomUuid());
observation.setStatus(FINAL);
Coding coding = new Coding().setCode(PRESENTING_COMPLAINT_CODE).setDisplay(PRESENTING_COMPLAINT_DISPLAY).setSystem(SNOMED_SYSTEM);
observation.setCode(new CodeableConcept(coding));
observation.setValue(new StringType(join(sectionText, '\n')));
observation.setContext(resourceUtil.createReference(encounter));
observation.setSubject(encounter.getSubject());
return observation;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpansionCache method loadCache.
private void loadCache() throws FHIRFormatError, IOException {
File[] files = new File(cacheFolder).listFiles();
for (File f : files) {
if (f.getName().endsWith(".xml")) {
final FileInputStream is = new FileInputStream(f);
try {
Resource r = context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
if (r instanceof OperationOutcome) {
OperationOutcome oo = (OperationOutcome) r;
expansions.put(ToolingExtensions.getExtension(oo, VS_ID_EXT).getValue().toString(), new ValueSetExpansionOutcome(new XhtmlComposer(true, false).composePlainText(oo.getText().getDiv())));
} else {
ValueSet vs = (ValueSet) r;
expansions.put(vs.getUrl(), new ValueSetExpansionOutcome(vs, null));
}
} finally {
IOUtils.closeQuietly(is);
}
}
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class JavaResourceGenerator method writeSearchParameterField.
// private void generateImpl(String namenn, ResourceDefn resourceDefn, String jn, ElementDefinition root, String version, Date genDate) throws Exception {
// // TODO - restore this
// // write(" public "+namenn+" get"+namenn+"() {\r\n");
// // write(" return new "+jn+namenn+"Impl(this);\r\n");
// // write(" }\r\n");
// //
// // // now, generate the implementation
// // JavaPatternImplGenerator jrg = new JavaPatternImplGenerator(new FileOutputStream(javaPatternDir+jn+namenn+"Impl.java"), definitions, adornments, enumInfo);
// // jrg.generate(resourceDefn.getRoot(), jn, JavaGenClass.Resource, null, genDate, version, false, null, null, namenn, root);
// // jrg.close();
// //
// }
private void writeSearchParameterField(String name, JavaGenClass clss, boolean isAbstract, SearchParameter sp, String code, String[] theCompositeOf, List<SearchParameter> searchParams, String rn) throws IOException {
String constName = cleanSpName(code).toUpperCase();
/*
* SearchParamDefinition (SP_[name])
*/
write(" /**\r\n");
write(" * Search parameter: <b>" + code + "</b>\r\n");
write(" * <p>\r\n");
write(" * Description: <b>" + sp.getDescription() + "</b><br>\r\n");
write(" * Type: <b>" + sp.getType().toCode() + "</b><br>\r\n");
write(" * Path: <b>" + sp.getExpression() + "</b><br>\r\n");
write(" * </p>\r\n");
write(" */\r\n");
write(" @SearchParamDefinition(name=\"" + code + "\", path=\"" + defaultString(sp.getExpression()) + "\", description=\"" + Utilities.escapeJava(sp.getDescription()) + "\", type=\"" + sp.getType().toCode() + "\"");
if (theCompositeOf != null && theCompositeOf.length > 0) {
write(", compositeOf={");
for (int i = 0; i < theCompositeOf.length; i++) {
if (i > 0) {
write(", ");
}
write("\"" + theCompositeOf[i] + "\"");
}
write("}");
}
Set<String> providesMembershipIn = new TreeSet<String>();
for (CompartmentDefinition next : this.definitions.getCompartments().getList()) {
for (CompartmentDefinitionResourceComponent nextEntry : next.getResource()) {
if (nextEntry.getCode().equals(upFirst(name))) {
for (StringType nextPart : nextEntry.getParam()) {
if (nextPart.toString().equals(code)) {
providesMembershipIn.add(next.getName());
}
}
}
}
}
if (providesMembershipIn.size() > 0) {
write(", providesMembershipIn={ ");
boolean first = true;
for (String next : providesMembershipIn) {
if (first) {
first = false;
} else {
write(", ");
}
write("@ca.uhn.fhir.model.api.annotation.Compartment(name=\"" + upFirst(next) + "\")");
}
write(" }");
}
Set<String> targets = new TreeSet<>();
for (CodeType c : sp.getTarget()) {
targets.add(c.asStringValue());
}
if (targets != null && !targets.isEmpty() && !targets.contains("Any")) {
write(", target={");
boolean first = true;
for (String nextTarget : targets) {
if (first) {
first = false;
} else {
write(", ");
}
write("List".equals(nextTarget) ? "ListResource" : nextTarget);
write(".class");
}
write(" }");
}
write(" )\r\n");
write(" public static final String SP_" + constName + " = \"" + code + "\";\r\n");
String genericTypes = "";
if (theCompositeOf != null && theCompositeOf.length > 0) {
SearchParameter typeDef0 = findSearchParam(searchParams, theCompositeOf[0]);
SearchParameter typeDef1 = findSearchParam(searchParams, theCompositeOf[1]);
genericTypes = "<ca.uhn.fhir.rest.gclient." + upFirst(typeDef0.getType().toCode()) + "ClientParam" + ", ca.uhn.fhir.rest.gclient." + upFirst(typeDef1.getType().toCode()) + "ClientParam>";
}
/*
* Client parameter ([name])
*/
write(" /**\r\n");
write(" * <b>Fluent Client</b> search parameter constant for <b>" + code + "</b>\r\n");
write(" * <p>\r\n");
write(" * Description: <b>" + sp.getDescription() + "</b><br>\r\n");
write(" * Type: <b>" + sp.getType().toCode() + "</b><br>\r\n");
write(" * Path: <b>" + sp.getExpression() + "</b><br>\r\n");
write(" * </p>\r\n");
write(" */\r\n");
write(" public static final ca.uhn.fhir.rest.gclient." + upFirst(sp.getType().toCode()) + "ClientParam" + genericTypes + " " + constName + " = new ca.uhn.fhir.rest.gclient." + upFirst(sp.getType().toCode()) + "ClientParam" + genericTypes + "(SP_" + constName + ");\r\n\r\n");
if (sp.getType() == SearchParamType.REFERENCE && clss == JavaGenClass.Resource && !isAbstract) {
String incName = upFirst(name) + ":" + code;
write("/**\r\n");
write(" * Constant for fluent queries to be used to add include statements. Specifies\r\n");
write(" * the path value of \"<b>" + incName + "</b>\".\r\n");
write(" */\r\n");
write(" public static final ca.uhn.fhir.model.api.Include INCLUDE_" + cleanSpName(code).toUpperCase() + " = new ca.uhn.fhir.model.api.Include(\"" + incName + "\").toLocked();\r\n\r\n");
}
}
Aggregations