Skip to content

Commit

Permalink
Store FHIR client in report context
Browse files Browse the repository at this point in the history
  • Loading branch information
smailliwcs committed Feb 23, 2024
1 parent ca80b50 commit 040ada6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lantanagroup.link.model;

import ca.uhn.fhir.rest.client.api.IGenericClient;
import com.lantanagroup.link.FhirHelper;
import com.lantanagroup.link.auth.LinkCredentials;
import com.lantanagroup.link.db.model.PatientList;
Expand All @@ -25,6 +26,7 @@ public class ReportContext {
private List<PatientOfInterestModel> patientsOfInterest = new ArrayList<>();
private List<MeasureContext> measureContexts = new ArrayList<>();
private QueryPlan queryPlan;
private IGenericClient client;
private List<String> debugPatients = new ArrayList<>();

public ReportContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ public void execute(TenantService tenantService, ReportCriteria criteria, Report
List<PatientOfInterestModel> patientsOfInterest = context.getPatientsOfInterest(queryPhase);
if (patientsOfInterest.size() > 0) {
try {
IGenericClient client = this.getFhirQueryClient(tenantService, context.getMasterIdentifierValue());
context.setClient(client);
PatientScoop scoop = this.applicationContext.getBean(PatientScoop.class);
scoop.setFhirQueryServer(this.getFhirQueryClient(tenantService, context.getMasterIdentifierValue()));
scoop.setFhirQueryServer(client);
scoop.setTenantService(tenantService);
scoop.execute(criteria, context, patientsOfInterest, queryPhase);
} catch (Exception ex) {
logger.error("Error scooping data for patients", ex);
} finally {
context.setClient(null);
}
}
}
Expand Down

0 comments on commit 040ada6

Please sign in to comment.