-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Unterstützung FHIR VZD FdV und Search Schnittstellen, s. `vzd-cli fhir` - Neues Befehl für übergreifenden login: `vzd-cli login` - Tägliche Überprüfung der Updates ist jetzt abschaltbar `vzd-cli config set updates.enabled true|false` - Diverse Bugfixes
- Loading branch information
Showing
97 changed files
with
2,359 additions
and
382 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
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
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
3 changes: 2 additions & 1 deletion
3
...lin/de/gematik/ti/directory/admin/Auth.kt → ...in/kotlin/de/gematik/ti/directory/Auth.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
4 changes: 2 additions & 2 deletions
4
...ik/ti/directory/admin/AdminEnvironment.kt → ...atik/ti/directory/DirectoryEnvironment.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
5 changes: 2 additions & 3 deletions
5
directory-lib/src/main/kotlin/de/gematik/ti/directory/admin/Client.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
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
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
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
71 changes: 71 additions & 0 deletions
71
directory-lib/src/main/kotlin/de/gematik/ti/directory/fhir/BundleExtension.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,71 @@ | ||
package de.gematik.ti.directory.fhir | ||
|
||
import org.hl7.fhir.r4.model.* | ||
|
||
fun Bundle.filterByType(resourceType: ResourceType): List<Resource> { | ||
return entry.filter { it.resource.resourceType == resourceType }.map { it.resource } | ||
} | ||
|
||
fun Bundle.filterPractitionerRoles(): List<FHIRDirectoryEntry> { | ||
return filterByType(ResourceType.PractitionerRole).map { resource -> | ||
val practitionerRole = resource as PractitionerRole | ||
val practitioner = findResource(practitionerRole.practitioner)?.resource?.let { it as Practitioner } | ||
|
||
FHIRDirectoryEntry( | ||
telematikID = practitioner?.identifier?.firstOrNull { it.system == "https://gematik.de/fhir/sid/telematik-id" }?.value, | ||
displayName = practitioner?.name?.firstOrNull()?.text, | ||
resourceType = ResourceType.PractitionerRole, | ||
practitionerRole = practitionerRole, | ||
practitioner = practitioner, | ||
location = | ||
practitionerRole.location?.mapNotNull { | ||
findResource(it)?.resource | ||
}?.map { | ||
it as Location | ||
}?.ifEmpty { null }, | ||
endpoint = | ||
practitionerRole.endpoint?.mapNotNull { | ||
findResource(it)?.resource | ||
}?.map { | ||
it as Endpoint | ||
}?.ifEmpty { null }, | ||
) | ||
} | ||
} | ||
|
||
fun Bundle.filterHealthcareServices(): List<FHIRDirectoryEntry> { | ||
return filterByType(ResourceType.HealthcareService).map { resource -> | ||
val healthcareService = resource as HealthcareService | ||
val organization = findResource(healthcareService.providedBy)?.resource?.let { it as Organization } | ||
FHIRDirectoryEntry( | ||
telematikID = organization?.identifier?.firstOrNull { it.system == "https://gematik.de/fhir/sid/telematik-id" }?.value, | ||
displayName = organization?.name, | ||
resourceType = ResourceType.HealthcareService, | ||
healthcareService = healthcareService, | ||
organization = organization, | ||
location = | ||
healthcareService.location?.mapNotNull { | ||
findResource(it)?.resource | ||
}?.map { | ||
it as Location | ||
}?.ifEmpty { null }, | ||
endpoint = | ||
healthcareService.endpoint?.mapNotNull { | ||
findResource(it)?.resource | ||
}?.map { | ||
it as Endpoint | ||
}?.ifEmpty { null }, | ||
) | ||
} | ||
} | ||
|
||
fun Bundle.toDirectoryEntries(): List<FHIRDirectoryEntry> { | ||
return filterPractitionerRoles() + filterHealthcareServices() | ||
} | ||
|
||
fun Bundle.findResource(reference: Reference): Bundle.BundleEntryComponent? { | ||
val id = IdType(reference.reference) | ||
return this.entry.find { | ||
it.resource?.fhirType() == id.resourceType && it.resource?.idElement?.idPart == id.idPart | ||
} | ||
} |
Oops, something went wrong.