generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add summary classes, update bundle digest extractor to return summaries
- Loading branch information
1 parent
0c5e0b0
commit 187c99d
Showing
4 changed files
with
94 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
prime-router/src/main/kotlin/azure/observability/event/OrderingFacilitySummary.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package gov.cdc.prime.router.azure.observability.event | ||
|
||
import org.hl7.fhir.r4.model.Base | ||
import org.hl7.fhir.r4.model.Organization | ||
|
||
data class OrderingFacilitySummary ( | ||
val orderingFacilityName: String = UNKNOWN, | ||
val orderingFacilityState: String = UNKNOWN, | ||
) { | ||
companion object { | ||
const val UNKNOWN = "Unknown" | ||
const val orderingFacilityNamePath = "Bundle.entry.resource.name" | ||
const val orderingFacilityStatePath = "Bundle.entry.resource.address.state" | ||
|
||
/** | ||
* Create an instance of [OrderingFacilitySummary] from a [Organization] | ||
*/ | ||
fun fromOrganization(requester: Base): OrderingFacilitySummary { | ||
// For a given organization, return a OrderingFacilitySummary object from the paths listed above. | ||
val organizationName = requester.getNamedProperty(orderingFacilityNamePath) | ||
val organizationState = requester.getNamedProperty(orderingFacilityStatePath) | ||
|
||
return OrderingFacilitySummary( | ||
(organizationName ?: PerformerSummary.UNKNOWN).toString(), | ||
(organizationState ?: PerformerSummary.UNKNOWN).toString(), | ||
) | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
prime-router/src/main/kotlin/azure/observability/event/PerformerSummary.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package gov.cdc.prime.router.azure.observability.event | ||
|
||
import org.hl7.fhir.r4.model.Base | ||
import org.hl7.fhir.r4.model.DomainResource | ||
|
||
data class PerformerSummary ( | ||
val performerName: String = UNKNOWN, | ||
val performerState: String = UNKNOWN, | ||
val performerCLIA: String = UNKNOWN, | ||
) { | ||
companion object { | ||
const val UNKNOWN = "Unknown" | ||
const val performerNamePath = "Bundle.entry.resource.name" | ||
const val performerStatePath = "Bundle.entry.resource.address.state" | ||
const val performerCLIAPath = "Bundle.entry.resource.identifier.value.getIdType() = 'CLIA'" | ||
|
||
/** | ||
* Create an instance of [PerformerSummary] from a [DomainResource] | ||
*/ | ||
fun fromPerformer(performer: Base): PerformerSummary { | ||
// For a given reference, resolve the object. This can reference many differing FHIR resource types | ||
// (Practitioner, Organization, etc). Return a PerformerSummary object from the paths listed above. | ||
val performerName = performer.getNamedProperty(performerNamePath) | ||
val performerState = performer.getNamedProperty(performerStatePath) | ||
val performerCLIA = performer.getNamedProperty(performerCLIAPath) | ||
|
||
return PerformerSummary( | ||
(performerName ?: PerformerSummary.UNKNOWN).toString(), | ||
(performerState ?: PerformerSummary.UNKNOWN).toString(), | ||
(performerCLIA ?: PerformerSummary.UNKNOWN).toString(), | ||
) | ||
} | ||
} | ||
} |