Skip to content

Commit

Permalink
Fix resources and add status constraint Notify via Custom Resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ryukzak committed Jul 23, 2024
1 parent 212ea74 commit 94353f3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 75 deletions.
11 changes: 9 additions & 2 deletions aidbox-notify-via-custom-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To run the example, clone the repository and open the `index.html` file in your
In Aidbox REST Console:

```yaml
POST /FHIRSchema
POST /fhir/FHIRSchema
content-type: text/yaml
accept: text/yaml

Expand All @@ -84,7 +84,7 @@ elements:
```
```yaml
POST /FHIRSchema
POST /fhir/FHIRSchema
content-type: text/yaml
accept: text/yaml

Expand Down Expand Up @@ -112,6 +112,11 @@ elements:
status:
type: string
scalar: true
constraints:
cont-status:
human: "Status should be 'requested', 'in-progress' or 'completed'"
severity: "error"
expression: "%context='requested' or %context='in-progress' or %context='completed'"
binding:
valueSet: "http://hl7.org/fhir/ValueSet/task-status"
strength: required
Expand All @@ -131,6 +136,8 @@ elements:
refers: ["Patient"]
```
Here we use the standard task status value set ([link](https://hl7.org/fhir/valueset-task-status.html)) for `TutorNotification.status`, but it contains too many codes, so we restrict them via the element-specific constraint.

### Search Parameters

For our example we need to perform the following request types:
Expand Down
9 changes: 9 additions & 0 deletions aidbox-notify-via-custom-resources/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ window.bootstrap = async () => {
valueSet: "http://hl7.org/fhir/ValueSet/task-status",
strength: "required",
},
constraints: {
"cont-status": {
human:
"Status should be 'requested', 'in-progress' or 'completed'",
severity: "error",
expression:
"%context='requested' or %context='in-progress' or %context='completed'",
},
},
},
template: {
type: "Reference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ elements:
type: string
scalar: true

# POST /TutorNotificationTemplate
# id: welcome
# resourceType: TutorNotificationTemplate
# template: |
# Hello user name: {{patient.name.given}}

---

id: TutorNotification
Expand All @@ -45,8 +39,12 @@ elements:
status:
type: string
scalar: true
constraints:
cont-status:
human: "Status should be 'requested', 'in-progress' or 'completed'"
severity: "error"
expression: "%context='requested' or %context='in-progress' or %context='completed'"
binding:
# TODO: constrains?
valueSet: "http://hl7.org/fhir/ValueSet/task-status"
strength: required
template:
Expand All @@ -64,60 +62,37 @@ elements:
scalar: true
refers: ["Patient"]







# POST /fhir/TutorNotification

# type: sms
# status: requested
# template:
# reference: "TutorNotificationTemplate/welcome"
# sendAfter: "2024-07-12T12:00:00Z"
# subject:
# reference: "Patient/pt-1"

# GET /fhir/TutorNotification?_count=1&_include=subject


---

resourceType: SearchParameter
id: TutorNotification-status
url: http://example.com/aidbox-sms-tutor/TutorNotification-status
id: TutorNotification-type
url: http://example.com/aidbox-sms-tutor/TutorNotification-type
version: 0.0.1
status: draft

name: status
code: status
name: type
code: type
base:
- TutorNotification
type: token
description: Search TutorNotification by status
expression: TutorNotification.status

# GET /fhir/TutorNotification?_count=1&status=requested
description: Search TutorNotification by type
expression: TutorNotification.type

---

resourceType: SearchParameter
id: TutorNotification-type
url: http://example.com/aidbox-sms-tutor/TutorNotification-type
id: TutorNotification-status
url: http://example.com/aidbox-sms-tutor/TutorNotification-status
version: 0.0.1
status: draft

name: type
code: type
name: status
code: status
base:
- TutorNotification
type: token
description: Search TutorNotification by type
expression: TutorNotification.type

# GET /fhir/TutorNotification?_count=1&type=sms
description: Search TutorNotification by status
expression: TutorNotification.status

---

Expand All @@ -135,8 +110,6 @@ type: date
description: Search TutorNotification by sendAfter
expression: TutorNotification.sendAfter

# GET /fhir/TutorNotification?_count=1&after=gt2024-06-12T12:00:00Z

---

resourceType: SearchParameter
Expand All @@ -153,8 +126,6 @@ type: reference
description: Search TutorNotification by subject
expression: TutorNotification.subject

# GET /fhir/TutorNotification?_count=1&after=gt2024-06-12T12:00:00Z

---

resourceType: SearchParameter
Expand All @@ -171,33 +142,18 @@ type: reference
description: Search TutorNotification by template
expression: TutorNotification.template

# GET /TutorNotification?_count=1&_include=TutorNotification:template:TutorNotificationTemplate



# GET /fhir/TutorNotification?_count=1&_include=TutorNotification:subject:Patient&_include=TutorNotification:template:TutorNotificationTemplate


# GET /fhir/TutorNotification?_count=1&type=sms&status=requested&after=gt2024-06-12T12:00:00Z
---

id: welcome
resourceType: TutorNotificationTemplate
template: |
Hello user name: {{patient.name.given}}
---

# extension:
# - url: http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status
# valueCode: trial-use
# experimental: true
# date: "2023-03-26T15:21:02+11:00"
# publisher: Health Level Seven International (Patient Administration)
# contact:
# - telecom:
# - system: url
# value: http://hl7.org/fhir
# - telecom:
# - system: url
# value: http://www.hl7.org/Special/committees/pafm/index.cfm
# jurisdiction:
# - coding:
# - system: http://unstats.un.org/unsd/methods/m49/m49.htm
# code: "001"
# display: World
# processingMode: normal
id: pt-1
name:
- given:
- James
family: Morgan
resourceType: Patient

0 comments on commit 94353f3

Please sign in to comment.