use of ca.uhn.fhir.model.api.annotation.Description in project cqf-ruler by DBCG.
the class CodeSystemUpdateProvider method updateCodeSystems.
/**
* Update existing {@link CodeSystem CodeSystems} with the codes in all
* {@link ValueSet ValueSet} resources.
* System level CodeSystem update operation
*
* @return FHIR {@link OperationOutcome OperationOutcome} detailing the success
* or failure of the
* operation
*/
@Description(shortDefinition = "$updateCodeSystems", value = "Update existing CodeSystems with the codes in all ValueSet resources. System level CodeSystem update operation", example = "$updateCodeSystems")
@Operation(name = "$updateCodeSystems", idempotent = true)
public OperationOutcome updateCodeSystems() {
IBundleProvider valuesets = this.myValueSetDaoDSTU3.search(SearchParameterMap.newSynchronous());
List<ValueSet> valueSets = valuesets.getAllResources().stream().map(x -> (ValueSet) x).collect(Collectors.toList());
OperationOutcome outcome = this.performCodeSystemUpdate(valueSets);
OperationOutcome response = new OperationOutcome();
if (outcome.hasIssue()) {
for (OperationOutcome.OperationOutcomeIssueComponent issue : outcome.getIssue()) {
response.addIssue(issue);
}
}
return response;
}
use of ca.uhn.fhir.model.api.annotation.Description in project cqf-ruler by DBCG.
the class CacheValueSetsProvider method cacheValuesets.
/**
* Using basic authentication this {@link Operation Operation} will update
* any {@link ValueSet Valueset} listed given the {@link Endpoint Endpoint}
* provided.
* Any Valuesets that require expansion will be expanded.
*
* @param details the {@link RequestDetails RequestDetails}
* @param endpointId the {@link Endpoint Endpoint} id
* @param valuesets the {@link StringAndListParam list} of {@link ValueSet
* Valueset} ids
* @param userName the userName
* @param password the password
* @return the {@link OperationOutcome OperationOutcome} or the resulting
* {@link Bundle Bundle}
*/
@Description(shortDefinition = "$cache-valuesets", value = "Using basic authentication this Operation will update any Valueset listed given the Endpoint provided. Any Valuesets that require expansion will be expanded.", example = "Endpoint/example-id/$cache-valuesets?valuesets=valuesetId1&valuesets=valuesetId2&user=user&password=password")
@Operation(name = "cache-valuesets", idempotent = true, type = Endpoint.class)
public Resource cacheValuesets(RequestDetails details, @IdParam IdType endpointId, @OperationParam(name = "valuesets") StringAndListParam valuesets, @OperationParam(name = "user") String userName, @OperationParam(name = "pass") String password) {
Endpoint endpoint = null;
try {
endpoint = this.endpointDao.read(endpointId);
if (endpoint == null) {
return createErrorOutcome("Could not find Endpoint/" + endpointId);
}
} catch (Exception e) {
return createErrorOutcome("Could not find Endpoint/" + endpointId + "\n" + e);
}
IGenericClient client = Clients.forEndpoint(ourCtx, endpoint);
if (userName != null || password != null) {
if (userName == null) {
return createErrorOutcome("Password was provided, but not a user name.");
} else if (password == null) {
return createErrorOutcome("User name was provided, but not a password.");
}
BasicAuthInterceptor basicAuth = new BasicAuthInterceptor(userName, password);
client.registerInterceptor(basicAuth);
// TODO - more advanced security like bearer tokens, etc...
}
try {
Bundle bundleToPost = new Bundle();
for (StringOrListParam params : valuesets.getValuesAsQueryTokens()) {
for (StringParam valuesetId : params.getValuesAsQueryTokens()) {
bundleToPost.addEntry().setRequest(new Bundle.BundleEntryRequestComponent().setMethod(Bundle.HTTPVerb.PUT).setUrl("ValueSet/" + valuesetId.getValue())).setResource(resolveValueSet(client, valuesetId.getValue()));
}
}
return (Resource) systemDao.transaction(details, bundleToPost);
} catch (Exception e) {
return createErrorOutcome(e.getMessage());
}
}
use of ca.uhn.fhir.model.api.annotation.Description in project cqf-ruler by DBCG.
the class ReportProvider method report.
/**
* Implements the <a href=
* "https://build.fhir.org/ig/HL7/davinci-ra/OperationDefinition-report.html">$report</a>
* operation found in the
* <a href="https://build.fhir.org/ig/HL7/davinci-ra/index.html">Da Vinci Risk
* Adjustment IG</a>.
*
* @param requestDetails metadata about the current request being processed.
* Generally auto-populated by the HAPI FHIR server
* framework.
* @param periodStart the start of the clinical evaluation period
* @param periodEnd the end of the clinical evaluation period
* @param subject a Patient or Patient Group
* @return a Parameters with Bundles of MeasureReports and evaluatedResource
* Resources
*/
@Description(shortDefinition = "$report", value = "Implements the <a href=\"https://build.fhir.org/ig/HL7/davinci-ra/OperationDefinition-report.html\">$report</a> operation found in the <a href=\"https://build.fhir.org/ig/HL7/davinci-ra/index.html\">Da Vinci Risk Adjustment IG</a>.")
@Operation(name = "$report", idempotent = true, type = MeasureReport.class)
public Parameters report(RequestDetails requestDetails, @OperationParam(name = "periodStart", min = 1, max = 1) String periodStart, @OperationParam(name = "periodEnd", min = 1, max = 1) String periodEnd, @OperationParam(name = "subject", min = 1, max = 1) String subject) throws FHIRException {
validateParameters(periodStart, periodEnd, subject);
Parameters result = newResource(Parameters.class, subject.replace("/", "-") + "-report");
Date periodStartDate = Operations.resolveRequestDate(periodStart, true);
Date periodEndDate = Operations.resolveRequestDate(periodEnd, false);
Period period = new Period().setStart(periodStartDate).setEnd(periodEndDate);
List<Patient> patients = getPatientListFromSubject(subject);
(patients).forEach(patient -> {
Parameters.ParametersParameterComponent patientParameter = patientReport(patient, period, requestDetails.getFhirServerBase());
result.addParameter(patientParameter);
});
return result;
}
use of ca.uhn.fhir.model.api.annotation.Description in project cqf-ruler by DBCG.
the class MeasureEvaluateProvider method evaluateMeasure.
/**
* Implements the <a href=
* "https://www.hl7.org/fhir/operation-measure-evaluate-measure.html">$evaluate-measure</a>
* operation found in the
* <a href="http://www.hl7.org/fhir/clinicalreasoning-module.html">FHIR Clinical
* Reasoning Module</a>. This implementation aims to be compatible with the CQF
* IG.
*
* @param requestDetails The details (such as tenant) of this request. Usually
* auto-populated HAPI.
* @param theId the Id of the Measure to evaluate
* @param periodStart The start of the reporting period
* @param periodEnd The end of the reporting period
* @param reportType The type of MeasureReport to generate
* @param subject the subject to use for the evaluation
* @param practitioner the practitioner to use for the evaluation
* @param lastReceivedOn the date the results of this measure were last
* received.
* @param productLine the productLine (e.g. Medicare, Medicaid, etc) to use
* for the evaluation. This is a non-standard parameter.
* @param additionalData the data bundle containing additional data
* @return the calculated MeasureReport
*/
// warning for greater than 7 parameters
@SuppressWarnings("squid:S00107")
@Description(shortDefinition = "$evaluate-measure", value = "Implements the <a href=\"https://www.hl7.org/fhir/operation-measure-evaluate-measure.html\">$evaluate-measure</a> operation found in the <a href=\"http://www.hl7.org/fhir/clinicalreasoning-module.html\">FHIR Clinical Reasoning Module</a>. This implementation aims to be compatible with the CQF IG.", example = "Measure/example/$evaluate-measure?subject=Patient/123&periodStart=2019&periodEnd=2020")
@Operation(name = "$evaluate-measure", idempotent = true, type = Measure.class)
public MeasureReport evaluateMeasure(RequestDetails requestDetails, @IdParam IdType theId, @OperationParam(name = "periodStart") String periodStart, @OperationParam(name = "periodEnd") String periodEnd, @OperationParam(name = "reportType") String reportType, @OperationParam(name = "subject") String subject, @OperationParam(name = "practitioner") String practitioner, @OperationParam(name = "lastReceivedOn") String lastReceivedOn, @OperationParam(name = "productLine") String productLine, @OperationParam(name = "additionalData") Bundle additionalData) {
Measure measure = read(theId);
TerminologyProvider terminologyProvider = this.jpaTerminologyProviderFactory.create(requestDetails);
DataProvider dataProvider = this.jpaDataProviderFactory.create(requestDetails, terminologyProvider);
LibraryContentProvider libraryContentProvider = this.libraryContentProviderFactory.create(requestDetails);
FhirDal fhirDal = this.fhirDalFactory.create(requestDetails);
org.opencds.cqf.cql.evaluator.measure.r4.R4MeasureProcessor measureProcessor = new org.opencds.cqf.cql.evaluator.measure.r4.R4MeasureProcessor(null, this.dataProviderFactory, null, null, null, terminologyProvider, libraryContentProvider, dataProvider, fhirDal, null, this.globalLibraryCache);
MeasureReport report = measureProcessor.evaluateMeasure(measure.getUrl(), periodStart, periodEnd, reportType, subject, null, lastReceivedOn, null, null, null, additionalData);
if (productLine != null) {
Extension ext = new Extension();
ext.setUrl("http://hl7.org/fhir/us/cqframework/cqfmeasures/StructureDefinition/cqfm-productLine");
ext.setValue(new StringType(productLine));
report.addExtension(ext);
}
return report;
}
use of ca.uhn.fhir.model.api.annotation.Description in project cqf-ruler by DBCG.
the class CodeSystemUpdateProvider method updateCodeSystems.
/**
* Update existing {@link CodeSystem CodeSystems} with the codes in the
* specified {@link ValueSet ValueSet}.
*
* This is for development environment purposes to enable ValueSet expansion and
* validation without complete CodeSystems.
*
* @param theId the id of the {@link ValueSet ValueSet}
* @return FHIR {@link OperationOutcome OperationOutcome} detailing the success
* or failure of the
* operation
*/
@Description(shortDefinition = "$updateCodeSystems", value = "Update existing CodeSystems with the codes in the specified ValueSet This is for development environment purposes to enable ValueSet expansion and validation without complete CodeSystems.", example = "ValueSet/example-id/$updateCodeSystems")
@Operation(name = "$updateCodeSystems", idempotent = true, type = ValueSet.class)
public OperationOutcome updateCodeSystems(@IdParam IdType theId) {
OperationOutcome response = new OperationOutcome();
ValueSet vs = null;
try {
vs = this.myValueSetDaoR4.read(theId);
if (vs == null) {
return buildIssue(response, "error", "not-found", "Unable to find Resource: " + theId.getIdPart());
}
} catch (Exception e) {
return buildIssue(response, "error", "not-found", "Unable to find Resource: " + theId.getIdPart() + "\n" + e);
}
return performCodeSystemUpdate(Collections.singletonList(vs));
}
Aggregations