5089 cr measure refactor (#5324)

* version bump

* Bump to core release 6.0.22 (#5028)

* Bump to core release 6.0.16

* Bump to core version 6.0.20

* Fix errors thrown as a result of VersionSpecificWorkerContextWrapper

* Bump to core 6.0.22

* Resolve 5126 hfj res ver prov might cause migration error on db that automatically indexes the primary key (#5127)

* dropped old index FK_RESVERPROV_RES_PID on RES_PID column before adding IDX_RESVERPROV_RES_PID

* added changelog

* changed to valid version number

* changed to valid version number, need to be ordered by version number...

* 5123 - Use DEFAULT partition for server-based requests if none specified (#5124)

5123 - Use DEFAULT partition for server-based requests if none specified

* consent remove all suppresses next link in bundle (#5119)

* added FIXME with source of issue

* added FIXME with root cause

* added FIXME with root cause

* Providing solution to the issue and removing fixmes.

* Providing changelog

* auto-formatting.

* Adding new test.

* Adding a new test for standard paging

* let's try this and see if it works...?

* fix tests

* cleanup to trigger a new run

* fixing tests

---------

Co-authored-by: Ken Stevens <ken@smilecdr.com>
Co-authored-by: peartree <etienne.poirier@smilecdr.com>

* 5117 MDM Score for No Match Fields Should Not Be Included in Total Score  (#5118)

* fix, test, changelog

* fix, test, changelog

---------

Co-authored-by: justindar <justin.dar@smilecdr.com>

* _source search parameter needs to support modifiers (#5095)

_source search parameter needs to support modifiers - added support form :contains, :missing, :above modifiers

* Fix HFQL docs (#5151)

* repository measure refactor

* undo bundle edit, add config

* embedded library true

* undo post of bundle

* clear library cache on test

* fix sumbit-data test

* missing packages from cql

* fix test data and test cases for repository api

* 3.0.0 clinical reasoning uplift

* r4 cql execution provider and tests

* fix submitdata provider config

* wip cql tests

* debugging cql op wip

* wip debugging cql

* update tests for $cql, fix class names

* prep for Pre6 uplift

* spotless checks and test fixes

* bump to 3.0.0-PRE6

* cleanup

* fix version

* cleanup

* fix exlusions in pom

* add in cache invalidation config

* search converter bug and test for repository

* update searchconverter

* version bump, add changelog

* remove term config, move IDaoRegistryUser class

* Break out dstu3 providers and move config to version folders

* CVE-2023-26119

* remove * imports

* code review updates

---------

Co-authored-by: tadgh <garygrantgraham@gmail.com>
Co-authored-by: dotasek <david.otasek@smilecdr.com>
Co-authored-by: TynerGjs <132295567+TynerGjs@users.noreply.github.com>
Co-authored-by: Steve Corbett <137920358+steve-corbett-smilecdr@users.noreply.github.com>
Co-authored-by: Ken Stevens <khstevens@gmail.com>
Co-authored-by: Ken Stevens <ken@smilecdr.com>
Co-authored-by: peartree <etienne.poirier@smilecdr.com>
Co-authored-by: jdar8 <69840459+jdar8@users.noreply.github.com>
Co-authored-by: justindar <justin.dar@smilecdr.com>
Co-authored-by: volodymyr-korzh <132366313+volodymyr-korzh@users.noreply.github.com>
Co-authored-by: Nathan Doef <n.doef@protonmail.com>
Co-authored-by: justin.mckelvy <justin.mckelvy@smilecdr.com>
Co-authored-by: Brenin Rhodes <brenin@alphora.com>
This commit is contained in:
Justin McKelvy 2023-09-22 17:51:36 -06:00 committed by GitHub
parent 0049319751
commit 6a0b2794eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
175 changed files with 26017 additions and 27843 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
@ -12,7 +12,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,6 @@
---
type: add
issue: 5089
title: "Updating storage-cr module to latest CQL 3.0.0, latest cql engine improvements, and Clinical Reasoning operations
to leverage repository api pattern. This will remove several dependencies from within hapi-fhir to make future maintenance
simpler and performance more robust."

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>hapi-deployable-pom</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.9.6-SNAPSHOT</version>
<version>6.9.7-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -77,43 +77,12 @@
</dependency>
<dependency>
<groupId>org.opencds.cqf.fhir</groupId>
<artifactId>cqf-fhir-api</artifactId>
<artifactId>cqf-fhir-cr</artifactId>
<version>${clinical-reasoning.version}</version>
</dependency>
<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>evaluator.fhir</artifactId>
<version>${clinical-reasoning.version}</version>
<exclusions>
<exclusion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.r4</artifactId>
</exclusion>
<exclusion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.r4b</artifactId>
</exclusion>
<exclusion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.r5</artifactId>
</exclusion>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
</exclusion>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
</exclusion>
<exclusion>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>evaluator.spring</artifactId>
<groupId>org.opencds.cqf.fhir</groupId>
<artifactId>cqf-fhir-jackson</artifactId>
<version>${clinical-reasoning.version}</version>
<exclusions>
<exclusion>
@ -124,40 +93,33 @@
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>evaluator.plandefinition</artifactId>
<version>${clinical-reasoning.version}</version>
<exclusions>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
</exclusion>
<exclusion>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>evaluator.jackson-deps</artifactId>
<version>${clinical-reasoning.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opencds.cqf.fhir</groupId>
<artifactId>cqf-fhir-cql</artifactId>
<version>${clinical-reasoning.version}</version>
<exclusions>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
</exclusion>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
</exclusion>
<exclusion>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
</exclusion>
<exclusion>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
</exclusion>
</exclusions>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.ogce</groupId>
<artifactId>xpp3</artifactId>

View File

@ -1,103 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.hl7.fhir.instance.model.api.IBaseResource;
import java.util.Iterator;
import java.util.List;
import javax.annotation.concurrent.NotThreadSafe;
/**
* This class leverages IBundleProvider Iterable to provide an iterator for processing bundle search results into manageable paginated chunks. This helped to avoid loading large result sets into lists
**/
@NotThreadSafe
public class BundleIterable implements Iterable<IBaseResource> {
private final IBundleProvider sourceBundleProvider;
private final RequestDetails requestDetails;
public BundleIterable(RequestDetails requestDetails, IBundleProvider bundleProvider) {
this.sourceBundleProvider = bundleProvider;
this.requestDetails = requestDetails;
}
@Override
public Iterator<IBaseResource> iterator() {
return new BundleIterator(this.requestDetails, this.sourceBundleProvider);
}
static class BundleIterator implements Iterator<IBaseResource> {
private IBundleProvider bundleProvider;
private int offset = 0;
private int increment = 50;
private List<IBaseResource> currentResourceList;
private final RequestDetails requestDetails;
private int currentResourceListIndex = 0;
public BundleIterator(RequestDetails requestDetails, IBundleProvider bundleProvider) {
this.bundleProvider = bundleProvider;
this.requestDetails = requestDetails;
initChunk();
}
private void initChunk() {
this.currentResourceList = this.bundleProvider.getResources(offset, increment + offset);
// next offset created
offset += increment;
// restart counter on new chunk
currentResourceListIndex = 0;
}
private void loadNextChunk() {
initChunk();
}
@Override
public boolean hasNext() {
// We still have things in the current chunk to return
if (this.currentResourceListIndex < this.currentResourceList.size()) {
return true;
} else if (this.currentResourceList.size() == 0) {
// no more resources!
return false;
}
// We need our next chunk
this.loadNextChunk();
return this.hasNext();
}
@Override
public IBaseResource next() {
assert this.currentResourceListIndex < this.currentResourceList.size();
var result = this.currentResourceList.get(this.currentResourceListIndex);
this.currentResourceListIndex++;
return result;
}
}
}

View File

@ -25,11 +25,11 @@ import ca.uhn.fhir.jpa.cache.IResourceChangeEvent;
import ca.uhn.fhir.jpa.cache.IResourceChangeListener;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.cqframework.cql.elm.execution.VersionedIdentifier;
import org.hl7.elm.r1.VersionedIdentifier;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.opencds.cqf.cql.engine.runtime.Code;
import org.opencds.cqf.cql.evaluator.fhir.util.Reflections;
import org.opencds.cqf.fhir.utility.Reflections;
import java.util.Collection;
import java.util.List;

View File

@ -1,118 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.opencds.cqf.cql.engine.exception.CqlException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This class represents clinical reasoning interceptor used for cql exception handling and logging
**/
@Interceptor
public class CqlExceptionHandlingInterceptor {
@Hook(Pointcut.SERVER_HANDLE_EXCEPTION)
public boolean handleException(
RequestDetails theRequestDetails,
BaseServerResponseException theException,
HttpServletRequest theServletRequest,
HttpServletResponse theServletResponse)
throws IOException {
CqlException cqlException = getCqlException(theException);
if (cqlException == null) {
return true;
}
IBaseOperationOutcome operationOutcome = theException.getOperationOutcome();
if (operationOutcome != null) {
String cqlMessage = this.getCqlMessage(cqlException);
switch (operationOutcome.getStructureFhirVersionEnum()) {
case DSTU3:
updateOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) operationOutcome, cqlMessage);
break;
case R4:
updateOutcome((org.hl7.fhir.r4.model.OperationOutcome) operationOutcome, cqlMessage);
break;
case R5:
updateOutcome((org.hl7.fhir.r5.model.OperationOutcome) operationOutcome, cqlMessage);
break;
default:
break;
}
}
return true;
}
private void updateOutcome(org.hl7.fhir.dstu3.model.OperationOutcome theOperationOutcome, String theCqlCause) {
theOperationOutcome.getIssueFirstRep().setDiagnostics(theCqlCause);
}
private void updateOutcome(org.hl7.fhir.r4.model.OperationOutcome theOperationOutcome, String theCqlCause) {
theOperationOutcome.getIssueFirstRep().setDiagnostics(theCqlCause);
}
private void updateOutcome(org.hl7.fhir.r5.model.OperationOutcome theOperationOutcome, String theCqlCause) {
theOperationOutcome.getIssueFirstRep().setDiagnostics(theCqlCause);
}
private String getCqlMessage(CqlException theCqlException) {
String message = theCqlException.getMessage();
if (theCqlException.getSourceLocator() != null) {
message += "\nat CQL source location: "
+ theCqlException.getSourceLocator().toString();
}
if (theCqlException.getCause() != null) {
message += "\ncaused by: " + theCqlException.getCause().getMessage();
}
return message;
}
private CqlException getCqlException(BaseServerResponseException theException) {
if (theException.getCause() instanceof CqlException) {
return (CqlException) theException.getCause();
} else if (theException.getCause() instanceof InvocationTargetException) {
InvocationTargetException ite = (InvocationTargetException) theException.getCause();
if (ite.getCause() instanceof CqlException) {
return (CqlException) ite.getCause();
}
if (ite.getTargetException() instanceof CqlException) {
return (CqlException) ite.getTargetException();
}
}
return null;
}
}

View File

@ -1,45 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory;
import java.util.concurrent.ForkJoinWorkerThread;
/**
* This class resolves issues with loading JAXB in a server environment and using CompletableFutures
* https://stackoverflow.com/questions/49113207/completablefuture-forkjoinpool-set-class-loader
**/
public class CqlForkJoinWorkerThreadFactory implements ForkJoinWorkerThreadFactory {
@Override
public final ForkJoinWorkerThread newThread(ForkJoinPool thePool) {
return new CqlForkJoinWorkerThread(thePool);
}
private static class CqlForkJoinWorkerThread extends ForkJoinWorkerThread {
private CqlForkJoinWorkerThread(final ForkJoinPool thePool) {
super(thePool);
// set the correct classloader here
setContextClassLoader(Thread.currentThread().getContextClassLoader());
}
}
}

View File

@ -25,11 +25,11 @@ import ca.uhn.fhir.jpa.cache.IResourceChangeEvent;
import ca.uhn.fhir.jpa.cache.IResourceChangeListener;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.cqframework.cql.elm.execution.Library;
import org.cqframework.cql.elm.execution.VersionedIdentifier;
import org.cqframework.cql.cql2elm.model.CompiledLibrary;
import org.hl7.elm.r1.VersionedIdentifier;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.opencds.cqf.cql.evaluator.fhir.util.Reflections;
import org.opencds.cqf.fhir.utility.Reflections;
import java.util.Collection;
import java.util.List;
@ -45,12 +45,12 @@ public class ElmCacheResourceChangeListener implements IResourceChangeListener {
org.slf4j.LoggerFactory.getLogger(ElmCacheResourceChangeListener.class);
private final IFhirResourceDao<?> myLibraryDao;
private final Map<VersionedIdentifier, Library> myGlobalLibraryCache;
private final Map<VersionedIdentifier, CompiledLibrary> myGlobalLibraryCache;
private final Function<IBaseResource, String> myNameFunction;
private final Function<IBaseResource, String> myVersionFunction;
public ElmCacheResourceChangeListener(
DaoRegistry theDaoRegistry, Map<VersionedIdentifier, Library> theGlobalLibraryCache) {
DaoRegistry theDaoRegistry, Map<VersionedIdentifier, CompiledLibrary> theGlobalLibraryCache) {
this.myLibraryDao = theDaoRegistry.getResourceDao("Library");
this.myGlobalLibraryCache = theGlobalLibraryCache;
this.myNameFunction = Reflections.getNameFunction(myLibraryDao.getResourceType());

View File

@ -1,104 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.opencds.cqf.cql.evaluator.fhir.dal.FhirDal;
@SuppressWarnings("unchecked")
/**
* This class leverages DaoRegistry from Hapi-fhir to implement CRUD FHIR API operations constrained to provide only the operations necessary for the cql-evaluator modules to function.
**/
public class HapiFhirDal implements FhirDal {
protected final DaoRegistry myDaoRegistry;
protected final RequestDetails myRequestDetails;
public HapiFhirDal(DaoRegistry theDaoRegistry) {
this(theDaoRegistry, null);
}
public HapiFhirDal(DaoRegistry theDaoRegistry, RequestDetails theRequestDetails) {
this.myDaoRegistry = theDaoRegistry;
this.myRequestDetails = theRequestDetails;
}
@Override
public void create(IBaseResource theResource) {
this.myDaoRegistry.getResourceDao(theResource.fhirType()).create(theResource, myRequestDetails);
}
@Override
public IBaseResource read(IIdType theId) {
return this.myDaoRegistry.getResourceDao(theId.getResourceType()).read(theId, myRequestDetails);
}
@Override
public void update(IBaseResource theResource) {
this.myDaoRegistry.getResourceDao(theResource.fhirType()).update(theResource, myRequestDetails);
}
@Override
public void delete(IIdType theId) {
this.myDaoRegistry.getResourceDao(theId.getResourceType()).delete(theId, myRequestDetails);
}
// TODO: the search interfaces need some work
@Override
public Iterable<IBaseResource> search(String theResourceType) {
var b = this.myDaoRegistry.getResourceDao(theResourceType).search(new SearchParameterMap(), myRequestDetails);
return new BundleIterable(myRequestDetails, b);
}
@Override
public Iterable<IBaseResource> searchByUrl(String theResourceType, String theUrl) {
// version example "http://content.smilecdr.com/fhir/dqm/Library/ImmunizationStatusRoutine|2.0.1"
if (theUrl.contains("|")) {
String[] urlSplit = theUrl.split("\\|");
String urlBase = urlSplit[0];
String urlVersion = urlSplit[1];
IBundleProvider versionResource = this.myDaoRegistry
.getResourceDao(theResourceType)
.search(
SearchParameterMap.newSynchronous()
.add("url", new UriParam(urlBase))
.add("version", new TokenParam(urlVersion)),
new SystemRequestDetails());
return new BundleIterable(myRequestDetails, versionResource);
} else {
// standard example "http://content.smilecdr.com/fhir/dqm/Library/ImmunizationStatusRoutine"
IBundleProvider standardResource = this.myDaoRegistry
.getResourceDao(theResourceType)
.search(
SearchParameterMap.newSynchronous().add("url", new UriParam(theUrl)),
new SystemRequestDetails());
return new BundleIterable(myRequestDetails, standardResource);
}
}
}

View File

@ -1,166 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.cql.engine.fhir.retrieve.SearchParamFhirRetrieveProvider;
import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterMap;
import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
/**
* This class provides an implementation of the cql-engine's RetrieveProvider
* interface which is used for loading
* data during CQL evaluation.
*/
public class HapiFhirRetrieveProvider extends SearchParamFhirRetrieveProvider implements IDaoRegistryUser {
private static final Logger logger = LoggerFactory.getLogger(HapiFhirRetrieveProvider.class);
private final DaoRegistry myDaoRegistry;
private final RequestDetails myRequestDetails;
public HapiFhirRetrieveProvider(DaoRegistry theDaoRegistry, SearchParameterResolver theSearchParameterResolver) {
this(theDaoRegistry, theSearchParameterResolver, new SystemRequestDetails());
}
public HapiFhirRetrieveProvider(
DaoRegistry registry, SearchParameterResolver searchParameterResolver, RequestDetails requestDetails) {
super(searchParameterResolver);
this.myDaoRegistry = registry;
this.myRequestDetails = requestDetails;
}
/**
* The queryIterable class provides an Iterable to cycle through a series of search queries and results of those queries, implementation of this avoided loading all resources into a list.
*/
static class QueryIterable implements Iterable<Object> {
private final String dataType;
private final List<SearchParameterMap> queries;
private final BiFunction<String, SearchParameterMap, Iterable<IBaseResource>> queryFunc;
public QueryIterable(
String dataType,
List<SearchParameterMap> queries,
BiFunction<String, SearchParameterMap, Iterable<IBaseResource>> queryFunc) {
this.dataType = dataType;
this.queries = queries;
this.queryFunc = queryFunc;
}
static class QueryIterator implements Iterator<Object> {
private final String dataType;
private final List<SearchParameterMap> queries;
private final BiFunction<String, SearchParameterMap, Iterable<IBaseResource>> queryFunc;
Iterator<IBaseResource> currentResult = null;
public QueryIterator(
String dataType,
List<SearchParameterMap> queries,
BiFunction<String, SearchParameterMap, Iterable<IBaseResource>> queryFunc) {
this.dataType = dataType;
this.queries = queries;
this.queryFunc = queryFunc;
}
private int index = 0;
@Override
public boolean hasNext() {
// initial load of first query results
if (currentResult == null) {
currentResult = loadNext();
}
// loop through all batches of results
// when query results exhaust load next query
while (currentResult != null && !currentResult.hasNext()) {
currentResult = loadNext();
}
// hasNext on current query result
return currentResult != null && currentResult.hasNext();
}
@Override
public Object next() {
return currentResult.next();
}
Iterator<IBaseResource> loadNext() {
// check to make sure there are more queries remaining
if (index >= queries.size()) {
return null;
}
// extract next query result
var result = this.queryFunc.apply(dataType, queries.get(index)).iterator();
index++;
return result;
}
}
public Iterator<Object> iterator() {
return new QueryIterator(dataType, queries, queryFunc);
}
}
@Override
protected Iterable<Object> executeQueries(String dataType, List<SearchParameterMap> queries) {
if (queries == null || queries.isEmpty()) {
return Collections.emptyList();
}
return new QueryIterable(dataType, queries, this::executeQuery);
}
protected Iterable<IBaseResource> executeQuery(String dataType, SearchParameterMap map) {
ca.uhn.fhir.jpa.searchparam.SearchParameterMap hapiMap = new ca.uhn.fhir.jpa.searchparam.SearchParameterMap();
try {
for (Map.Entry<String, List<List<IQueryParameterType>>> entry : map.entrySet()) {
hapiMap.put(entry.getKey(), entry.getValue());
}
} catch (Exception e) {
logger.warn("Error converting search parameter map", e);
}
return search(getClass(dataType), hapiMap, myRequestDetails);
}
@Override
public DaoRegistry getDaoRegistry() {
return this.myDaoRegistry;
}
}

View File

@ -1,85 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.cqframework.cql.cql2elm.LibraryContentType;
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
import org.hl7.elm.r1.VersionedIdentifier;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.cql.evaluator.fhir.util.Libraries;
import org.opencds.cqf.cql.evaluator.fhir.util.Versions;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
/**
* This class provides an implementation of the cql-translator's LibrarySourceProvider
* interface which is used for loading
* library resources during CQL evaluation.
*/
public class HapiLibrarySourceProvider implements LibrarySourceProvider, IDaoRegistryUser {
protected final DaoRegistry myDaoRegistry;
protected final RequestDetails myRequestDetails;
public HapiLibrarySourceProvider(DaoRegistry theDaoRegistry) {
this(theDaoRegistry, null);
}
public HapiLibrarySourceProvider(DaoRegistry theDaoRegistry, RequestDetails theRequestDetails) {
this.myDaoRegistry = theDaoRegistry;
this.myRequestDetails = theRequestDetails;
}
@Override
public DaoRegistry getDaoRegistry() {
return this.myDaoRegistry;
}
@Override
public InputStream getLibraryContent(
VersionedIdentifier theLibraryIdentifier, LibraryContentType theLibraryContentType) {
String name = theLibraryIdentifier.getId();
String version = theLibraryIdentifier.getVersion();
var libraries = search(getClass("Library"), Searches.byName(name), myRequestDetails);
var libraryList = new ArrayList<IBaseResource>();
for (var l : libraries) {
libraryList.add(l);
}
IBaseResource library = Versions.selectByVersion(libraryList, version, Libraries::getVersion);
if (library == null) {
return null;
}
byte[] content = Libraries.getContent(library, theLibraryContentType.mimeType());
if (content == null) {
return null;
}
return new ByteArrayInputStream(content);
}
@Override
public InputStream getLibrarySource(VersionedIdentifier libraryIdentifier) {
return this.getLibraryContent(libraryIdentifier, LibraryContentType.CQL);
}
}

View File

@ -1,196 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.IValidationSupport.LookupCodeResult;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.cqframework.cql.elm.execution.VersionedIdentifier;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.cql.engine.runtime.Code;
import org.opencds.cqf.cql.engine.terminology.CodeSystemInfo;
import org.opencds.cqf.cql.engine.terminology.TerminologyProvider;
import org.opencds.cqf.cql.engine.terminology.ValueSetInfo;
import org.opencds.cqf.cql.evaluator.fhir.util.Canonicals;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* This class provides an implementation of the cql-engine's TerminologyProvider
* interface, which is used for Terminology operations
* in CQL
*/
public class HapiTerminologyProvider implements TerminologyProvider {
private final IValidationSupport myValidationSupport;
private final Map<VersionedIdentifier, List<Code>> myGlobalCodeCache;
public HapiTerminologyProvider(
IValidationSupport theValidationSupport, Map<VersionedIdentifier, List<Code>> theGlobalCodeCache) {
this(theValidationSupport, theGlobalCodeCache, null);
}
public HapiTerminologyProvider(
IValidationSupport theValidationSupport,
Map<VersionedIdentifier, List<Code>> theGlobalCodeCache,
RequestDetails theRequestDetails) {
myValidationSupport = theValidationSupport;
myGlobalCodeCache = theGlobalCodeCache;
}
@Override
public boolean in(Code code, ValueSetInfo valueSet) throws ResourceNotFoundException {
for (Code c : expand(valueSet)) {
if (c == null) {
continue;
}
if (c.getCode().equals(code.getCode()) && c.getSystem().equals(code.getSystem())) {
return true;
}
}
return false;
}
@Override
public Iterable<Code> expand(ValueSetInfo theValueSet) throws ResourceNotFoundException {
// This could possibly be refactored into a single call to the underlying HAPI
// Terminology service. Need to think through that..,
VersionedIdentifier vsId =
new VersionedIdentifier().withId(theValueSet.getId()).withVersion(theValueSet.getVersion());
if (this.myGlobalCodeCache.containsKey(vsId)) {
return this.myGlobalCodeCache.get(vsId);
}
ValueSetExpansionOptions valueSetExpansionOptions = new ValueSetExpansionOptions();
valueSetExpansionOptions.setFailOnMissingCodeSystem(false);
valueSetExpansionOptions.setCount(Integer.MAX_VALUE);
if (theValueSet.getVersion() != null
&& Canonicals.getUrl(theValueSet.getId()) != null
&& Canonicals.getVersion(theValueSet.getId()) == null) {
theValueSet.setId(theValueSet.getId() + "|" + theValueSet.getVersion());
}
IValidationSupport.ValueSetExpansionOutcome vs = myValidationSupport.expandValueSet(
new ValidationSupportContext(myValidationSupport), valueSetExpansionOptions, theValueSet.getId());
List<Code> codes = getCodes(vs.getValueSet());
this.myGlobalCodeCache.put(vsId, codes);
return codes;
}
@Override
public Code lookup(Code theCode, CodeSystemInfo theCodeSystem) throws ResourceNotFoundException {
LookupCodeResult cs = myValidationSupport.lookupCode(
new ValidationSupportContext(myValidationSupport), theCodeSystem.getId(), theCode.getCode());
if (cs != null) {
theCode.setDisplay(cs.getCodeDisplay());
}
theCode.setSystem(theCodeSystem.getId());
return theCode;
}
protected List<Code> getCodes(IBaseResource theValueSet) {
FhirVersionEnum version = theValueSet.getStructureFhirVersionEnum();
switch (version) {
case DSTU2_1:
return getCodesDstu21((org.hl7.fhir.dstu2016may.model.ValueSet) theValueSet);
case DSTU2_HL7ORG:
return getCodesDstu2Hl7((org.hl7.fhir.dstu2.model.ValueSet) theValueSet);
case DSTU3:
return getCodesDstu3((org.hl7.fhir.dstu3.model.ValueSet) theValueSet);
case R4:
return getCodesR4((org.hl7.fhir.r4.model.ValueSet) theValueSet);
case R4B:
return getCodesR4B((org.hl7.fhir.r4b.model.ValueSet) theValueSet);
case R5:
return getCodesR5((org.hl7.fhir.r5.model.ValueSet) theValueSet);
default:
throw new IllegalArgumentException(Msg.code(2225)
+ String.format("FHIR version %s is unsupported.", version.getFhirVersionString()));
}
}
protected List<Code> getCodesDstu2Hl7(org.hl7.fhir.dstu2.model.ValueSet theValueSet) {
var codes = new ArrayList<Code>();
for (var vse : theValueSet.getExpansion().getContains()) {
codes.add(new Code().withCode(vse.getCode()).withSystem(vse.getSystem()));
}
return codes;
}
protected List<Code> getCodesDstu21(org.hl7.fhir.dstu2016may.model.ValueSet theValueSet) {
var codes = new ArrayList<Code>();
for (var vse : theValueSet.getExpansion().getContains()) {
codes.add(new Code().withCode(vse.getCode()).withSystem(vse.getSystem()));
}
return codes;
}
protected List<Code> getCodesDstu3(org.hl7.fhir.dstu3.model.ValueSet theValueSet) {
var codes = new ArrayList<Code>();
for (var vse : theValueSet.getExpansion().getContains()) {
codes.add(new Code().withCode(vse.getCode()).withSystem(vse.getSystem()));
}
return codes;
}
protected List<Code> getCodesR4(org.hl7.fhir.r4.model.ValueSet theValueSet) {
var codes = new ArrayList<Code>();
for (var vse : theValueSet.getExpansion().getContains()) {
codes.add(new Code().withCode(vse.getCode()).withSystem(vse.getSystem()));
}
return codes;
}
protected List<Code> getCodesR4B(org.hl7.fhir.r4b.model.ValueSet theValueSet) {
var codes = new ArrayList<Code>();
for (var vse : theValueSet.getExpansion().getContains()) {
codes.add(new Code().withCode(vse.getCode()).withSystem(vse.getSystem()));
}
return codes;
}
protected List<Code> getCodesR5(org.hl7.fhir.r5.model.ValueSet theValueSet) {
var codes = new ArrayList<Code>();
for (var vse : theValueSet.getExpansion().getContains()) {
codes.add(new Code().withCode(vse.getCode()).withSystem(vse.getSystem()));
}
return codes;
}
}

View File

@ -1,33 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.cql.engine.data.DataProvider;
import org.opencds.cqf.cql.engine.terminology.TerminologyProvider;
/**
* Single abstract method interface to provide ability to create a DataProvider based of
* RequestDetails and TerminologyProvider
*/
@FunctionalInterface
public interface IDataProviderFactory {
DataProvider create(RequestDetails theRequestDetails, TerminologyProvider theTerminologyProvider);
}

View File

@ -1,29 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
import org.opencds.cqf.cql.engine.execution.LibraryLoader;
import java.util.List;
public interface ILibraryLoaderFactory {
LibraryLoader create(List<LibrarySourceProvider> theLibraryContentProviders);
}

View File

@ -1,29 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
import java.util.List;
public interface ILibraryManagerFactory {
LibraryManager create(List<LibrarySourceProvider> theLibraryContentProviders);
}

View File

@ -1,67 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* This class provides an implementation of IValidationSupport
* interface which is used for validation of terminology services.
*/
public class PreExpandedValidationSupport implements IValidationSupport {
private final FhirContext myFhirContext;
public PreExpandedValidationSupport(FhirContext theFhirContext) {
this.myFhirContext = theFhirContext;
}
@Override
public ValueSetExpansionOutcome expandValueSet(
ValidationSupportContext theValidationSupportContext,
@Nullable ValueSetExpansionOptions theExpansionOptions,
@Nonnull IBaseResource theValueSetToExpand) {
Validate.notNull(theValueSetToExpand, "theValueSetToExpand must not be null or blank");
if (!getFhirContext()
.getResourceDefinition("ValueSet")
.getChildByName("expansion")
.getAccessor()
.getValues(theValueSetToExpand)
.isEmpty()) {
return new ValueSetExpansionOutcome(theValueSetToExpand);
} else {
return IValidationSupport.super.expandValueSet(
theValidationSupportContext, theExpansionOptions, theValueSetToExpand);
}
}
@Override
public FhirContext getFhirContext() {
return this.myFhirContext;
}
}

View File

@ -1,252 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriOrListParam;
import ca.uhn.fhir.rest.param.UriParam;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.opencds.cqf.cql.evaluator.fhir.util.Canonicals;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Utility class for parameter search
*/
public class Searches {
private static final String VERSION_SP = "version";
private static final String URL_SP = "url";
private static final String NAME_SP = "name";
private static final String ID_SP = "_id";
/**
* Constructor
*/
private Searches() {}
/**
* Creates and returns Parameter search results
*/
public static SearchParameterMap all() {
return new SearchParameterMap();
}
/**
* Method to return a SearchParameterMap which has parameters name and type
*
* @param theParamName String of parameter name
* @param theParam IQuery parameter type
* @return a SearchParameterMap
*/
public static SearchParameterMap byParam(String theParamName, IQueryParameterType theParam) {
checkNotNull(theParamName);
checkNotNull(theParam);
return all().add(theParamName, theParam);
}
/**
* Method to return a SearchParameterMap which has parameter name
*
* @param theName String of parameter name
* @return a SearchParameterMap
*/
public static SearchParameterMap byName(String theName) {
checkNotNull(theName);
return byParam(NAME_SP, new StringParam(theName, true));
}
/**
* Method to return a SearchParameterMap which has parameters name and version
*
* @param theName String of parameter name
* @param theVersion String of code version
* @return a SearchParameterMap
*/
public static SearchParameterMap byName(String theName, String theVersion) {
checkNotNull(theName);
checkNotNull(theVersion);
return byName(theName).add(VERSION_SP, new TokenParam(theVersion));
}
/**
* Method to return a SearchParameterMap which has parameters url and version
*
* @param theUrl String of the url
* @param theVersion String of code version
* @return a SearchParameterMap
*/
public static SearchParameterMap byUrlAndVersion(String theUrl, String theVersion) {
checkNotNull(theUrl);
checkNotNull(theVersion);
return byParam(URL_SP, new UriParam(theUrl)).add(VERSION_SP, new TokenParam(theVersion));
}
/**
* Method to return a SearchParameterMap which has parameter url
*
* @param theUrl String of the url
* @return a SearchParameterMap
*/
public static SearchParameterMap byUrl(String theUrl) {
checkNotNull(theUrl);
return byParam(URL_SP, new UriParam(theUrl));
}
/**
* Method to return a SearchParameterMap which has parameter of list of urls
*
* @param theUrls list of URL strings
* @return SearchParameterMap
*/
// TODO: versioned version
public static SearchParameterMap byUrls(List<String> theUrls) {
checkNotNull(theUrls);
UriOrListParam params = new UriOrListParam();
theUrls.forEach(theUrl -> {
checkNotNull(theUrl);
params.addOr(new UriParam(theUrl));
});
return all().add(ID_SP, params);
}
/**
* Method to return a SearchParameterMap which has parameter of canonical search string
*
* @param theCanonical a string representing the canonical
* @return SearchParameterMap
*/
public static SearchParameterMap byCanonical(String theCanonical) {
checkNotNull(theCanonical);
SearchParameterMap search = byUrl(Canonicals.getUrl(theCanonical));
String version = Canonicals.getVersion(theCanonical);
if (version != null) {
search.add(VERSION_SP, new TokenParam(version));
}
return search;
}
/**
* Method to return a SearchParameterMap which has parameter of canonical type
*
* @param theCanonicalType a variable representing the canonical type
* @return SearchParameterMap by canonical type
*/
public static <C extends IPrimitiveType<String>> SearchParameterMap byCanonical(C theCanonicalType) {
checkNotNull(theCanonicalType);
checkArgument(theCanonicalType.hasValue());
return byCanonical(theCanonicalType.getValue());
}
/**
* Method to return a SearchParameterMap which has parameters of canonical search string and version
*
* @param theCanonical a string representing the canonical
* @param version a string representing the version
* @return SearchParameterMap
*/
public static SearchParameterMap byCanonical(String theCanonical, String version) {
checkNotNull(theCanonical);
SearchParameterMap search = byUrl(Canonicals.getUrl(theCanonical));
if (version != null) {
search.add(VERSION_SP, new TokenParam(version));
}
return search;
}
/**
* Method to return a SearchParameterMap which has parameter of list of canonical types
*
* @param theCanonicalTypes a variable representing list of the canonical type
* @return SearchParameterMap by canonical type
*/
// TODO: use versioned version
public static <C extends IPrimitiveType<String>> SearchParameterMap byCanonicals(List<C> theCanonicalTypes) {
checkNotNull(theCanonicalTypes);
List<String> urls = new ArrayList<>();
theCanonicalTypes.forEach(canonicalType -> {
checkArgument(canonicalType.hasValue());
urls.add(canonicalType.getValue());
});
return byUrls(urls);
}
/**
* Method to return a SearchParameterMap which has parameter of IIdType
*
* @param theId IID Type variable representing measure ID
* @return SearchParameterMap matching Id
*/
public static SearchParameterMap byId(IIdType theId) {
checkNotNull(theId);
return byParam(ID_SP, new TokenParam(theId.getIdPart()));
}
/**
* Method to return a SearchParameterMap which has parameter of IIdType
*
* @param theIdPart String representing theID
* @return SearchParameterMap matching theID
*/
public static SearchParameterMap byId(String theIdPart) {
checkNotNull(theIdPart);
return byParam(ID_SP, new TokenParam(theIdPart));
}
/**
* Method to return a SearchParameterMap which has parameter of list of IIdType
*
* @param theIdParts String representing theID
* @return SearchParameterMap matching theID
*/
public static SearchParameterMap byIds(List<String> theIdParts) {
checkNotNull(theIdParts);
TokenOrListParam params = new TokenOrListParam();
theIdParts.forEach(theIdPart -> {
checkNotNull(theIdPart);
params.addOr(new TokenParam(theIdPart));
});
return all().add(ID_SP, params);
}
}

View File

@ -1,236 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.cr.common.CodeCacheResourceChangeListener;
import ca.uhn.fhir.cr.common.CqlExceptionHandlingInterceptor;
import ca.uhn.fhir.cr.common.CqlForkJoinWorkerThreadFactory;
import ca.uhn.fhir.cr.common.ElmCacheResourceChangeListener;
import ca.uhn.fhir.cr.common.HapiFhirDal;
import ca.uhn.fhir.cr.common.HapiFhirRetrieveProvider;
import ca.uhn.fhir.cr.common.HapiLibrarySourceProvider;
import ca.uhn.fhir.cr.common.HapiTerminologyProvider;
import ca.uhn.fhir.cr.common.IDataProviderFactory;
import ca.uhn.fhir.cr.common.IFhirDalFactory;
import ca.uhn.fhir.cr.common.ILibrarySourceProviderFactory;
import ca.uhn.fhir.cr.common.ITerminologyProviderFactory;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import org.cqframework.cql.cql2elm.ModelManager;
import org.cqframework.cql.cql2elm.model.Model;
import org.hl7.cql.model.ModelIdentifier;
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.opencds.cqf.cql.engine.data.CompositeDataProvider;
import org.opencds.cqf.cql.engine.fhir.model.Dstu3FhirModelResolver;
import org.opencds.cqf.cql.engine.fhir.model.R4FhirModelResolver;
import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver;
import org.opencds.cqf.cql.engine.model.ModelResolver;
import org.opencds.cqf.cql.engine.runtime.Code;
import org.opencds.cqf.cql.evaluator.builder.DataProviderComponents;
import org.opencds.cqf.cql.evaluator.builder.EndpointInfo;
import org.opencds.cqf.cql.evaluator.cql2elm.util.LibraryVersionSelector;
import org.opencds.cqf.cql.evaluator.engine.model.CachingModelResolverDecorator;
import org.opencds.cqf.cql.evaluator.engine.retrieve.BundleRetrieveProvider;
import org.opencds.cqf.cql.evaluator.fhir.Constants;
import org.opencds.cqf.cql.evaluator.fhir.adapter.AdapterFactory;
import org.opencds.cqf.cql.evaluator.spring.fhir.adapter.AdapterConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;
import org.springframework.security.concurrent.DelegatingSecurityContextExecutor;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.ForkJoinPool;
@Configuration
@Import({AdapterConfiguration.class, BaseRepositoryConfig.class})
public abstract class BaseClinicalReasoningConfig {
private static final Logger ourLogger = LoggerFactory.getLogger(BaseClinicalReasoningConfig.class);
@Bean
@Scope("prototype")
public ModelManager modelManager(Map<ModelIdentifier, Model> theGlobalModelCache) {
return new ModelManager(theGlobalModelCache);
}
@Bean
public CqlExceptionHandlingInterceptor cqlExceptionHandlingInterceptor() {
return new CqlExceptionHandlingInterceptor();
}
@Bean
public SearchParameterResolver searchParameterResolver(FhirContext theFhirContext) {
return new SearchParameterResolver(theFhirContext);
}
@Bean
IFhirDalFactory fhirDalFactory(DaoRegistry theDaoRegistry) {
return rd -> new HapiFhirDal(theDaoRegistry, rd);
}
@Bean
IDataProviderFactory dataProviderFactory(
ModelResolver theModelResolver,
DaoRegistry theDaoRegistry,
SearchParameterResolver theSearchParameterResolver) {
return (rd, t) -> {
HapiFhirRetrieveProvider provider =
new HapiFhirRetrieveProvider(theDaoRegistry, theSearchParameterResolver, rd);
if (t != null) {
provider.setTerminologyProvider(t);
provider.setExpandValueSets(true);
provider.setMaxCodesPerQuery(500);
provider.setQueryBatchThreshold(500);
provider.setModelResolver(theModelResolver);
}
return new CompositeDataProvider(theModelResolver, provider);
};
}
@Bean
org.opencds.cqf.cql.evaluator.builder.DataProviderFactory builderDataProviderFactory(
FhirContext theFhirContext, ModelResolver theModelResolver) {
return new org.opencds.cqf.cql.evaluator.builder.DataProviderFactory() {
@Override
public DataProviderComponents create(EndpointInfo theEndpointInfo) {
// to do implement endpoint
return null;
}
@Override
public DataProviderComponents create(IBaseBundle theDataBundle) {
return new DataProviderComponents(
Constants.FHIR_MODEL_URI,
theModelResolver,
new BundleRetrieveProvider(theFhirContext, theDataBundle));
}
};
}
@Bean
public HapiFhirRetrieveProvider fhirRetrieveProvider(
DaoRegistry theDaoRegistry, SearchParameterResolver theSearchParameterResolver) {
return new HapiFhirRetrieveProvider(theDaoRegistry, theSearchParameterResolver);
}
@Bean
public ITerminologyProviderFactory terminologyProviderFactory(
IValidationSupport theValidationSupport,
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, List<Code>> theGlobalCodeCache) {
return rd -> new HapiTerminologyProvider(theValidationSupport, theGlobalCodeCache, rd);
}
@Bean
ILibrarySourceProviderFactory librarySourceProviderFactory(DaoRegistry theDaoRegistry) {
return rd -> new HapiLibrarySourceProvider(theDaoRegistry, rd);
}
// TODO: Use something like caffeine caching for this so that growth is limited.
@Bean
public Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library>
globalLibraryCache() {
return new ConcurrentHashMap<>();
}
@Bean
public Map<org.cqframework.cql.elm.execution.VersionedIdentifier, List<Code>> globalCodeCache() {
return new ConcurrentHashMap<>();
}
@Bean
public Map<ModelIdentifier, Model> globalModelCache() {
return new ConcurrentHashMap<>();
}
@Bean
@Primary
public ElmCacheResourceChangeListener elmCacheResourceChangeListener(
IResourceChangeListenerRegistry theResourceChangeListenerRegistry,
DaoRegistry theDaoRegistry,
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library>
theGlobalLibraryCache) {
ElmCacheResourceChangeListener listener =
new ElmCacheResourceChangeListener(theDaoRegistry, theGlobalLibraryCache);
theResourceChangeListenerRegistry.registerResourceResourceChangeListener(
"Library", SearchParameterMap.newSynchronous(), listener, 1000);
return listener;
}
@Bean
@Primary
public CodeCacheResourceChangeListener codeCacheResourceChangeListener(
IResourceChangeListenerRegistry theResourceChangeListenerRegistry,
DaoRegistry theDaoRegistry,
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, List<Code>> theGlobalCodeCache) {
CodeCacheResourceChangeListener listener =
new CodeCacheResourceChangeListener(theDaoRegistry, theGlobalCodeCache);
theResourceChangeListenerRegistry.registerResourceResourceChangeListener(
"ValueSet", SearchParameterMap.newSynchronous(), listener, 1000);
return listener;
}
@Bean
public ModelResolver modelResolver(FhirContext theFhirContext) {
switch (theFhirContext.getVersion().getVersion()) {
case R4:
return new CachingModelResolverDecorator(new R4FhirModelResolver());
case DSTU3:
return new CachingModelResolverDecorator(new Dstu3FhirModelResolver());
default:
throw new IllegalStateException(
Msg.code(2224)
+ "CQL support not yet implemented for this FHIR version. Please change versions or disable the CQL plugin.");
}
}
@Bean
public LibraryVersionSelector libraryVersionSelector(AdapterFactory theAdapterFactory) {
return new LibraryVersionSelector(theAdapterFactory);
}
@Bean
public Executor cqlExecutor() {
CqlForkJoinWorkerThreadFactory factory = new CqlForkJoinWorkerThreadFactory();
ForkJoinPool myCommonPool =
new ForkJoinPool(Math.min(32767, Runtime.getRuntime().availableProcessors()), factory, null, false);
return new DelegatingSecurityContextExecutor(myCommonPool, SecurityContextHolder.getContext());
}
@Bean
public PreExpandedValidationSupportLoader preExpandedValidationSupportLoader(
ValidationSupportChain theSupportChain, FhirContext theFhirContext) {
return new PreExpandedValidationSupportLoader(theSupportChain, theFhirContext);
}
}

View File

@ -1,54 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config;
public class CareGapsProperties {
private boolean myThreadedCareGapsEnabled = true;
private String myCareGapsReporter;
private String myCareGapsCompositionSectionAuthor;
public boolean getThreadedCareGapsEnabled() {
return myThreadedCareGapsEnabled;
}
public void setThreadedCareGapsEnabled(boolean theThreadedCareGapsEnabled) {
myThreadedCareGapsEnabled = theThreadedCareGapsEnabled;
}
public boolean isThreadedCareGapsEnabled() {
return myThreadedCareGapsEnabled;
}
public String getCareGapsReporter() {
return myCareGapsReporter;
}
public void setCareGapsReporter(String theCareGapsReporter) {
myCareGapsReporter = theCareGapsReporter;
}
public String getCareGapsCompositionSectionAuthor() {
return myCareGapsCompositionSectionAuthor;
}
public void setCareGapsCompositionSectionAuthor(String theCareGapsCompositionSectionAuthor) {
myCareGapsCompositionSectionAuthor = theCareGapsCompositionSectionAuthor;
}
}

View File

@ -1,35 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.cr.common.PreExpandedValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
/**
* This class loads the validation of terminology services.
*/
public class PreExpandedValidationSupportLoader {
public PreExpandedValidationSupportLoader(
ValidationSupportChain theValidationSupportChain, FhirContext theFhirContext) {
var preExpandedValidationSupport = new PreExpandedValidationSupport(theFhirContext);
theValidationSupportChain.addValidationSupport(0, preExpandedValidationSupport);
}
}

View File

@ -27,9 +27,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public abstract class BaseRepositoryConfig {
public class RepositoryConfig {
@Bean
IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry) {
return rd -> new HapiFhirRepository(theDaoRegistry, rd, (RestfulServer) rd.getServer());
IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry, RestfulServer theRestfulServer) {
return rd -> new HapiFhirRepository(theDaoRegistry, rd, theRestfulServer);
}
}

View File

@ -0,0 +1,75 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.dstu3;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class ApplyOperationConfig {
@Bean
ca.uhn.fhir.cr.dstu3.IActivityDefinitionProcessorFactory dstu3ActivityDefinitionProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.activitydefinition.dstu3.ActivityDefinitionProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory dstu3PlanDefinitionProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.dstu3.PlanDefinitionProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.dstu3.activitydefinition.ActivityDefinitionApplyProvider dstu3ActivityDefinitionApplyProvider() {
return new ca.uhn.fhir.cr.dstu3.activitydefinition.ActivityDefinitionApplyProvider();
}
@Bean
ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionApplyProvider dstu3PlanDefinitionApplyProvider() {
return new ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionApplyProvider();
}
@Bean(name = "applyOperationLoader")
public ProviderLoader applyOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.DSTU3,
Arrays.asList(
ca.uhn.fhir.cr.dstu3.activitydefinition.ActivityDefinitionApplyProvider.class,
ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionApplyProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -21,45 +21,35 @@ package ca.uhn.fhir.cr.config.dstu3;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.config.BaseClinicalReasoningConfig;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.cr.config.RepositoryConfig;
import ca.uhn.fhir.cr.dstu3.IMeasureServiceFactory;
import ca.uhn.fhir.cr.dstu3.measure.MeasureOperationsProvider;
import ca.uhn.fhir.cr.dstu3.measure.MeasureService;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cr.measure.MeasureEvaluationOptions;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Scope;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
@Configuration
@Import(BaseClinicalReasoningConfig.class)
@Import({RepositoryConfig.class})
public class CrDstu3Config {
@Bean
public Function<RequestDetails, MeasureService> dstu3MeasureServiceFactory(
ApplicationContext theApplicationContext) {
return r -> {
var ms = theApplicationContext.getBean(MeasureService.class);
ms.setRequestDetails(r);
return ms;
};
IMeasureServiceFactory dstu3MeasureServiceFactory(
IRepositoryFactory theRepositoryFactory, MeasureEvaluationOptions theEvaluationOptions) {
return rd -> new MeasureService(theRepositoryFactory.create(rd), theEvaluationOptions);
}
@Bean
@Scope("prototype")
public MeasureService dstu3measureService() {
return new MeasureService();
}
@Bean
public MeasureOperationsProvider dstu3measureOperationsProvider() {
MeasureOperationsProvider dstu3MeasureOperationsProvider() {
return new MeasureOperationsProvider();
}

View File

@ -0,0 +1,63 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.dstu3;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class ExtractOperationConfig {
@Bean
ca.uhn.fhir.cr.dstu3.IQuestionnaireResponseProcessorFactory dstu3QuestionnaireResponseProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.questionnaireresponse.dstu3.QuestionnaireResponseProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.dstu3.questionnaireresponse.QuestionnaireResponseExtractProvider
dstu3QuestionnaireResponseExtractProvider() {
return new ca.uhn.fhir.cr.dstu3.questionnaireresponse.QuestionnaireResponseExtractProvider();
}
@Bean(name = "extractOperationLoader")
public ProviderLoader extractOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.DSTU3,
Arrays.asList(
ca.uhn.fhir.cr.dstu3.questionnaireresponse.QuestionnaireResponseExtractProvider
.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -0,0 +1,74 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.dstu3;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class PackageOperationConfig {
@Bean
ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory dstu3PlanDefinitionProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.dstu3.PlanDefinitionProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionPackageProvider dstu3PlanDefinitionPackageProvider() {
return new ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionPackageProvider();
}
@Bean
ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory dstu3QuestionnaireProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.dstu3.QuestionnaireProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePackageProvider dstu3QuestionnairePackageProvider() {
return new ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePackageProvider();
}
@Bean(name = "packageOperationLoader")
public ProviderLoader packageOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.DSTU3,
Arrays.asList(
ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePackageProvider.class,
ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionPackageProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -0,0 +1,60 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.dstu3;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class PopulateOperationConfig {
@Bean
ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory dstu3QuestionnaireProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.dstu3.QuestionnaireProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePopulateProvider dstu3QuestionnairePopulateProvider() {
return new ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePopulateProvider();
}
@Bean(name = "populateOperationLoader")
public ProviderLoader populateOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.DSTU3,
Arrays.asList(ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePopulateProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -0,0 +1,75 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.r4;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class ApplyOperationConfig {
@Bean
ca.uhn.fhir.cr.r4.IActivityDefinitionProcessorFactory r4ActivityDefinitionProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.activitydefinition.r4.ActivityDefinitionProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.r4.IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.r4.activitydefinition.ActivityDefinitionApplyProvider r4ActivityDefinitionApplyProvider() {
return new ca.uhn.fhir.cr.r4.activitydefinition.ActivityDefinitionApplyProvider();
}
@Bean
ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionApplyProvider r4PlanDefinitionApplyProvider() {
return new ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionApplyProvider();
}
@Bean(name = "applyOperationLoader")
public ProviderLoader applyOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.R4,
Arrays.asList(
ca.uhn.fhir.cr.r4.activitydefinition.ActivityDefinitionApplyProvider.class,
ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionApplyProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -21,83 +21,89 @@ package ca.uhn.fhir.cr.config.r4;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.config.BaseClinicalReasoningConfig;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.cr.config.RepositoryConfig;
import ca.uhn.fhir.cr.r4.ICareGapsServiceFactory;
import ca.uhn.fhir.cr.r4.ICqlExecutionServiceFactory;
import ca.uhn.fhir.cr.r4.IMeasureServiceFactory;
import ca.uhn.fhir.cr.r4.ISubmitDataProcessorFactory;
import ca.uhn.fhir.cr.r4.cqlexecution.CqlExecutionOperationProvider;
import ca.uhn.fhir.cr.r4.measure.CareGapsOperationProvider;
import ca.uhn.fhir.cr.r4.measure.CareGapsService;
import ca.uhn.fhir.cr.r4.measure.ISubmitDataService;
import ca.uhn.fhir.cr.r4.measure.MeasureOperationsProvider;
import ca.uhn.fhir.cr.r4.measure.MeasureService;
import ca.uhn.fhir.cr.r4.measure.SubmitDataProvider;
import ca.uhn.fhir.cr.r4.measure.SubmitDataService;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.opencds.cqf.fhir.cr.cql.r4.R4CqlExecutionService;
import org.opencds.cqf.fhir.cr.measure.CareGapsProperties;
import org.opencds.cqf.fhir.cr.measure.MeasureEvaluationOptions;
import org.opencds.cqf.fhir.cr.measure.r4.R4CareGapsService;
import org.opencds.cqf.fhir.cr.measure.r4.R4SubmitDataService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Scope;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.concurrent.Executor;
@Configuration
@Import(BaseClinicalReasoningConfig.class)
@Import({RepositoryConfig.class})
public class CrR4Config {
@Bean
public Function<RequestDetails, MeasureService> r4MeasureServiceFactory(ApplicationContext theApplicationContext) {
return r -> {
var ms = theApplicationContext.getBean(MeasureService.class);
ms.setRequestDetails(r);
return ms;
};
IMeasureServiceFactory r4MeasureServiceFactory(
IRepositoryFactory theRepositoryFactory, MeasureEvaluationOptions theEvaluationOptions) {
return rd -> new MeasureService(theRepositoryFactory.create(rd), theEvaluationOptions);
}
@Bean
@Scope("prototype")
public MeasureService r4measureService() {
return new MeasureService();
ISubmitDataProcessorFactory r4SubmitDataProcessorFactory(IRepositoryFactory theRepositoryFactory) {
return rd -> new R4SubmitDataService(theRepositoryFactory.create(rd));
}
@Bean
public MeasureOperationsProvider r4measureOperationsProvider() {
return new MeasureOperationsProvider();
ICqlExecutionServiceFactory r4CqlExecutionServiceFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new R4CqlExecutionService(theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
public Function<RequestDetails, CareGapsService> r4CareGapsServiceFactory(
ApplicationContext theApplicationContext) {
return r -> {
var cs = theApplicationContext.getBean(CareGapsService.class);
cs.setRequestDetails(r);
return cs;
};
CqlExecutionOperationProvider r4CqlExecutionOperationProvider() {
return new CqlExecutionOperationProvider();
}
@Bean
@Scope("prototype")
public CareGapsService r4CareGapsService() {
return new CareGapsService();
ICareGapsServiceFactory careGapsServiceFactory(
IRepositoryFactory theRepositoryFactory,
CareGapsProperties theCareGapsProperties,
MeasureEvaluationOptions theMeasureEvaluationOptions,
@Qualifier("cqlExecutor") Executor theExecutor) {
return rd -> new R4CareGapsService(
theCareGapsProperties,
theRepositoryFactory.create(rd),
theMeasureEvaluationOptions,
theExecutor,
rd.getFhirServerBase());
}
@Bean
public CareGapsOperationProvider r4CareGapsProvider(
Function<RequestDetails, CareGapsService> theCareGapsServiceFunction) {
CareGapsOperationProvider r4CareGapsOperationProvider() {
return new CareGapsOperationProvider();
}
@Bean
public ISubmitDataService r4SubmitDataService(DaoRegistry theDaoRegistry) {
return requestDetails -> new SubmitDataService(theDaoRegistry, requestDetails);
SubmitDataProvider r4SubmitDataProvider() {
return new SubmitDataProvider();
}
@Bean
public SubmitDataProvider r4SubmitDataProvider(ISubmitDataService theSubmitDataService) {
return new SubmitDataProvider(theSubmitDataService);
MeasureOperationsProvider r4MeasureOperationsProvider() {
return new MeasureOperationsProvider();
}
@Bean
@ -111,7 +117,8 @@ public class CrR4Config {
Arrays.asList(
MeasureOperationsProvider.class,
SubmitDataProvider.class,
CareGapsOperationProvider.class)));
CareGapsOperationProvider.class,
CqlExecutionOperationProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}

View File

@ -0,0 +1,62 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.r4;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class ExtractOperationConfig {
@Bean
ca.uhn.fhir.cr.r4.IQuestionnaireResponseProcessorFactory r4QuestionnaireResponseProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.questionnaireresponse.r4.QuestionnaireResponseProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.r4.questionnaireresponse.QuestionnaireResponseExtractProvider
r4QuestionnaireResponseExtractProvider() {
return new ca.uhn.fhir.cr.r4.questionnaireresponse.QuestionnaireResponseExtractProvider();
}
@Bean(name = "extractOperationLoader")
public ProviderLoader extractOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.R4,
Arrays.asList(
ca.uhn.fhir.cr.r4.questionnaireresponse.QuestionnaireResponseExtractProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -0,0 +1,74 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.r4;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class PackageOperationConfig {
@Bean
ca.uhn.fhir.cr.r4.IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionPackageProvider r4PlanDefinitionPackageProvider() {
return new ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionPackageProvider();
}
@Bean
ca.uhn.fhir.cr.r4.IQuestionnaireProcessorFactory r4QuestionnaireProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.r4.QuestionnaireProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePackageProvider r4QuestionnairePackageProvider() {
return new ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePackageProvider();
}
@Bean(name = "packageOperationLoader")
public ProviderLoader packageOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.R4,
Arrays.asList(
ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePackageProvider.class,
ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionPackageProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -0,0 +1,60 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.config.r4;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.config.ProviderLoader;
import ca.uhn.fhir.cr.config.ProviderSelector;
import ca.uhn.fhir.rest.server.RestfulServer;
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
import java.util.Map;
public class PopulateOperationConfig {
@Bean
ca.uhn.fhir.cr.r4.IQuestionnaireProcessorFactory r4QuestionnaireProcessorFactory(
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.r4.QuestionnaireProcessor(
theRepositoryFactory.create(rd), theEvaluationSettings);
}
@Bean
ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePopulateProvider r4QuestionnairePopulateProvider() {
return new ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePopulateProvider();
}
@Bean(name = "populateOperationLoader")
public ProviderLoader populateOperationLoader(
ApplicationContext theApplicationContext, FhirContext theFhirContext, RestfulServer theRestfulServer) {
var selector = new ProviderSelector(
theFhirContext,
Map.of(
FhirVersionEnum.R4,
Arrays.asList(ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePopulateProvider.class)));
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
}
}

View File

@ -1,37 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.constant;
public class CareCapsConstants {
private CareCapsConstants() {}
public static final String CARE_GAPS_REPORT_PROFILE =
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/indv-measurereport-deqm";
public static final String CARE_GAPS_BUNDLE_PROFILE =
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/gaps-bundle-deqm";
public static final String CARE_GAPS_COMPOSITION_PROFILE =
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/gaps-composition-deqm";
public static final String CARE_GAPS_DETECTED_ISSUE_PROFILE =
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/gaps-detectedissue-deqm";
public static final String CARE_GAPS_GAP_STATUS_EXTENSION =
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/extension-gapStatus";
public static final String CARE_GAPS_GAP_STATUS_SYSTEM =
"http://hl7.org/fhir/us/davinci-deqm/CodeSystem/gaps-status";
}

View File

@ -1,29 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.constant;
public class HtmlConstants {
private HtmlConstants() {}
public static final String HTML_DIV_CONTENT = "<div xmlns=\"http://www.w3.org/1999/xhtml\">%s</div>";
public static final String HTML_PARAGRAPH_CONTENT = "<p>%s</p>";
public static final String HTML_DIV_PARAGRAPH_CONTENT = String.format(HTML_DIV_CONTENT, HTML_PARAGRAPH_CONTENT);
}

View File

@ -1,45 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.constant;
import java.sql.Date;
import java.time.LocalDate;
public class MeasureReportConstants {
private MeasureReportConstants() {}
public static final String MEASUREREPORT_IMPROVEMENT_NOTATION_SYSTEM =
"http://terminology.hl7.org/CodeSystem/measure-improvement-notation";
public static final String MEASUREREPORT_MEASURE_POPULATION_SYSTEM =
"http://terminology.hl7.org/CodeSystem/measure-population";
public static final String MEASUREREPORT_MEASURE_SUPPLEMENTALDATA_EXTENSION =
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/extension-supplementalData";
public static final String MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_URL =
"http://hl7.org/fhir/us/davinci-deqm/SearchParameter/measurereport-supplemental-data";
public static final String MEASUREREPORT_PRODUCT_LINE_EXT_URL =
"http://hl7.org/fhir/us/cqframework/cqfmeasures/StructureDefinition/cqfm-productLine";
public static final String MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_VERSION = "0.1.0";
public static final Date MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_DEFINITION_DATE =
Date.valueOf(LocalDate.of(2022, 7, 20));
public static final String COUNTRY_CODING_SYSTEM_CODE = "urn:iso:std:iso:3166";
public static final String US_COUNTRY_CODE = "US";
public static final String US_COUNTRY_DISPLAY = "United States of America";
}

View File

@ -19,10 +19,10 @@
*/
package ca.uhn.fhir.cr.dstu3;
import org.opencds.cqf.cql.evaluator.activitydefinition.dstu3.ActivityDefinitionProcessor;
import org.opencds.cqf.fhir.api.Repository;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.fhir.cr.activitydefinition.dstu3.ActivityDefinitionProcessor;
@FunctionalInterface
public interface IActivityDefinitionProcessorFactory {
ActivityDefinitionProcessor create(Repository theRepository);
ActivityDefinitionProcessor create(RequestDetails theRequestDetails);
}

View File

@ -17,11 +17,12 @@
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.common;
package ca.uhn.fhir.cr.dstu3;
import ca.uhn.fhir.cr.dstu3.measure.MeasureService;
import ca.uhn.fhir.rest.api.server.RequestDetails;
@FunctionalInterface
public interface ITerminologyProviderFactory {
HapiTerminologyProvider create(RequestDetails theRequestDetails);
public interface IMeasureServiceFactory {
MeasureService create(RequestDetails theRequestDetails);
}

View File

@ -19,10 +19,10 @@
*/
package ca.uhn.fhir.cr.dstu3;
import org.opencds.cqf.cql.evaluator.plandefinition.dstu3.PlanDefinitionProcessor;
import org.opencds.cqf.fhir.api.Repository;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.fhir.cr.plandefinition.dstu3.PlanDefinitionProcessor;
@FunctionalInterface
public interface IPlanDefinitionProcessorFactory {
PlanDefinitionProcessor create(Repository theRepository);
PlanDefinitionProcessor create(RequestDetails theRequestDetails);
}

View File

@ -19,10 +19,10 @@
*/
package ca.uhn.fhir.cr.dstu3;
import org.opencds.cqf.cql.evaluator.questionnaire.dstu3.QuestionnaireProcessor;
import org.opencds.cqf.fhir.api.Repository;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.fhir.cr.questionnaire.dstu3.QuestionnaireProcessor;
@FunctionalInterface
public interface IQuestionnaireProcessorFactory {
QuestionnaireProcessor create(Repository theRepository);
QuestionnaireProcessor create(RequestDetails theRequestDetails);
}

View File

@ -19,10 +19,10 @@
*/
package ca.uhn.fhir.cr.dstu3;
import org.opencds.cqf.cql.evaluator.questionnaireresponse.dstu3.QuestionnaireResponseProcessor;
import org.opencds.cqf.fhir.api.Repository;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.fhir.cr.questionnaireresponse.dstu3.QuestionnaireResponseProcessor;
@FunctionalInterface
public interface IQuestionnaireResponseProcessorFactory {
QuestionnaireResponseProcessor create(Repository theRepository);
QuestionnaireResponseProcessor create(RequestDetails theRequestDetails);
}

View File

@ -20,7 +20,6 @@ package ca.uhn.fhir.cr.dstu3.activitydefinition;
* #L%
*/
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.dstu3.IActivityDefinitionProcessorFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
@ -29,6 +28,9 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import org.hl7.fhir.dstu3.model.ActivityDefinition;
import org.hl7.fhir.dstu3.model.BooleanType;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Endpoint;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Parameters;
@ -39,20 +41,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ActivityDefinitionOperationsProvider {
public class ActivityDefinitionApplyProvider {
@Autowired
IRepositoryFactory myRepositoryFactory;
@Autowired
IActivityDefinitionProcessorFactory myDstu3ActivityDefinitionServiceFactory;
IActivityDefinitionProcessorFactory myDstu3ActivityDefinitionProcessorFactory;
/**
* Implements the <a href=
* "http://www.hl7.org/fhir/activitydefinition-operation-apply.html">$apply</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 CPG
* IG.
* Reasoning Module</a>.
*
* @param theId The id of the ActivityDefinition to apply
* @param theCanonical The canonical identifier for the ActivityDefinition to apply (optionally version-specific)
@ -70,6 +68,8 @@ public class ActivityDefinitionOperationsProvider {
* @param theSetting The current setting of the request (inpatient, outpatient, etc.)
* @param theSettingContext Additional detail about the setting of the request, if any
* @param theParameters Any input parameters defined in libraries referenced by the ActivityDefinition.
* @param theUseServerData Whether to use data from the server performing the evaluation.
* @param theData Data to be made available to the ActivityDefinition evaluation.
* @param theDataEndpoint An endpoint to use to access data referenced by retrieve operations in libraries
* referenced by the ActivityDefinition.
* @param theContentEndpoint An endpoint to use to access content (i.e. libraries) referenced by the ActivityDefinition.
@ -88,19 +88,21 @@ public class ActivityDefinitionOperationsProvider {
@OperationParam(name = "encounter") String theEncounter,
@OperationParam(name = "practitioner") String thePractitioner,
@OperationParam(name = "organization") String theOrganization,
@OperationParam(name = "userType") String theUserType,
@OperationParam(name = "userLanguage") String theUserLanguage,
@OperationParam(name = "userTaskContext") String theUserTaskContext,
@OperationParam(name = "setting") String theSetting,
@OperationParam(name = "settingContext") String theSettingContext,
@OperationParam(name = "userType") CodeableConcept theUserType,
@OperationParam(name = "userLanguage") CodeableConcept theUserLanguage,
@OperationParam(name = "userTaskContext") CodeableConcept theUserTaskContext,
@OperationParam(name = "setting") CodeableConcept theSetting,
@OperationParam(name = "settingContext") CodeableConcept theSettingContext,
@OperationParam(name = "parameters") Parameters theParameters,
@OperationParam(name = "useServerData") BooleanType theUseServerData,
@OperationParam(name = "data") Bundle theData,
@OperationParam(name = "dataEndpoint") Endpoint theDataEndpoint,
@OperationParam(name = "contentEndpoint") Endpoint theContentEndpoint,
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return this.myDstu3ActivityDefinitionServiceFactory
.create(myRepositoryFactory.create(theRequestDetails))
return myDstu3ActivityDefinitionProcessorFactory
.create(theRequestDetails)
.apply(
theId,
new StringType(theCanonical),
@ -115,6 +117,52 @@ public class ActivityDefinitionOperationsProvider {
theSetting,
theSettingContext,
theParameters,
theUseServerData == null ? true : theUseServerData.booleanValue(),
theData,
theDataEndpoint,
theContentEndpoint,
theTerminologyEndpoint);
}
@Operation(name = ProviderConstants.CR_OPERATION_APPLY, idempotent = true, type = ActivityDefinition.class)
public IBaseResource apply(
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "activityDefinition") ActivityDefinition theActivityDefinition,
@OperationParam(name = "subject") String theSubject,
@OperationParam(name = "encounter") String theEncounter,
@OperationParam(name = "practitioner") String thePractitioner,
@OperationParam(name = "organization") String theOrganization,
@OperationParam(name = "userType") CodeableConcept theUserType,
@OperationParam(name = "userLanguage") CodeableConcept theUserLanguage,
@OperationParam(name = "userTaskContext") CodeableConcept theUserTaskContext,
@OperationParam(name = "setting") CodeableConcept theSetting,
@OperationParam(name = "settingContext") CodeableConcept theSettingContext,
@OperationParam(name = "parameters") Parameters theParameters,
@OperationParam(name = "useServerData") BooleanType theUseServerData,
@OperationParam(name = "data") Bundle theData,
@OperationParam(name = "dataEndpoint") Endpoint theDataEndpoint,
@OperationParam(name = "contentEndpoint") Endpoint theContentEndpoint,
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return myDstu3ActivityDefinitionProcessorFactory
.create(theRequestDetails)
.apply(
null,
new StringType(theCanonical),
theActivityDefinition,
theSubject,
theEncounter,
thePractitioner,
theOrganization,
theUserType,
theUserLanguage,
theUserTaskContext,
theSetting,
theSettingContext,
theParameters,
theUseServerData == null ? true : theUseServerData.booleanValue(),
theData,
theDataEndpoint,
theContentEndpoint,
theTerminologyEndpoint);

View File

@ -19,6 +19,7 @@
*/
package ca.uhn.fhir.cr.dstu3.measure;
import ca.uhn.fhir.cr.dstu3.IMeasureServiceFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
@ -34,12 +35,10 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.function.Function;
@Component
public class MeasureOperationsProvider {
@Autowired
Function<RequestDetails, MeasureService> myDstu3MeasureServiceFactory;
IMeasureServiceFactory myDstu3MeasureProcessorFactory;
/**
* Implements the <a href=
@ -79,8 +78,8 @@ public class MeasureOperationsProvider {
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return this.myDstu3MeasureServiceFactory
.apply(theRequestDetails)
return myDstu3MeasureProcessorFactory
.create(theRequestDetails)
.evaluateMeasure(
theId,
thePeriodStart,

View File

@ -19,16 +19,7 @@
*/
package ca.uhn.fhir.cr.dstu3.measure;
import ca.uhn.fhir.cr.common.IDaoRegistryUser;
import ca.uhn.fhir.cr.common.IDataProviderFactory;
import ca.uhn.fhir.cr.common.IFhirDalFactory;
import ca.uhn.fhir.cr.common.ILibrarySourceProviderFactory;
import ca.uhn.fhir.cr.common.ITerminologyProviderFactory;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.util.BundleBuilder;
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
@ -38,32 +29,32 @@ import org.hl7.fhir.dstu3.model.Endpoint;
import org.hl7.fhir.dstu3.model.Enumerations;
import org.hl7.fhir.dstu3.model.Extension;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Measure;
import org.hl7.fhir.dstu3.model.MeasureReport;
import org.hl7.fhir.dstu3.model.SearchParameter;
import org.hl7.fhir.dstu3.model.StringType;
import org.opencds.cqf.cql.engine.data.DataProvider;
import org.opencds.cqf.cql.engine.fhir.terminology.Dstu3FhirTerminologyProvider;
import org.opencds.cqf.cql.engine.terminology.TerminologyProvider;
import org.opencds.cqf.cql.evaluator.fhir.dal.FhirDal;
import org.opencds.cqf.cql.evaluator.fhir.util.Clients;
import org.opencds.cqf.cql.evaluator.library.EvaluationSettings;
import org.opencds.cqf.cql.evaluator.measure.MeasureEvaluationOptions;
import org.springframework.beans.factory.annotation.Autowired;
import org.opencds.cqf.fhir.api.Repository;
import org.opencds.cqf.fhir.cr.measure.MeasureEvaluationOptions;
import org.opencds.cqf.fhir.cr.measure.dstu3.Dstu3MeasureProcessor;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.COUNTRY_CODING_SYSTEM_CODE;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.MEASUREREPORT_MEASURE_SUPPLEMENTALDATA_EXTENSION;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_DEFINITION_DATE;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_URL;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_VERSION;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.US_COUNTRY_CODE;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.US_COUNTRY_DISPLAY;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.COUNTRY_CODING_SYSTEM_CODE;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.MEASUREREPORT_MEASURE_SUPPLEMENTALDATA_EXTENSION;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_DEFINITION_DATE;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_URL;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_VERSION;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.US_COUNTRY_CODE;
import static org.opencds.cqf.fhir.cr.measure.constant.MeasureReportConstants.US_COUNTRY_DISPLAY;
public class MeasureService implements IDaoRegistryUser {
public class MeasureService {
private final Repository myRepository;
private final MeasureEvaluationOptions myMeasureEvaluationOptions;
public MeasureService(Repository theRepository, MeasureEvaluationOptions theMeasureEvaluationOptions) {
myRepository = theRepository;
myMeasureEvaluationOptions = theMeasureEvaluationOptions;
}
public static final List<ContactDetail> CQI_CONTACT_DETAIL = Collections.singletonList(new ContactDetail()
.addTelecom(new ContactPoint()
@ -96,47 +87,10 @@ public class MeasureService implements IDaoRegistryUser {
.setTitle("Supplemental Data")
.setId("deqm-measurereport-supplemental-data");
@Autowired
protected ITerminologyProviderFactory myTerminologyProviderFactory;
@Autowired
protected IDataProviderFactory myCqlDataProviderFactory;
@Autowired
protected org.opencds.cqf.cql.evaluator.builder.DataProviderFactory myDataProviderFactory;
@Autowired
protected ILibrarySourceProviderFactory myLibraryContentProviderFactory;
@Autowired
protected IFhirDalFactory myFhirDalFactory;
@Autowired
protected Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library>
myGlobalLibraryCache;
@Autowired
protected EvaluationSettings myEvaluationSettings;
@Autowired
protected MeasureEvaluationOptions myMeasureEvaluationOptions;
@Autowired
protected DaoRegistry myDaoRegistry;
protected RequestDetails myRequestDetails;
/**
* Get The details (such as tenant) of this request. Usually auto-populated HAPI.
*
* @return RequestDetails
*/
public RequestDetails getRequestDetails() {
return this.myRequestDetails;
}
public void setRequestDetails(RequestDetails theRequestDetails) {
this.myRequestDetails = theRequestDetails;
}
/**
* Implements the <a href=
@ -173,46 +127,14 @@ public class MeasureService implements IDaoRegistryUser {
ensureSupplementalDataElementSearchParameter();
Measure measure = read(theId, myRequestDetails);
var dstu3MeasureProcessor = new Dstu3MeasureProcessor(myRepository, myMeasureEvaluationOptions);
TerminologyProvider terminologyProvider;
if (theTerminologyEndpoint != null) {
IGenericClient client = Clients.forEndpoint(getFhirContext(), theTerminologyEndpoint);
terminologyProvider = new Dstu3FhirTerminologyProvider(client);
} else {
terminologyProvider = this.myTerminologyProviderFactory.create(myRequestDetails);
}
DataProvider dataProvider = this.myCqlDataProviderFactory.create(myRequestDetails, terminologyProvider);
LibrarySourceProvider libraryContentProvider = this.myLibraryContentProviderFactory.create(myRequestDetails);
FhirDal fhirDal = this.myFhirDalFactory.create(myRequestDetails);
var measureProcessor = new org.opencds.cqf.cql.evaluator.measure.dstu3.Dstu3MeasureProcessor(
null,
this.myDataProviderFactory,
null,
null,
null,
terminologyProvider,
libraryContentProvider,
dataProvider,
fhirDal,
myMeasureEvaluationOptions,
myEvaluationSettings.getCqlOptions(),
null);
MeasureReport report = measureProcessor.evaluateMeasure(
measure.getUrl(),
MeasureReport report = dstu3MeasureProcessor.evaluateMeasure(
theId,
thePeriodStart,
thePeriodEnd,
theReportType,
theSubject,
null,
theLastReceivedOn,
null,
null,
null,
Collections.singletonList(theSubject),
theAdditionalData);
if (theProductLine != null) {
@ -225,17 +147,12 @@ public class MeasureService implements IDaoRegistryUser {
return report;
}
@Override
public DaoRegistry getDaoRegistry() {
return this.myDaoRegistry;
}
protected void ensureSupplementalDataElementSearchParameter() {
// create a transaction bundle
BundleBuilder builder = new BundleBuilder(getFhirContext());
BundleBuilder builder = new BundleBuilder(myRepository.fhirContext());
// set the request to be condition on code == supplemental data
builder.addTransactionCreateEntry(SUPPLEMENTAL_DATA_SEARCHPARAMETER).conditional("code=supplemental-data");
transaction(builder.getBundle(), this.myRequestDetails);
myRepository.transaction(builder.getBundle());
}
}

View File

@ -20,7 +20,6 @@ package ca.uhn.fhir.cr.dstu3.plandefinition;
* #L%
*/
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
@ -28,7 +27,9 @@ import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import org.hl7.fhir.dstu3.model.BooleanType;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Endpoint;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Parameters;
@ -40,21 +41,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class PlanDefinitionOperationsProvider {
public class PlanDefinitionApplyProvider {
@Autowired
IRepositoryFactory myRepositoryFactory;
@Autowired
IPlanDefinitionProcessorFactory myDstu3PlanDefinitionServiceFactory;
IPlanDefinitionProcessorFactory myDstu3PlanDefinitionProcessorFactory;
/**
* Implements the <a href=
* "http://www.hl7.org/fhir/plandefinition-operation-apply.html">$apply</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
* <a href="https://build.fhir.org/ig/HL7/cqf-recommendations/OperationDefinition-cpg-plandefinition-apply.html">
* CPG IG</a>.
* Reasoning Module</a>.
*
* @param theId The id of the PlanDefinition to apply
* @param theCanonical The canonical identifier for the PlanDefinition to apply (optionally version-specific)
@ -72,6 +68,7 @@ public class PlanDefinitionOperationsProvider {
* @param theSetting The current setting of the request (inpatient, outpatient, etc.)
* @param theSettingContext Additional detail about the setting of the request, if any
* @param theParameters Any input parameters defined in libraries referenced by the PlanDefinition.
* @param theUseServerData Whether to use data from the server performing the evaluation.
* @param theData Data to be made available to the PlanDefinition evaluation.
* @param theDataEndpoint An endpoint to use to access data referenced by retrieve operations in libraries
* referenced by the PlanDefinition.
@ -91,20 +88,21 @@ public class PlanDefinitionOperationsProvider {
@OperationParam(name = "encounter") String theEncounter,
@OperationParam(name = "practitioner") String thePractitioner,
@OperationParam(name = "organization") String theOrganization,
@OperationParam(name = "userType") String theUserType,
@OperationParam(name = "userLanguage") String theUserLanguage,
@OperationParam(name = "userTaskContext") String theUserTaskContext,
@OperationParam(name = "setting") String theSetting,
@OperationParam(name = "settingContext") String theSettingContext,
@OperationParam(name = "userType") CodeableConcept theUserType,
@OperationParam(name = "userLanguage") CodeableConcept theUserLanguage,
@OperationParam(name = "userTaskContext") CodeableConcept theUserTaskContext,
@OperationParam(name = "setting") CodeableConcept theSetting,
@OperationParam(name = "settingContext") CodeableConcept theSettingContext,
@OperationParam(name = "parameters") Parameters theParameters,
@OperationParam(name = "useServerData") BooleanType theUseServerData,
@OperationParam(name = "data") Bundle theData,
@OperationParam(name = "dataEndpoint") Endpoint theDataEndpoint,
@OperationParam(name = "contentEndpoint") Endpoint theContentEndpoint,
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return this.myDstu3PlanDefinitionServiceFactory
.create(myRepositoryFactory.create(theRequestDetails))
return myDstu3PlanDefinitionProcessorFactory
.create(theRequestDetails)
.apply(
theId,
new StringType(theCanonical),
@ -119,7 +117,52 @@ public class PlanDefinitionOperationsProvider {
theSetting,
theSettingContext,
theParameters,
true,
theUseServerData == null ? true : theUseServerData.booleanValue(),
theData,
null,
theDataEndpoint,
theContentEndpoint,
theTerminologyEndpoint);
}
@Operation(name = ProviderConstants.CR_OPERATION_APPLY, idempotent = true, type = PlanDefinition.class)
public IBaseResource apply(
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "planDefinition") PlanDefinition thePlanDefinition,
@OperationParam(name = "subject") String theSubject,
@OperationParam(name = "encounter") String theEncounter,
@OperationParam(name = "practitioner") String thePractitioner,
@OperationParam(name = "organization") String theOrganization,
@OperationParam(name = "userType") CodeableConcept theUserType,
@OperationParam(name = "userLanguage") CodeableConcept theUserLanguage,
@OperationParam(name = "userTaskContext") CodeableConcept theUserTaskContext,
@OperationParam(name = "setting") CodeableConcept theSetting,
@OperationParam(name = "settingContext") CodeableConcept theSettingContext,
@OperationParam(name = "parameters") Parameters theParameters,
@OperationParam(name = "useServerData") BooleanType theUseServerData,
@OperationParam(name = "data") Bundle theData,
@OperationParam(name = "dataEndpoint") Endpoint theDataEndpoint,
@OperationParam(name = "contentEndpoint") Endpoint theContentEndpoint,
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return myDstu3PlanDefinitionProcessorFactory
.create(theRequestDetails)
.apply(
null,
new StringType(theCanonical),
thePlanDefinition,
theSubject,
theEncounter,
thePractitioner,
theOrganization,
theUserType,
theUserLanguage,
theUserTaskContext,
theSetting,
theSettingContext,
theParameters,
theUseServerData == null ? true : theUseServerData.booleanValue(),
theData,
null,
theDataEndpoint,

View File

@ -0,0 +1,67 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.dstu3.plandefinition;
import ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.PlanDefinition;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.springframework.beans.factory.annotation.Autowired;
public class PlanDefinitionPackageProvider {
@Autowired
IPlanDefinitionProcessorFactory mydstu3PlanDefinitionProcessorFactory;
@Operation(name = ProviderConstants.CR_OPERATION_PACKAGE, idempotent = true, type = PlanDefinition.class)
public IBaseBundle packagePlanDefinition(
@IdParam IdType theId,
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "usePut") String theIsPut,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return mydstu3PlanDefinitionProcessorFactory
.create(theRequestDetails)
.packagePlanDefinition(theId, new StringType(theCanonical), null, Boolean.parseBoolean(theIsPut));
}
@Operation(name = ProviderConstants.CR_OPERATION_PACKAGE, idempotent = true, type = PlanDefinition.class)
public IBaseBundle packagePlanDefinition(
@OperationParam(name = "id") String theId,
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "usePut") String theIsPut,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return mydstu3PlanDefinitionProcessorFactory
.create(theRequestDetails)
.packagePlanDefinition(
new IdType("PlanDefinition", theId),
new StringType(theCanonical),
null,
Boolean.parseBoolean(theIsPut));
}
}

View File

@ -0,0 +1,69 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.dstu3.questionnaire;
import ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Questionnaire;
import org.hl7.fhir.dstu3.model.StringType;
import org.springframework.beans.factory.annotation.Autowired;
public class QuestionnairePackageProvider {
@Autowired
IQuestionnaireProcessorFactory myDstu3QuestionnaireProcessorFactory;
/**
* Implements a $package operation following the <a href=
* "https://build.fhir.org/ig/HL7/crmi-ig/branches/master/packaging.html">CRMI IG</a>.
*
* @param theId The id of the Questionnaire.
* @param theCanonical The canonical identifier for the questionnaire (optionally version-specific).
* @Param theIsPut A boolean value to determine if the Bundle returned uses PUT or POST request methods. Defaults to false.
* @param theRequestDetails The details (such as tenant) of this request. Usually
* autopopulated by HAPI.
* @return A Bundle containing the Questionnaire and all related Library, CodeSystem and ValueSet resources
*/
@Operation(name = ProviderConstants.CR_OPERATION_PACKAGE, idempotent = true, type = Questionnaire.class)
public Bundle packageQuestionnaire(
@IdParam IdType theId,
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "usePut") String theIsPut,
RequestDetails theRequestDetails) {
return (Bundle) myDstu3QuestionnaireProcessorFactory
.create(theRequestDetails)
.packageQuestionnaire(theId, new StringType(theCanonical), null, Boolean.parseBoolean(theIsPut));
}
@Operation(name = ProviderConstants.CR_OPERATION_PACKAGE, idempotent = true, type = Questionnaire.class)
public Bundle packageQuestionnaire(
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "usePut") String theIsPut,
RequestDetails theRequestDetails) {
return (Bundle) myDstu3QuestionnaireProcessorFactory
.create(theRequestDetails)
.packageQuestionnaire(null, new StringType(theCanonical), null, Boolean.parseBoolean(theIsPut));
}
}

View File

@ -20,7 +20,6 @@ package ca.uhn.fhir.cr.dstu3.questionnaire;
* #L%
*/
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
@ -38,12 +37,9 @@ import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.exceptions.FHIRException;
import org.springframework.beans.factory.annotation.Autowired;
public class QuestionnaireOperationsProvider {
public class QuestionnairePopulateProvider {
@Autowired
IRepositoryFactory myRepositoryFactory;
@Autowired
IQuestionnaireProcessorFactory myDstu3QuestionnaireServiceFactory;
IQuestionnaireProcessorFactory myDstu3QuestionnaireProcessorFactory;
/**
* Implements a modified version of the <a href=
@ -81,8 +77,8 @@ public class QuestionnaireOperationsProvider {
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return this.myDstu3QuestionnaireServiceFactory
.create(myRepositoryFactory.create(theRequestDetails))
return myDstu3QuestionnaireProcessorFactory
.create(theRequestDetails)
.prePopulate(
theId,
new StringType(theCanonical),
@ -95,6 +91,32 @@ public class QuestionnaireOperationsProvider {
theTerminologyEndpoint);
}
@Operation(name = ProviderConstants.CR_OPERATION_PREPOPULATE, idempotent = true, type = Questionnaire.class)
public Questionnaire prepopulate(
@OperationParam(name = "canonical") String theCanonical,
@OperationParam(name = "questionnaire") Questionnaire theQuestionnaire,
@OperationParam(name = "subject") String theSubject,
@OperationParam(name = "parameters") Parameters theParameters,
@OperationParam(name = "bundle") Bundle theBundle,
@OperationParam(name = "dataEndpoint") Endpoint theDataEndpoint,
@OperationParam(name = "contentEndpoint") Endpoint theContentEndpoint,
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return myDstu3QuestionnaireProcessorFactory
.create(theRequestDetails)
.prePopulate(
null,
new StringType(theCanonical),
theQuestionnaire,
theSubject,
theParameters,
theBundle,
theDataEndpoint,
theContentEndpoint,
theTerminologyEndpoint);
}
/**
* Implements the <a href=
* "http://build.fhir.org/ig/HL7/sdc/OperationDefinition-Questionnaire-populate.html">$populate</a>
@ -129,8 +151,8 @@ public class QuestionnaireOperationsProvider {
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return (QuestionnaireResponse) this.myDstu3QuestionnaireServiceFactory
.create(myRepositoryFactory.create(theRequestDetails))
return (QuestionnaireResponse) myDstu3QuestionnaireProcessorFactory
.create(theRequestDetails)
.populate(
theId,
new StringType(theCanonical),
@ -143,24 +165,29 @@ public class QuestionnaireOperationsProvider {
theTerminologyEndpoint);
}
/**
* Implements a $package operation following the <a href=
* "https://build.fhir.org/ig/HL7/crmi-ig/branches/master/packaging.html">CRMI IG</a>.
*
* @param theId The id of the Questionnaire.
* @param theCanonical The canonical identifier for the questionnaire (optionally version-specific).
* @param theRequestDetails The details (such as tenant) of this request. Usually
* autopopulated by HAPI.
* @return A Bundle containing the Questionnaire and all related Library, CodeSystem and ValueSet resources
*/
@Operation(name = ProviderConstants.CR_OPERATION_PACKAGE, idempotent = true, type = Questionnaire.class)
public Bundle packageQuestionnaire(
@IdParam IdType theId,
@Operation(name = ProviderConstants.CR_OPERATION_POPULATE, idempotent = true, type = Questionnaire.class)
public QuestionnaireResponse populate(
@OperationParam(name = "canonical") String theCanonical,
RequestDetails theRequestDetails) {
return (Bundle) this.myDstu3QuestionnaireServiceFactory
.create(myRepositoryFactory.create(theRequestDetails))
.packageQuestionnaire(theId, new StringType(theCanonical), null, false);
@OperationParam(name = "questionnaire") Questionnaire theQuestionnaire,
@OperationParam(name = "subject") String theSubject,
@OperationParam(name = "parameters") Parameters theParameters,
@OperationParam(name = "bundle") Bundle theBundle,
@OperationParam(name = "dataEndpoint") Endpoint theDataEndpoint,
@OperationParam(name = "contentEndpoint") Endpoint theContentEndpoint,
@OperationParam(name = "terminologyEndpoint") Endpoint theTerminologyEndpoint,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return (QuestionnaireResponse) myDstu3QuestionnaireProcessorFactory
.create(theRequestDetails)
.populate(
null,
new StringType(theCanonical),
theQuestionnaire,
theSubject,
theParameters,
theBundle,
theDataEndpoint,
theContentEndpoint,
theTerminologyEndpoint);
}
}

View File

@ -20,11 +20,10 @@ package ca.uhn.fhir.cr.dstu3.questionnaireresponse;
* #L%
*/
import ca.uhn.fhir.cr.common.IRepositoryFactory;
import ca.uhn.fhir.cr.dstu3.IQuestionnaireResponseProcessorFactory;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.ResourceParam;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
@ -34,12 +33,9 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.springframework.beans.factory.annotation.Autowired;
public class QuestionnaireResponseOperationsProvider {
public class QuestionnaireResponseExtractProvider {
@Autowired
IRepositoryFactory myRepositoryFactory;
@Autowired
IQuestionnaireResponseProcessorFactory myDstu3QuestionnaireResponseServiceFactory;
IQuestionnaireResponseProcessorFactory myDstu3QuestionnaireResponseProcessorFactory;
/**
* Implements the <a href=
@ -56,11 +52,21 @@ public class QuestionnaireResponseOperationsProvider {
@Operation(name = ProviderConstants.CR_OPERATION_EXTRACT, idempotent = true, type = QuestionnaireResponse.class)
public IBaseBundle extract(
@IdParam IdType theId,
@ResourceParam QuestionnaireResponse theQuestionnaireResponse,
@OperationParam(name = "questionnaire-response") QuestionnaireResponse theQuestionnaireResponse,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return this.myDstu3QuestionnaireResponseServiceFactory
.create(myRepositoryFactory.create(theRequestDetails))
return myDstu3QuestionnaireResponseProcessorFactory
.create(theRequestDetails)
.extract(theId, theQuestionnaireResponse, null, null, null);
}
@Operation(name = ProviderConstants.CR_OPERATION_EXTRACT, idempotent = true, type = QuestionnaireResponse.class)
public IBaseBundle extract(
@OperationParam(name = "questionnaire-response") QuestionnaireResponse theQuestionnaireResponse,
RequestDetails theRequestDetails)
throws InternalErrorException, FHIRException {
return myDstu3QuestionnaireResponseProcessorFactory
.create(theRequestDetails)
.extract(null, theQuestionnaireResponse, null, null, null);
}
}

View File

@ -1,55 +0,0 @@
/*-
* #%L
* HAPI FHIR - Clinical Reasoning
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.enumeration;
import ca.uhn.fhir.i18n.Msg;
public enum CareGapsStatusCode {
OPEN_GAP("open-gap"),
CLOSED_GAP("closed-gap"),
NOT_APPLICABLE("not-applicable");
private final String myValue;
CareGapsStatusCode(final String theValue) {
myValue = theValue;
}
@Override
public String toString() {
return myValue;
}
public String toDisplayString() {
if (myValue.equals("open-gap")) {
return "Open Gap";
}
if (myValue.equals("closed-gap")) {
return "Closed Gap";
}
if (myValue.equals("not-applicable")) {
return "Not Applicable";
}
throw new RuntimeException(Msg.code(2301) + "Error getting display strings for care gaps status codes");
}
}

View File

@ -19,10 +19,10 @@
*/
package ca.uhn.fhir.cr.r4;
import org.opencds.cqf.cql.evaluator.activitydefinition.r4.ActivityDefinitionProcessor;
import org.opencds.cqf.fhir.api.Repository;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.fhir.cr.activitydefinition.r4.ActivityDefinitionProcessor;
@FunctionalInterface
public interface IActivityDefinitionProcessorFactory {
ActivityDefinitionProcessor create(Repository theRepository);
ActivityDefinitionProcessor create(RequestDetails theRequestDetails);
}

View File

@ -17,10 +17,12 @@
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.cr.r4.measure;
package ca.uhn.fhir.cr.r4;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import org.opencds.cqf.fhir.cr.measure.r4.R4CareGapsService;
import java.util.function.Function;
public interface ISubmitDataService extends Function<RequestDetails, SubmitDataService> {}
@FunctionalInterface
public interface ICareGapsServiceFactory {
R4CareGapsService create(RequestDetails theRequestDetails);
}

Some files were not shown because too many files have changed in this diff Show More