Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 34a783a

Browse files
committed
Merge branch 'main' into azure-load-tests
2 parents 0f55439 + 0288de9 commit 34a783a

File tree

48 files changed

+1498
-749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1498
-749
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ dependencies {
2323
implementation project(':etor')
2424
testImplementation testFixtures(project(':shared'))
2525

26-
implementation 'io.javalin:javalin:6.3.0'
26+
implementation 'io.javalin:javalin:6.4.0'
2727

2828
testImplementation 'org.apache.groovy:groovy:4.0.24'
2929
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
3030
testImplementation 'com.openpojo:openpojo:0.9.1'
31-
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.17.5'
31+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.18'
3232
}
3333

3434
jacocoTestCoverageVerification {

app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/App.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public static void main(String[] args) {
4848

4949
// apply this security header to all responses, but allow it to be overwritten by a specific
5050
// endpoint by using `before` if needed
51-
app.before(ctx -> ctx.header("X-Content-Type-Options", "nosniff"));
51+
app.before(
52+
ctx -> {
53+
ctx.header("X-Content-Type-Options", "nosniff");
54+
// Fix for https://www.zaproxy.org/docs/alerts/90004
55+
ctx.header("Cross-Origin-Resource-Policy", "cross-origin");
56+
});
5257

5358
try {
5459
app.get(HEALTH_API_ENDPOINT, ctx -> ctx.result("Operational"));

e2e/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies {
1919
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
2020

2121
//fhir
22-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-base:7.6.0'
23-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:7.6.0'
24-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-caching-caffeine:7.6.0'
25-
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:7.6.0'
22+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-base:7.6.1'
23+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:7.6.1'
24+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-caching-caffeine:7.6.1'
25+
implementation 'ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:7.6.1'
2626
implementation 'org.fhir:ucum:1.0.9'
2727

2828
testImplementation 'org.apache.groovy:groovy:4.0.24'

etor/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies {
1919
testImplementation 'org.apache.groovy:groovy:4.0.24'
2020
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
2121
testImplementation 'com.openpojo:openpojo:0.9.1'
22-
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.17.5'
22+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.18'
2323
}
2424

2525
jacocoTestCoverageVerification {

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/CopyOrcOrderProviderToObrOrderProvider.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,8 @@ public void transform(HealthData<?> resource, Map<String, Object> args) {
2828
return;
2929
}
3030

31-
// Extract or create the OBR-16 extension from the ServiceRequest
3231
Extension obrExtension =
3332
HapiHelper.ensureExtensionExists(serviceRequest, HapiHelper.EXTENSION_OBR_URL);
34-
35-
// Extract or create the OBR-16 data type extension
36-
Extension obr16Extension =
37-
HapiHelper.ensureSubExtensionExists(
38-
obrExtension, HapiHelper.EXTENSION_OBR16_DATA_TYPE.toString());
39-
40-
// Set the ORC-12 Practitioner in the OBR-16 extension
41-
HapiHelper.setOBR16WithPractitioner(obr16Extension, practitionerRole);
33+
HapiHelper.setOBR16WithPractitioner(obrExtension, practitionerRole);
4234
}
4335
}

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemovePatientIdentifiers.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class RemovePatientIdentifiers implements CustomFhirTransformation {
1515
@Override
1616
public void transform(HealthData<?> resource, Map<String, Object> args) {
1717
Bundle bundle = (Bundle) resource.getUnderlyingData();
18-
HapiHelper.setPID3_4Value(bundle, ""); // remove PID.3-4
19-
HapiHelper.setPID3_5Value(bundle, ""); // remove PID.3-5
18+
19+
HapiHelper.setPID3_4Value(bundle, null);
20+
HapiHelper.removePID3_5Value(bundle);
2021
}
2122
}

etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemovePatientNameTypeCode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ public class RemovePatientNameTypeCode implements CustomFhirTransformation {
1212
@Override
1313
public void transform(final HealthData<?> resource, final Map<String, Object> args) {
1414
Bundle bundle = (Bundle) resource.getUnderlyingData();
15-
// Need to set the value for extension to empty instead of removing the extension,
16-
// otherwise RS will set its own value in its place
17-
HapiHelper.setPID5_7ExtensionValue(bundle, null);
15+
HapiHelper.removePID5_7Value(bundle);
1816
}
1917
}

etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/CopyOrcOrderProviderToObrOrderProviderTest.groovy

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import gov.hhs.cdc.trustedintermediary.external.hapi.HapiHelper
77
import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata
88
import org.hl7.fhir.r4.model.Bundle
99
import org.hl7.fhir.r4.model.DiagnosticReport
10-
import org.hl7.fhir.r4.model.Practitioner
11-
import org.hl7.fhir.r4.model.Reference
1210
import org.hl7.fhir.r4.model.ServiceRequest
1311
import spock.lang.Specification
1412

@@ -119,7 +117,7 @@ class CopyOrcOrderProviderToObrOrderProviderTest extends Specification{
119117
evaluateOrc12Values(bundle, EXPECTED_NPI, EXPECTED_FIRST_NAME, EXPECTED_LAST_NAME, EXPECTED_NAME_TYPE_CODE, EXPECTED_IDENTIFIER_TYPE_CODE)
120118

121119
// OBR16 should not exist initially
122-
def obr16Practitioner = getObr16ExtensionPractitioner(serviceRequest)
120+
def obr16Practitioner = HapiHelper.getObr16ExtensionPractitioner(serviceRequest)
123121
obr16Practitioner == null
124122

125123
when:
@@ -191,7 +189,7 @@ class CopyOrcOrderProviderToObrOrderProviderTest extends Specification{
191189
}
192190

193191
void evaluateOrc12IsNull(Bundle bundle) {
194-
assert getOrc12ExtensionPractitioner(bundle) == null
192+
assert HapiHelper.getOrc12ExtensionPractitioner(bundle) == null
195193
}
196194

197195
void evaluateOrc12Values(
@@ -201,7 +199,7 @@ class CopyOrcOrderProviderToObrOrderProviderTest extends Specification{
201199
String expectedLastName,
202200
String expectedNameTypeCode,
203201
String expectedIdentifierTypeCode) {
204-
def practitioner = getOrc12ExtensionPractitioner(bundle)
202+
def practitioner = HapiHelper.getOrc12ExtensionPractitioner(bundle)
205203
def xcnExtension = practitioner.getExtensionByUrl(PRACTITIONER_EXTENSION_URL)
206204

207205
assert practitioner.identifier[0]?.value == expectedNpi
@@ -214,7 +212,8 @@ class CopyOrcOrderProviderToObrOrderProviderTest extends Specification{
214212
}
215213

216214
void evaluateObr16IsNull(ServiceRequest serviceRequest) {
217-
assert getObr16ExtensionPractitioner(serviceRequest) == null
215+
assert HapiHelper.getObr16Extension(serviceRequest) == null
216+
assert HapiHelper.getObr16ExtensionPractitioner(serviceRequest) == null
218217
}
219218

220219
void evaluateObr16Values(
@@ -224,7 +223,7 @@ class CopyOrcOrderProviderToObrOrderProviderTest extends Specification{
224223
String expectedLastName,
225224
String expectedNameTypeCode,
226225
String expectedIdentifierTypeCode) {
227-
def practitioner = getObr16ExtensionPractitioner(serviceRequest)
226+
def practitioner = HapiHelper.getObr16ExtensionPractitioner(serviceRequest)
228227
def xcnExtension = practitioner.getExtensionByUrl(PRACTITIONER_EXTENSION_URL)
229228

230229
assert practitioner.identifier[0]?.value == expectedNpi
@@ -234,40 +233,4 @@ class CopyOrcOrderProviderToObrOrderProviderTest extends Specification{
234233
def codingSystem = practitioner.identifier[0]?.type?.coding
235234
assert codingSystem == null || codingSystem[0]?.code == expectedIdentifierTypeCode
236235
}
237-
238-
Practitioner getObr16ExtensionPractitioner (serviceRequest) {
239-
def resource
240-
try {
241-
def extensionByUrl1 = serviceRequest.getExtensionByUrl(HapiHelper.EXTENSION_OBR_URL)
242-
def extensionByUrl2 = extensionByUrl1.getExtensionByUrl(HapiHelper.EXTENSION_OBR16_DATA_TYPE.toString())
243-
def value = extensionByUrl2.value
244-
resource = value.getResource()
245-
return resource
246-
} catch(Exception ignored) {
247-
resource = null
248-
return resource
249-
}
250-
}
251-
252-
Practitioner getOrc12ExtensionPractitioner(Bundle bundle) {
253-
def diagnosticReport = HapiHelper.getDiagnosticReport(bundle)
254-
def serviceRequest = HapiHelper.getServiceRequest(diagnosticReport)
255-
256-
def orcExtension = serviceRequest.getExtensionByUrl(HapiHelper.EXTENSION_ORC_URL)
257-
def orc12Extension = orcExtension.getExtensionByUrl(HapiHelper.EXTENSION_ORC12_URL)
258-
259-
if (orc12Extension == null) {
260-
return null
261-
}
262-
263-
def practitionerReference = (Reference) orc12Extension.getValue()
264-
def practitionerUrl = practitionerReference.getReference()
265-
266-
for (Bundle.BundleEntryComponent entry : bundle.getEntry()) {
267-
if (Objects.equals(entry.getFullUrl(), practitionerUrl) && entry.getResource() instanceof Practitioner)
268-
return (Practitioner) entry.getResource()
269-
}
270-
271-
return null
272-
}
273236
}

etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemovePatientIdentifierTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class RemovePatientIdentifierTest extends Specification {
3333

3434
when:
3535
transformClass.transform(fhirResource, null)
36-
def actualPid3_4 = HapiFhirHelper.getPID3_4Value(bundle)
37-
def actualPid3_5 = HapiFhirHelper.getPID3_5Value(bundle)
3836

3937
then:
38+
def actualPid3_4 = HapiFhirHelper.getPID3_4Value(bundle)
39+
def actualPid3_5 = HapiFhirHelper.getPID3_5Value(bundle)
4040
actualPid3_4 == null || actualPid3_4.isEmpty()
4141
actualPid3_5 == null || actualPid3_5.isEmpty()
4242
}

etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemovePatientNameTypeCodeTest.groovy

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@ class RemovePatientNameTypeCodeTest extends Specification {
2222

2323
def "remove PID.5-7 from Bundle"() {
2424
given:
25-
def fhirResource = ExamplesHelper.getExampleFhirResource("../CA/002_CA_ORU_R01_initial_translation.fhir")
25+
def fhirResource = ExamplesHelper.getExampleFhirResource("../CA/007_CA_ORU_R01_CDPH_produced_UCSD2024-07-11-16-02-17-749_1_hl7_translation.fhir")
2626
def bundle = fhirResource.getUnderlyingData() as Bundle
27-
def pid5_7 = HapiFhirHelper.getPID5_7Value(bundle)
27+
def pid5Extension = HapiHelper.getPID5Extension(bundle)
28+
def patientName = HapiHelper.getPIDPatient(bundle).getNameFirstRep()
29+
def patientNameUse = patientName.getUse()
2830

2931
expect:
30-
pid5_7 != null
32+
pid5Extension.getExtensionByUrl(HapiHelper.EXTENSION_XPN7_URL) != null
33+
patientNameUse.toString() == "OFFICIAL"
3134

3235
when:
3336
transformClass.transform(fhirResource, null)
3437

3538
then:
36-
HapiFhirHelper.getPID5_7Value(bundle) == null
39+
pid5Extension.getExtensionByUrl(HapiHelper.EXTENSION_XPN7_URL) == null
40+
!patientName.hasUse()
3741
}
3842

3943
def "don't throw exception if patient resource not present"() {

0 commit comments

Comments
 (0)