Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove la obr except 54089 8 #1518

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
18 changes: 18 additions & 0 deletions etor/src/main/resources/transformation_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@
}
]
},
{
"name": "laOchsnerOruRemoveObservationRequests",
"description": "Removes all OBRs from an LA Ochsner ORU message except for the OBR with value '54089-8' in OBR-4.1. All OBXs are attached to the sole remaining OBR",
"message": "",
"conditions": [
"Bundle.entry.resource.ofType(MessageHeader).destination.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id').value = '1.2.840.114350.1.13.286.2.7.2.695071'",
"Bundle.entry.resource.ofType(MessageHeader).event.code = 'R01'",
"Bundle.entry.resource.ofType(ServiceRequest).code.coding.where(code = '54089-8').exists()"
],
"rules": [
{
"name": "RemoveObservationRequests",
"args": {
"universalServiceIdentifier": "54089-8"
}
}
]
},
{
"name": "ucsdOruUpdateUniversalServiceIdentifier",
"description": "Updates the coding system name (OBR-4.3) for ORU orders to the expected value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,36 @@ class RemoveObservationRequestsTest extends Specification {
thrown(ClassCastException)
}

def "remove all LA Ochsner's OBRs except for the one with OBR-4.1 = '54089-8'"() {
given:
def fhirResource = ExamplesHelper.getExampleFhirResource("../LA/002_LA_ORU_R01_ORU_removal_test_file.fhir")
def bundle = fhirResource.getUnderlyingData() as Bundle

def initialDiagnosticReports = HapiHelper.resourcesInBundle(bundle, DiagnosticReport).toList()
def initialServiceRequests = HapiHelper.resourcesInBundle(bundle, ServiceRequest).toList()
def initialObservations = HapiHelper.resourcesInBundle(bundle, Observation).toList()
def obr4_1Values = initialServiceRequests.collect { HapiHelper.getOBR4_1Value(it) }

expect:
initialDiagnosticReports.size() > 1
initialServiceRequests.size() > 1
initialObservations.size() > 1
obr4_1 in obr4_1Values

when:
transformClass.transform(fhirResource, args)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding assertions to verify that OBX IDs are sequential and unique after the transformation. This is crucial to meet the ticket requirements and ensure data integrity. [important]

def diagnosticReports = HapiHelper.resourcesInBundle(bundle, DiagnosticReport).toList()
def serviceRequests = HapiHelper.resourcesInBundle(bundle, ServiceRequest).toList()
def dr = diagnosticReports.first() as DiagnosticReport
def sr = HapiHelper.getServiceRequest(dr)

then:
diagnosticReports.size() == 1
serviceRequests.size() == 1
HapiHelper.getOBR4_1Value(sr) == obr4_1
}

def "remove all OBRs except for the one with OBR-4.1 = '54089-8'"() {
def "remove all CA USCD's OBRs except for the one with OBR-4.1 = '54089-8'"() {
given:
def fhirResource = ExamplesHelper.getExampleFhirResource("../CA/002_CA_ORU_R01_initial_translation.fhir")
def bundle = fhirResource.getUnderlyingData() as Bundle
Expand Down
Loading