use of org.hl7.fhir.dstu2.model.Composition in project cqf-ruler by DBCG.
the class CareGapsProvider method getReports.
// warning for greater than 7 parameters
@SuppressWarnings("squid:S00107")
private List<MeasureReport> getReports(RequestDetails requestDetails, String periodStart, String periodEnd, Patient patient, List<String> status, List<Measure> measures, Composition composition, List<DetectedIssue> detectedIssues, Map<String, Resource> evaluatedResources) {
List<MeasureReport> reports = new ArrayList<>();
MeasureReport report = null;
for (Measure measure : measures) {
report = measureEvaluateProvider.evaluateMeasure(requestDetails, measure.getIdElement(), periodStart, periodEnd, "patient", Ids.simple(patient), null, null, null, null);
if (!report.hasGroup()) {
ourLog.info("Report does not include a group so skipping.\nSubject: {}\nMeasure: {}", Ids.simple(patient), Ids.simplePart(measure));
continue;
}
initializeReport(report);
CareGapsStatusCode gapStatus = getGapStatus(measure, report);
if (!status.contains(gapStatus.toString())) {
continue;
}
DetectedIssue detectedIssue = getDetectedIssue(patient, report, gapStatus);
detectedIssues.add(detectedIssue);
composition.addSection(getSection(measure, report, detectedIssue, gapStatus));
getEvaluatedResources(report, evaluatedResources);
reports.add(report);
}
return reports;
}
use of org.hl7.fhir.dstu2.model.Composition in project cqf-ruler by DBCG.
the class CompositionBuilder method initializeDstu2_1.
@Override
protected void initializeDstu2_1(T theResource) {
super.initializeDstu2_1(theResource);
org.hl7.fhir.dstu2016may.model.Composition composition = (org.hl7.fhir.dstu2016may.model.Composition) theResource;
composition.setDate(myDate).setIdentifier(new Identifier().setSystem(getIdentifier().getKey()).setValue(getIdentifier().getValue())).setStatus(org.hl7.fhir.dstu2016may.model.Composition.CompositionStatus.valueOf(myStatus)).setSubject(new Reference(mySubject)).setTitle(myTitle).setType(new CodeableConcept().addCoding(new Coding().setSystem(getTypeSetting().getSystem()).setCode(getTypeSetting().getCode()).setDisplay(getTypeSetting().getDisplay()))).addAuthor(new Reference(myAuthor)).setCustodian(new Reference(myCustodian));
}
use of org.hl7.fhir.dstu2.model.Composition in project cqf-ruler by DBCG.
the class MeasureDataProcessProvider method gatherEicrs.
private void gatherEicrs(IVersionSpecificBundleFactory bundleFactory, Map<String, Reference> populationSubjectListReferenceMap) {
Map<String, Bundle> eicrs = new HashMap<>();
List<Bundle> documentBundles = search(Bundle.class, Searches.all()).getAllResourcesTyped().stream().filter(x -> x.hasEntry() && DOCUMENT.equals(x.getType())).collect(Collectors.toList());
for (Bundle bundle : documentBundles) {
IBaseResource firstResource = bundle.getEntryFirstRep().getResource();
if (!(firstResource instanceof Composition)) {
logger.debug("Any bundle of type document must have the first entry of type Composition, but found: {}", firstResource);
continue;
}
Composition composition = (Composition) firstResource;
Reference compositionSubject = composition.getSubject();
String[] referenceSplit = compositionSubject.getReference().split("/");
for (Map.Entry<String, Reference> entry : populationSubjectListReferenceMap.entrySet()) {
if (compositionSubject.equals(entry.getValue()) || compositionSubject.getReference().equals(entry.getKey()) || (referenceSplit.length > 1 && referenceSplit[1].equals(entry.getKey()))) {
eicrs.putIfAbsent(entry.getKey(), bundle);
}
}
}
bundleFactory.addResourcesToBundle(eicrs.values().stream().collect(Collectors.toList()), COLLECTION, null, null, null);
}
use of org.hl7.fhir.dstu2.model.Composition in project summary-care-record-api by NHSDigital.
the class PatientMapper method mapPatient.
public static void mapPatient(GpSummary gpSummary, Bundle bundle) throws FhirMappingException {
Patient patient = getDomainResource(bundle, Patient.class);
setPatientIds(gpSummary, patient);
var composition = getDomainResource(bundle, Composition.class);
if (!composition.hasSubject() || !patient.getId().contains(composition.getSubject().getReference())) {
throw new FhirValidationException("Composition.subject reference is missing or invalid");
}
}
use of org.hl7.fhir.dstu2.model.Composition in project fhir-bridge by ehrbase.
the class PatientToCompositionConverter method convert.
@Override
public C convert(@NonNull Patient resource) {
C composition = super.convert(resource);
Extension extensionAge = resource.getExtensionByUrl("https://www.netzwerk-universitaetsmedizin.de/fhir/StructureDefinition/age");
composition.setStartTimeValue(TimeConverter.convertAgeExtensionTime(extensionAge));
return composition;
}
Aggregations