Skip to content

Commit

Permalink
#446: fix ATNA to FHIR translation
Browse files Browse the repository at this point in the history
  • Loading branch information
unixoid committed Apr 3, 2024
1 parent 04a5728 commit 1371724
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AuditRecordTranslator implements ToFhirTranslator<AuditMessage> {
.setAddress(atna.networkAccessPointID)
.setType(new AuditEvent.AuditEventAgentNetworkTypeEnumFactory().fromCode(Short.toString(atna.networkAccessPointTypeCode.value)))
}
fhir
return fhir
}

static AuditEvent.AuditEventEntityComponent participantObject(ParticipantObjectIdentificationType atna) {
Expand All @@ -101,14 +101,15 @@ class AuditRecordTranslator implements ToFhirTranslator<AuditMessage> {
type: codeableConcept(atna.participantObjectIDTypeCode)))
fhir.type = codingEnum(new AuditEntityTypeEnumFactory().fromCode(Short.toString(atna.participantObjectTypeCode.value)))
fhir.role = codingEnum(new ObjectRoleEnumFactory().fromCode(Short.toString(atna.participantObjectTypeCodeRole.value)))
fhir.query = atna.participantObjectQuery
atna.participantObjectDetails.each {
fhir.addDetail(new AuditEvent.AuditEventEntityDetailComponent(type: it.type, value: new Base64BinaryType(it.value)))
}
fhir
return fhir
}

AuditEvent translate(AuditMessage atna) {
translateToFhir(atna, null)
return translateToFhir(atna, null)
}

@Override
Expand All @@ -118,6 +119,6 @@ class AuditRecordTranslator implements ToFhirTranslator<AuditMessage> {
auditMessage.auditSourceIdentification)
auditMessage.activeParticipants.each { fhir.addAgent(participant(it)) }
auditMessage.participantObjectIdentifications.each { fhir.addEntity(participantObject(it)) }
fhir
return fhir
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class AuditRecordTranslatorTest {
auditEvent.entity.each { entity ->
assert entity.what.identifier.type != null
}
assert auditEvent.entity[2].query.length == 47
}

static AuditMessage createAuditMessage1() {
Expand Down Expand Up @@ -119,7 +120,12 @@ class AuditRecordTranslatorTest {
participantObjectTypeCode = ParticipantObjectTypeCode.Person
participantObjectTypeCodeRole = ParticipantObjectTypeCodeRole.Patient
participantObjectName = 'John Doe'
}
},
new ParticipantObjectIdentificationType('queryId', ParticipantObjectIdTypeCode.SearchCriteria).with(true) {
participantObjectTypeCode = ParticipantObjectTypeCode.Other
participantObjectTypeCodeRole = ParticipantObjectTypeCodeRole.Query
participantObjectQuery = 'SELECT * FROM documents WHERE type="TOP SECRET"'.bytes
},
]
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AuditRecordTranslator implements ToFhirTranslator<AuditMessage> {
.setAddress(atna.networkAccessPointID)
.setType(new AuditEvent.AuditEventAgentNetworkTypeEnumFactory().fromCode(Short.toString(atna.networkAccessPointTypeCode.value)))
}
fhir
return fhir
}

static AuditEvent.AuditEventEntityComponent participantObject(ParticipantObjectIdentificationType atna) {
Expand All @@ -101,14 +101,15 @@ class AuditRecordTranslator implements ToFhirTranslator<AuditMessage> {
/*type: codeableConcept(atna.participantObjectIDTypeCode)*/)
fhir.type = codingEnum(new ObjectTypeEnumFactory().fromCode(Short.toString(atna.participantObjectTypeCode.value)))
fhir.role = codingEnum(new ObjectRoleEnumFactory().fromCode(Short.toString(atna.participantObjectTypeCodeRole.value)))
fhir.query = atna.participantObjectQuery
atna.participantObjectDetails.each {
fhir.addDetail(new AuditEvent.AuditEventEntityDetailComponent(type: it.type, value: it.value))
}
fhir
return fhir
}

AuditEvent translate(AuditMessage atna) {
translateToFhir(atna, null)
return translateToFhir(atna, null)
}

@Override
Expand All @@ -118,6 +119,6 @@ class AuditRecordTranslator implements ToFhirTranslator<AuditMessage> {
auditMessage.auditSourceIdentification)
auditMessage.activeParticipants.each { fhir.addAgent(participant(it)) }
auditMessage.participantObjectIdentifications.each { fhir.addEntity(participantObject(it)) }
fhir
return fhir
}
}
5 changes: 5 additions & 0 deletions src/site/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<author email="christian.ohr@gmail.com">Christian Ohr</author>
</properties>
<body>
<release version="" description="" date="">
<action issue="446" dev="Ivan1pl" type="fix">
Properly handle query payload when translating ATNA audit records to FHIR
</action>
</release>
<release version="4.8.0" description="IPF 4.8.0" date="14 Mar 2024">
<action issue="444" dev="ohr" type="fix">
Fix type in translation from HL7v3 to HL7v2 of deceasedIndicator
Expand Down

0 comments on commit 1371724

Please sign in to comment.