ca.uhn.fhir.rest.annotation.Operation Java Examples
The following examples show how to use
ca.uhn.fhir.rest.annotation.Operation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LibraryOperationsProvider.java From cqf-ruler with Apache License 2.0 | 8 votes |
@Operation(name = "$refresh-generated-content", type = Library.class) public MethodOutcome refreshGeneratedContent(HttpServletRequest theRequest, RequestDetails theRequestDetails, @IdParam IdType theId) { Library theResource = this.libraryResourceProvider.getDao().read(theId); //this.formatCql(theResource); ModelManager modelManager = this.getModelManager(); LibraryManager libraryManager = this.getLibraryManager(modelManager); CqlTranslator translator = this.dataRequirementsProvider.getTranslator(theResource, libraryManager, modelManager); if (translator.getErrors().size() > 0) { throw new RuntimeException("Errors during library compilation."); } this.dataRequirementsProvider.ensureElm(theResource, translator); this.dataRequirementsProvider.ensureRelatedArtifacts(theResource, translator, this); this.dataRequirementsProvider.ensureDataRequirements(theResource, translator); Narrative n = this.narrativeProvider.getNarrative(this.libraryResourceProvider.getContext(), theResource); theResource.setText(n); return this.libraryResourceProvider.update(theRequest, theResource, theId, theRequestDetails.getConditionalUrl(RestOperationTypeEnum.UPDATE), theRequestDetails); }
Example #2
Source File: CodeSystemUpdateProvider.java From cqf-ruler with Apache License 2.0 | 6 votes |
/*** * Update existing CodeSystems with the codes in all ValueSet resources. * System level CodeSystem update operation * * @return FHIR OperationOutcome detailing the success or failure of the operation */ @Operation(name = "$updateCodeSystems", idempotent = true) public OperationOutcome updateCodeSystems() { IBundleProvider valuesets = this.valueSetDao.search(new SearchParameterMap()); OperationOutcome response = new OperationOutcome(); OperationOutcome outcome; for (IBaseResource valueSet : valuesets.getResources(0, valuesets.size())) { outcome = this.performCodeSystemUpdate((ValueSet) valueSet); if (outcome.hasIssue()) { for (OperationOutcome.OperationOutcomeIssueComponent issue : outcome.getIssue()) { response.addIssue(issue); } } } return response; }
Example #3
Source File: LibraryOperationsProvider.java From cqf-ruler with Apache License 2.0 | 6 votes |
@Operation(name = "$get-elm", idempotent = true, type = Library.class) public Parameters getElm(@IdParam IdType theId, @OptionalParam(name="format") String format) { Library theResource = this.libraryResourceProvider.getDao().read(theId); // this.formatCql(theResource); ModelManager modelManager = this.getModelManager(); LibraryManager libraryManager = this.getLibraryManager(modelManager); String elm = ""; CqlTranslator translator = this.dataRequirementsProvider.getTranslator(theResource, libraryManager, modelManager); if (translator != null) { if (format.equals("json")) { elm = translator.toJson(); } else { elm = translator.toXml(); } } Parameters p = new Parameters(); p.addParameter().setValue(new StringType(elm)); return p; }
Example #4
Source File: LibraryOperationsProvider.java From cqf-ruler with Apache License 2.0 | 6 votes |
@Operation(name = "$get-elm", idempotent = true, type = Library.class) public Parameters getElm(@IdParam IdType theId, @OptionalParam(name="format") String format) { Library theResource = this.libraryResourceProvider.getDao().read(theId); // this.formatCql(theResource); ModelManager modelManager = this.getModelManager(); LibraryManager libraryManager = this.getLibraryManager(modelManager); String elm = ""; CqlTranslator translator = this.dataRequirementsProvider.getTranslator(theResource, libraryManager, modelManager); if (translator != null) { if (format.equals("json")) { elm = translator.toJson(); } else { elm = translator.toXml(); } } Parameters p = new Parameters(); p.addParameter().setValue(new StringType(elm)); return p; }
Example #5
Source File: CodeSystemUpdateProvider.java From cqf-ruler with Apache License 2.0 | 6 votes |
/*** * Update existing CodeSystems with the codes in all ValueSet resources. * System level CodeSystem update operation * * @return FHIR OperationOutcome detailing the success or failure of the operation */ @Operation(name = "$updateCodeSystems", idempotent = true) public OperationOutcome updateCodeSystems() { IBundleProvider valuesets = this.valueSetDao.search(new SearchParameterMap()); OperationOutcome response = new OperationOutcome(); OperationOutcome outcome; for (IBaseResource valueSet : valuesets.getResources(0, valuesets.size())) { outcome = this.performCodeSystemUpdate((ValueSet) valueSet); if (outcome.hasIssue()) { for (OperationOutcome.OperationOutcomeIssueComponent issue : outcome.getIssue()) { response.addIssue(issue); } } } return response; }
Example #6
Source File: CodeSystemUpdateProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
/*** * 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. * * @param theId the id of the ValueSet * @return FHIR OperationOutcome detailing the success or failure of the operation */ @Operation(name = "$updateCodeSystems", idempotent = true, type = ValueSet.class) public OperationOutcome updateCodeSystems(@IdParam IdType theId) { ValueSet vs = this.valueSetDao.read(theId); OperationOutcomeBuilder responseBuilder = new OperationOutcomeBuilder(); if (vs == null) { return responseBuilder.buildIssue("error", "notfound", "Unable to find Resource: " + theId.getId()).build(); } return performCodeSystemUpdate(vs); }
Example #7
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$submit-data", idempotent = true, type = Measure.class) public Resource submitData(RequestDetails details, @IdParam IdType theId, @OperationParam(name = "measure-report", min = 1, max = 1, type = MeasureReport.class) MeasureReport report, @OperationParam(name = "resource") List<IAnyResource> resources) { Bundle transactionBundle = new Bundle().setType(Bundle.BundleType.TRANSACTION); /* * TODO - resource validation using $data-requirements operation (params are the * provided id and the measurement period from the MeasureReport) * * TODO - profile validation ... not sure how that would work ... (get * StructureDefinition from URL or must it be stored in Ruler?) */ transactionBundle.addEntry(createTransactionEntry(report)); for (IAnyResource resource : resources) { Resource res = (Resource) resource; if (res instanceof Bundle) { for (Bundle.BundleEntryComponent entry : createTransactionBundle((Bundle) res).getEntry()) { transactionBundle.addEntry(entry); } } else { // Build transaction bundle transactionBundle.addEntry(createTransactionEntry(res)); } } return (Resource) this.registry.getSystemDao().transaction(details, transactionBundle); }
Example #8
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$data-requirements", idempotent = true, type = Measure.class) public org.hl7.fhir.r4.model.Library dataRequirements(@IdParam IdType theId, @RequiredParam(name = "startPeriod") String startPeriod, @RequiredParam(name = "endPeriod") String endPeriod) throws InternalErrorException, FHIRException { Measure measure = this.measureResourceProvider.getDao().read(theId); return this.dataRequirementsProvider.getDataRequirements(measure, this.libraryResolutionProvider); }
Example #9
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$collect-data", idempotent = true, type = Measure.class) public Parameters collectData(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart, @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "patient") String patientRef, @OptionalParam(name = "practitioner") String practitionerRef, @OptionalParam(name = "lastReceivedOn") String lastReceivedOn) throws FHIRException { // TODO: Spec says that the periods are not required, but I am not sure what to // do when they aren't supplied so I made them required MeasureReport report = evaluateMeasure(theId, periodStart, periodEnd, null, null, patientRef, null, practitionerRef, lastReceivedOn, null, null, null); report.setGroup(null); Parameters parameters = new Parameters(); parameters.addParameter( new Parameters.ParametersParameterComponent().setName("measurereport").setResource(report)); if (report.hasContained()) { for (Resource contained : report.getContained()) { if (contained instanceof Bundle) { addEvaluatedResourcesToParameters((Bundle) contained, parameters); } } } // TODO: need a way to resolve referenced resources within the evaluated // resources // Should be able to use _include search with * wildcard, but HAPI doesn't // support that return parameters; }
Example #10
Source File: CodeSystemUpdateProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
/*** * 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. * * @param theId the id of the ValueSet * @return FHIR OperationOutcome detailing the success or failure of the operation */ @Operation(name = "$updateCodeSystems", idempotent = true, type = ValueSet.class) public OperationOutcome updateCodeSystems(@IdParam IdType theId) { ValueSet vs = this.valueSetDao.read(theId); OperationOutcomeBuilder responseBuilder = new OperationOutcomeBuilder(); if (vs == null) { return responseBuilder.buildIssue("error", "notfound", "Unable to find Resource: " + theId.getId()).build(); } return performCodeSystemUpdate(vs); }
Example #11
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$get-narrative", idempotent = true, type = Measure.class) public Parameters getNarrative(@IdParam IdType theId) { Measure theResource = this.measureResourceProvider.getDao().read(theId); CqfMeasure cqfMeasure = this.dataRequirementsProvider.createCqfMeasure(theResource, this.libraryResolutionProvider); Narrative n = this.narrativeProvider.getNarrative(this.measureResourceProvider.getContext(), cqfMeasure); Parameters p = new Parameters(); p.addParameter().setValue(new StringType(n.getDivAsString())); return p; }
Example #12
Source File: LibraryOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$get-narrative", idempotent = true, type = Library.class) public Parameters getNarrative(@IdParam IdType theId) { Library theResource = this.libraryResourceProvider.getDao().read(theId); Narrative n = this.narrativeProvider.getNarrative(this.libraryResourceProvider.getContext(), theResource); Parameters p = new Parameters(); p.addParameter().setValue(new StringType(n.getDivAsString())); return p; }
Example #13
Source File: LibraryOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$refresh-generated-content", type = Library.class) public MethodOutcome refreshGeneratedContent(HttpServletRequest theRequest, RequestDetails theRequestDetails, @IdParam IdType theId) { Library theResource = this.libraryResourceProvider.getDao().read(theId); //this.formatCql(theResource); ModelManager modelManager = this.getModelManager(); LibraryManager libraryManager = this.getLibraryManager(modelManager); CqlTranslator translator = this.dataRequirementsProvider.getTranslator(theResource, libraryManager, modelManager); if (translator.getErrors().size() > 0) { throw new RuntimeException("Errors during library compilation."); } this.dataRequirementsProvider.ensureElm(theResource, translator); this.dataRequirementsProvider.ensureRelatedArtifacts(theResource, translator, this); this.dataRequirementsProvider.ensureDataRequirements(theResource, translator); try { Narrative n = this.narrativeProvider.getNarrative(this.libraryResourceProvider.getContext(), theResource); theResource.setText(n); } catch (Exception e) { //Ignore the exception so the resource still gets updated } return this.libraryResourceProvider.update(theRequest, theResource, theId, theRequestDetails.getConditionalUrl(RestOperationTypeEnum.UPDATE), theRequestDetails); }
Example #14
Source File: ServerPlainProvider.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Operation(name = "$convert", idempotent = true) public IBaseResource convertJson( @ResourceParam IBaseResource resource ) throws Exception { return resource; }
Example #15
Source File: ApplyCqlOperationProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$apply-cql", type = Bundle.class) public Bundle apply(@IdParam IdType id) throws FHIRException { Bundle bundle = this.bundleDao.read(id); if (bundle == null) { throw new IllegalArgumentException("Could not find Bundle/" + id.getIdPart()); } return applyCql(bundle); }
Example #16
Source File: PlanDefinitionApplyProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$apply", idempotent = true, type = PlanDefinition.class) public CarePlan applyPlanDefinition( @IdParam IdType theId, @RequiredParam(name="patient") String patientId, @OptionalParam(name="encounter") String encounterId, @OptionalParam(name="practitioner") String practitionerId, @OptionalParam(name="organization") String organizationId, @OptionalParam(name="userType") String userType, @OptionalParam(name="userLanguage") String userLanguage, @OptionalParam(name="userTaskContext") String userTaskContext, @OptionalParam(name="setting") String setting, @OptionalParam(name="settingContext") String settingContext) throws IOException, JAXBException, FHIRException { PlanDefinition planDefinition = this.planDefintionDao.read(theId); if (planDefinition == null) { throw new IllegalArgumentException("Couldn't find PlanDefinition " + theId); } logger.info("Performing $apply operation on PlanDefinition/" + theId); CarePlanBuilder builder = new CarePlanBuilder(); builder .buildDefinition(new Reference(planDefinition.getIdElement().getIdPart())) .buildSubject(new Reference(patientId)) .buildStatus(CarePlan.CarePlanStatus.DRAFT); if (encounterId != null) builder.buildContext(new Reference(encounterId)); if (practitionerId != null) builder.buildAuthor(new Reference(practitionerId)); if (organizationId != null) builder.buildAuthor(new Reference(organizationId)); if (userLanguage != null) builder.buildLanguage(userLanguage); Session session = new Session(planDefinition, builder, patientId, encounterId, practitionerId, organizationId, userType, userLanguage, userTaskContext, setting, settingContext); return resolveActions(session); }
Example #17
Source File: PlanDefinitionApplyProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$apply", idempotent = true, type = PlanDefinition.class) public CarePlan applyPlanDefinition( @IdParam IdType theId, @RequiredParam(name="patient") String patientId, @OptionalParam(name="encounter") String encounterId, @OptionalParam(name="practitioner") String practitionerId, @OptionalParam(name="organization") String organizationId, @OptionalParam(name="userType") String userType, @OptionalParam(name="userLanguage") String userLanguage, @OptionalParam(name="userTaskContext") String userTaskContext, @OptionalParam(name="setting") String setting, @OptionalParam(name="settingContext") String settingContext) throws IOException, JAXBException, FHIRException { PlanDefinition planDefinition = this.planDefintionDao.read(theId); if (planDefinition == null) { throw new IllegalArgumentException("Couldn't find PlanDefinition " + theId); } logger.info("Performing $apply operation on PlanDefinition/" + theId); CarePlanBuilder builder = new CarePlanBuilder(); builder .buildInstantiatesCanonical(planDefinition.getIdElement().getIdPart()) .buildSubject(new Reference(patientId)) .buildStatus(CarePlan.CarePlanStatus.DRAFT); if (encounterId != null) builder.buildEncounter(new Reference(encounterId)); if (practitionerId != null) builder.buildAuthor(new Reference(practitionerId)); if (organizationId != null) builder.buildAuthor(new Reference(organizationId)); if (userLanguage != null) builder.buildLanguage(userLanguage); Session session = new Session(planDefinition, builder, patientId, encounterId, practitionerId, organizationId, userType, userLanguage, userTaskContext, setting, settingContext); return resolveActions(session); }
Example #18
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$submit-data", idempotent = true, type = Measure.class) public Resource submitData(RequestDetails details, @IdParam IdType theId, @OperationParam(name = "measure-report", min = 1, max = 1, type = MeasureReport.class) MeasureReport report, @OperationParam(name = "resource") List<IAnyResource> resources) { Bundle transactionBundle = new Bundle().setType(Bundle.BundleType.TRANSACTION); /* * TODO - resource validation using $data-requirements operation (params are the * provided id and the measurement period from the MeasureReport) * * TODO - profile validation ... not sure how that would work ... (get * StructureDefinition from URL or must it be stored in Ruler?) */ transactionBundle.addEntry(createTransactionEntry(report)); for (IAnyResource resource : resources) { Resource res = (Resource) resource; if (res instanceof Bundle) { for (Bundle.BundleEntryComponent entry : createTransactionBundle((Bundle) res).getEntry()) { transactionBundle.addEntry(entry); } } else { // Build transaction bundle transactionBundle.addEntry(createTransactionEntry(res)); } } return (Resource) this.registry.getSystemDao().transaction(details, transactionBundle); }
Example #19
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$data-requirements", idempotent = true, type = Measure.class) public org.hl7.fhir.dstu3.model.Library dataRequirements(@IdParam IdType theId, @RequiredParam(name = "startPeriod") String startPeriod, @RequiredParam(name = "endPeriod") String endPeriod) throws InternalErrorException, FHIRException { Measure measure = this.measureResourceProvider.getDao().read(theId); return this.dataRequirementsProvider.getDataRequirements(measure, this.libraryResolutionProvider); }
Example #20
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$collect-data", idempotent = true, type = Measure.class) public Parameters collectData(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart, @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "patient") String patientRef, @OptionalParam(name = "practitioner") String practitionerRef, @OptionalParam(name = "lastReceivedOn") String lastReceivedOn) throws FHIRException { // TODO: Spec says that the periods are not required, but I am not sure what to // do when they aren't supplied so I made them required MeasureReport report = evaluateMeasure(theId, periodStart, periodEnd, null, null, patientRef, null, practitionerRef, lastReceivedOn, null, null, null); report.setGroup(null); Parameters parameters = new Parameters(); parameters.addParameter( new Parameters.ParametersParameterComponent().setName("measurereport").setResource(report)); if (report.hasContained()) { for (Resource contained : report.getContained()) { if (contained instanceof Bundle) { addEvaluatedResourcesToParameters((Bundle) contained, parameters); } } } // TODO: need a way to resolve referenced resources within the evaluated // resources // Should be able to use _include search with * wildcard, but HAPI doesn't // support that return parameters; }
Example #21
Source File: ApplyCqlOperationProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$apply-cql", type = Bundle.class) public Bundle apply(@IdParam IdType id) throws FHIRException { Bundle bundle = this.bundleDao.read(id); if (bundle == null) { throw new IllegalArgumentException("Could not find Bundle/" + id.getIdPart()); } return applyCql(bundle); }
Example #22
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$get-narrative", idempotent = true, type = Measure.class) public Parameters getNarrative(@IdParam IdType theId) { Measure theResource = this.measureResourceProvider.getDao().read(theId); CqfMeasure cqfMeasure = this.dataRequirementsProvider.createCqfMeasure(theResource, this.libraryResolutionProvider); Narrative n = this.narrativeProvider.getNarrative(this.measureResourceProvider.getContext(), cqfMeasure); Parameters p = new Parameters(); p.addParameter().setValue(new StringType(n.getDivAsString())); return p; }
Example #23
Source File: LibraryOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$get-narrative", idempotent = true, type = Library.class) public Parameters getNarrative(@IdParam IdType theId) { Library theResource = this.libraryResourceProvider.getDao().read(theId); Narrative n = this.narrativeProvider.getNarrative(this.libraryResourceProvider.getContext(), theResource); Parameters p = new Parameters(); p.addParameter().setValue(new StringType(n.getDivAsString())); return p; }
Example #24
Source File: ApplyCqlOperationProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name = "$apply-cql", type = Bundle.class) public Bundle apply(@OperationParam(name = "resourceBundle", min = 1, max = 1, type = Bundle.class) Bundle bundle) throws FHIRException { return applyCql(bundle); }
Example #25
Source File: ApplyCqlOperationProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name = "$apply-cql", type = Bundle.class) public Bundle apply(@OperationParam(name = "resourceBundle", min = 1, max = 1, type = Bundle.class) Bundle bundle) throws FHIRException { return applyCql(bundle); }
Example #26
Source File: CacheValueSetsProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name="cache-valuesets", idempotent = true, type = Endpoint.class) public Resource cacheValuesets( RequestDetails details, @IdParam IdType theId, @RequiredParam(name="valuesets") StringAndListParam valuesets, @OptionalParam(name="user") String userName, @OptionalParam(name="pass") String password ) { Endpoint endpoint = this.endpointDao.read(theId); if (endpoint == null) { return Helper.createErrorOutcome("Could not find Endpoint/" + theId); } IGenericClient client = this.systemDao.getContext().newRestfulGenericClient(endpoint.getAddress()); if (userName != null || password != null) { if (userName == null) { Helper.createErrorOutcome("Password was provided, but not a user name."); } else if (password == null) { Helper.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 Helper.createErrorOutcome(e.getMessage()); } }
Example #27
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name = "$evaluate-measure", idempotent = true, type = Measure.class) public MeasureReport evaluateMeasure(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart, @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "measure") String measureRef, @OptionalParam(name = "reportType") String reportType, @OptionalParam(name = "patient") String patientRef, @OptionalParam(name = "productLine") String productLine, @OptionalParam(name = "practitioner") String practitionerRef, @OptionalParam(name = "lastReceivedOn") String lastReceivedOn, @OptionalParam(name = "source") String source, @OptionalParam(name = "user") String user, @OptionalParam(name = "pass") String pass) throws InternalErrorException, FHIRException { LibraryLoader libraryLoader = LibraryHelper.createLibraryLoader(this.libraryResolutionProvider); MeasureEvaluationSeed seed = new MeasureEvaluationSeed(this.factory, libraryLoader, this.libraryResolutionProvider); Measure measure = this.measureResourceProvider.getDao().read(theId); if (measure == null) { throw new RuntimeException("Could not find Measure/" + theId.getIdPart()); } seed.setup(measure, periodStart, periodEnd, productLine, source, user, pass); // resolve report type MeasureEvaluation evaluator = new MeasureEvaluation(seed.getDataProvider(), this.registry, seed.getMeasurementPeriod()); if (reportType != null) { switch (reportType) { case "patient": return evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef); case "patient-list": return evaluator.evaluateSubjectListMeasure(seed.getMeasure(), seed.getContext(), practitionerRef); case "population": return evaluator.evaluatePopulationMeasure(seed.getMeasure(), seed.getContext()); default: throw new IllegalArgumentException("Invalid report type: " + reportType); } } // default report type is patient MeasureReport report = evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef); 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; }
Example #28
Source File: CacheValueSetsProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name="cache-valuesets", idempotent = true, type = Endpoint.class) public Resource cacheValuesets( RequestDetails details, @IdParam IdType theId, @RequiredParam(name="valuesets") StringAndListParam valuesets, @OptionalParam(name="user") String userName, @OptionalParam(name="pass") String password ) { Endpoint endpoint = this.endpointDao.read(theId); if (endpoint == null) { return Helper.createErrorOutcome("Could not find Endpoint/" + theId); } IGenericClient client = this.systemDao.getContext().newRestfulGenericClient(endpoint.getAddress()); if (userName != null || password != null) { if (userName == null) { Helper.createErrorOutcome("Password was provided, but not a user name."); } else if (password == null) { Helper.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 Helper.createErrorOutcome(e.getMessage()); } }
Example #29
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 4 votes |
@Operation(name = "$evaluate-measure", idempotent = true, type = Measure.class) public MeasureReport evaluateMeasure(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart, @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "measure") String measureRef, @OptionalParam(name = "reportType") String reportType, @OptionalParam(name = "patient") String patientRef, @OptionalParam(name = "productLine") String productLine, @OptionalParam(name = "practitioner") String practitionerRef, @OptionalParam(name = "lastReceivedOn") String lastReceivedOn, @OptionalParam(name = "source") String source, @OptionalParam(name = "user") String user, @OptionalParam(name = "pass") String pass) throws InternalErrorException, FHIRException { LibraryLoader libraryLoader = LibraryHelper.createLibraryLoader(this.libraryResolutionProvider); MeasureEvaluationSeed seed = new MeasureEvaluationSeed(this.factory, libraryLoader, this.libraryResolutionProvider); Measure measure = this.measureResourceProvider.getDao().read(theId); if (measure == null) { throw new RuntimeException("Could not find Measure/" + theId.getIdPart()); } seed.setup(measure, periodStart, periodEnd, productLine, source, user, pass); // resolve report type MeasureEvaluation evaluator = new MeasureEvaluation(seed.getDataProvider(), this.registry, seed.getMeasurementPeriod()); if (reportType != null) { switch (reportType) { case "patient": return evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef); case "patient-list": return evaluator.evaluatePatientListMeasure(seed.getMeasure(), seed.getContext(), practitionerRef); case "population": return evaluator.evaluatePopulationMeasure(seed.getMeasure(), seed.getContext()); default: throw new IllegalArgumentException("Invalid report type: " + reportType); } } // default report type is patient MeasureReport report = evaluator.evaluatePatientMeasure(seed.getMeasure(), seed.getContext(), patientRef); 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; }
Example #30
Source File: TerminologyClient.java From synthea with Apache License 2.0 | 4 votes |
@Operation(type = ValueSet.class, name = "$expand") ValueSet expand(@OperationParam(name = "url") UriType url, @OperationParam(name = "count") IntegerType count, @OperationParam(name = "offset") IntegerType offset);