-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable topic based subscription for Observation
- Loading branch information
Showing
2 changed files
with
69 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{:deps {}} | ||
{:deps | ||
{fhir.topic-based-subscription | ||
"https://github.com/zen-fhir/hl7-fhir-uv-subscriptions-backport-r4b.git"}} |
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 |
---|---|---|
@@ -1,6 +1,71 @@ | ||
{ns system | ||
import #{aidbox} | ||
import #{aidbox | ||
fhir.topic-based-subscription | ||
hl7-fhir-uv-subscriptions-backport-r4b} | ||
|
||
observation-topic | ||
{:zen/tags #{fhir.topic-based-subscription/topic-definition} | ||
;; SubscriptionTopic url should be an absolute URI (globally unique) | ||
:url "urn:aidbox-python-sdk:SubscriptionTopic:observations" | ||
:resourceTrigger [ | ||
;; an SubscriptionTopic may consist | ||
;; of any number of resources | ||
{:resource "Observation" | ||
:fhirPathCriteria "%current.value.ofType(Quantity).value > 10"}] | ||
:canFilterBy [{:resource "Observation" | ||
:filterParameter "value" | ||
;; _fhirPath specifies how to calculate value for the filter | ||
:_fhirPath "%current.value.ofType(Quantity).value" | ||
:modifier ["eq" "gt" "lt" "ge" "le"]} | ||
|
||
{:resource "Observation" | ||
:filterParameter "value-increase" | ||
;; both %current and %previous state of the | ||
;; resource are available | ||
:_fhirPath "%current.value.ofType(Quantity).value > %previous.value.ofType(Quantity).value" | ||
:modifier ["eq"]}]} | ||
|
||
|
||
postgres-observation-topic-storage | ||
{:zen/tags #{fhir.topic-based-subscription/topic-storage} | ||
;; At the moment only PostgreSQL is available as a storage | ||
:storage-type fhir.topic-based-subscription/postgres | ||
;; The name of the table which will be created to store topic events: | ||
:table-name "observation_topic" | ||
;; Possible value for maxContent are: "empty" | "id-only" | "full-resource" | ||
;; The actual Resource is only stored in queue when "full-resource" value | ||
;; are specified. When deciding which payload type to request, | ||
;; systems SHOULD consider both ease of processing and security of PHI. | ||
;; To mitigate the risk of information leakage, systems SHOULD use the | ||
;; minimum level of detail consistent with the use case. | ||
;; In practice, id-only provides a good balance between security | ||
;; and performance for many real-world scenarios. | ||
:maxContent "full-resource" | ||
;; The period, in seconds, during which events from the replication slot | ||
;; will be buffered before being written to storage: | ||
:timeout 10 | ||
;; The maximum number of events the replication slot will buffer before | ||
;; writing to storage: | ||
:maxCount 100 | ||
;; Interval in seconds periodic heartbeat record generation | ||
;; in cdc_topic_heartbeat_table, to reclaim the WAL space: | ||
:heartbeat-rate 120 | ||
;; The number of workers responsible for notification delivery. | ||
;; min number 4 is advised. One worker can handle up to 1024 subsrciptions: | ||
:senders-number 4} | ||
|
||
|
||
;; Service which binds storage with topic definition | ||
observation-topic-srv | ||
{:zen/tags #{aidbox/service} | ||
:engine fhir.topic-based-subscription/change-data-capture-service-engine | ||
:topic-definition observation-topic | ||
:topic-storage postgres-observation-topic-storage} | ||
|
||
|
||
;; Entrypoint for the instance with corresponding service | ||
|
||
box | ||
{:zen/tags #{aidbox/system} | ||
:services {:observation-topic-srv observation-topic-srv} | ||
:zen/desc "Test python sdk"}} |