configure caregaps operation and properties

This commit is contained in:
justin.mckelvy
2023-06-30 14:53:51 -06:00
parent 29580e5501
commit 26662c2476
7 changed files with 154143 additions and 37 deletions

View File

@@ -10,21 +10,20 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.hl7.fhir.r4.model.MeasureReport;
import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Subscription;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.io.IOException;
import java.net.URI;
@@ -39,15 +38,21 @@ import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class}, properties = {
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = {Application.class, JpaStarterWebsocketDispatcherConfig.class},
properties = {
"spring.datasource.url=jdbc:h2:mem:dbr4",
"hapi.fhir.enable_repository_validating_interceptor=true",
"hapi.fhir.fhir_version=r4",
"hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.mdm_enabled=true",
"hapi.fhir.cr_enabled=true",
"hapi.fhir.caregaps_section_author=Organization/alphora-author",
"hapi.fhir.caregaps_reporter=Organization/alphora",
"hapi.fhir.implementationguides.dk-core.name=hl7.fhir.dk.core",
"hapi.fhir.implementationguides.dk-core.version=1.1.0",
"hapi.fhir.auto_create_placeholder_reference_targets=true",
// Override is currently required when using MDM as the construction of the MDM
// beans are ambiguous as they are constructed multiple places. This is evident
// when running in a spring boot environment
@@ -58,6 +63,8 @@ class ExampleServerR4IT implements IServerSupport{
private FhirContext ourCtx;
private ApplicationContext ctx;
@Autowired private AppProperties appProperties;
@LocalServerPort
private int port;
@@ -133,6 +140,16 @@ class ExampleServerR4IT implements IServerSupport{
org.hl7.fhir.r4.model.Bundle result = theClient.transaction().withBundle(bundle).execute();
return result;
}
private IBaseResource loadRec(String theLocation, FhirContext theCtx, IGenericClient theClient) throws IOException {
String json = stringFromResource(theLocation);
List<IBaseResource> resList = new ArrayList<>();
IBaseResource resource = (IBaseResource) theCtx.newJsonParser().parseResource(json);
resList.add(resource);
var result = theClient.transaction().withResources(resList).execute();
//.withResources(resource).execute();
return result.get(0);
}
@Test
public void testBatchPutWithIdenticalTags() {
String batchPuts = "{\n" +
@@ -241,6 +258,42 @@ class ExampleServerR4IT implements IServerSupport{
ourClient.delete().resourceById(mySubscriptionId).execute();
}
@Test
void testCareGaps() throws IOException {
var reporter = appProperties.getCareGapsReporter();
var author = appProperties.getCareGapsSectionAuthor();
assertTrue(reporter.equals("Organization/alphora"));
assertTrue(author.equals("Organization/alphora-author"));
String periodStartValid = "2019-01-01";
String periodEndValid = "2019-12-31";
String subjectPatientValid = "Patient/numer-EXM125";
String statusValid = "open-gap";
String measureIdValid = "BreastCancerScreeningFHIR";
loadBundle("r4/CareGaps/authreporter-bundle.json", ourCtx, ourClient);
loadBundle("r4/CareGaps/BreastCancerScreeningFHIR-bundle.json", ourCtx, ourClient);
Parameters params = new Parameters();
params.addParameter().setName("periodStart").setValue(new DateType(periodStartValid));
params.addParameter().setName("subject").setValue(new DateType(periodEndValid));
params.addParameter().setName("status").setValue(new StringType(subjectPatientValid));
params.addParameter().setName("measureId").setValue(new StringType(statusValid));
params.addParameter().setName("").setValue(new StringType(measureIdValid));
assertDoesNotThrow(() -> {
ourClient.operation()
.onType(Measure.class)
.named("$care-gaps")
.withParameters(params)
.returnResourceType(Parameters.class)
.execute();
});
}
private int activeSubscriptionCount() {
return ourClient.search().forResource(Subscription.class).where(Subscription.STATUS.exactly().code("active"))
.cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute().getEntry()

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,204 @@
{
"resourceType": "Bundle",
"id": "AlphoraOrgAuth-bundle",
"type": "transaction",
"entry": [
{
"resource": {
"resourceType": "Organization",
"id": "alphora",
"meta": {
"profile": [
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/organization-deqm"
]
},
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "TAX",
"display": "Tax ID number"
}
]
},
"system": "urn:oid:2.16.840.1.113883.4.4",
"value": "123456789",
"assigner": {
"display": "www.irs.gov"
}
}
],
"active": true,
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/organization-type",
"code": "prov",
"display": "Healthcare Provider"
}
]
}
],
"name": "alphora",
"telecom": [
{
"system": "phone",
"value": "(+1) 401-555-1212"
}
],
"address": [
{
"line": [
"73 Lakewood Street"
],
"city": "Warwick",
"state": "RI",
"postalCode": "02886",
"country": "USA"
}
]
},
"request": {
"method": "PUT",
"url": "Organization/alphora"
}
},
{
"resource": {
"resourceType": "Organization",
"id": "alphora-author",
"meta": {
"profile": [
"http://hl7.org/fhir/us/davinci-deqm/StructureDefinition/organization-deqm"
]
},
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "TAX",
"display": "Tax ID number"
}
]
},
"system": "urn:oid:2.16.840.1.113883.4.4",
"value": "12345678910",
"assigner": {
"display": "www.irs.gov"
}
}
],
"active": true,
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/organization-type",
"code": "prov",
"display": "Healthcare Provider"
}
]
}
],
"name": "alphora-author",
"telecom": [
{
"system": "phone",
"value": "(+1) 401-555-1313"
}
],
"address": [
{
"line": [
"737 Lakewood Street"
],
"city": "Warwick",
"state": "RI",
"postalCode": "02886",
"country": "USA"
}
]
},
"request": {
"method": "PUT",
"url": "Organization/alphora-author"
}
},
{
"resource": {
"resourceType": "Patient",
"id": "numer-EXM125",
"meta": {
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
]
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2028-9",
"display": "Asian"
}
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2135-2",
"display": "Hispanic or Latino"
}
}
]
}
],
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}
]
},
"system": "http://hospital.smarthealthit.org",
"value": "999999995"
}
],
"name": [
{
"family": "McCarren",
"given": [
"Karen"
]
}
],
"gender": "female",
"birthDate": "1965-01-01"
},
"request": {
"method": "PUT",
"url": "Patient/numer-EXM125"
}
}
]
}

View File

@@ -0,0 +1,63 @@
{
"resourceType": "Patient",
"id": "numer-EXM125",
"meta": {
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
]
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2028-9",
"display": "Asian"
}
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2135-2",
"display": "Hispanic or Latino"
}
}
]
}
],
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}
]
},
"system": "http://hospital.smarthealthit.org",
"value": "999999995"
}
],
"name": [
{
"family": "McCarren",
"given": [
"Karen"
]
}
],
"gender": "female",
"birthDate": "1965-01-01"
}