Skip to content

Commit

Permalink
bruno scripts for validating delete and $expunge
Browse files Browse the repository at this point in the history
  • Loading branch information
timcoffman committed Sep 30, 2024
1 parent 6397064 commit 8221ee6
Show file tree
Hide file tree
Showing 20 changed files with 424 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bruno/SupplementalDataStore/Capability Statement.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: Capability Statement
type: http
seq: 1
}

get {
url: {{base_url}}/metadata
body: none
auth: none
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta {
name: Create Encounter (my.patient)
type: http
seq: 1
}

put {
url: {{base_url}}/Encounter/enc.0001
body: json
auth: inherit
}

headers {
Accept: application/json
X-Partition-Name: {{url_auth}}
}

body:json {
{
"id": "enc.0001",
"resourceType": "Encounter",
"subject": { "reference": "{{pat_id_auth}}" }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
meta {
name: Search Encounters (my.patient)
type: http
seq: 2
}

get {
url: {{base_url}}/Encounter?subject={{pat_id_auth}}
body: none
auth: inherit
}

params:query {
subject: {{pat_id_auth}}
}

headers {
Accept: application/json
X-Partition-Name: {{url_auth}}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
meta {
name: Create New Local Patient
type: http
seq: 1
}

post {
url: {{base_url}}/Patient
body: json
auth: inherit
}

headers {
Accept: application/json
}

body:json {
{ "resourceType": "Patient" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta {
name: Create Encounter (my.patient)
type: http
seq: 1
}

put {
url: {{base_url}}/Encounter/enc.9001
body: json
auth: inherit
}

headers {
Accept: application/json
X-Partition-Name: {{url_other}}
}

body:json {
{
"id": "enc.9001",
"resourceType": "Encounter",
"subject": { "reference": "{{pat_id_other}}" }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
meta {
name: Search Encounters (my.patient)
type: http
seq: 2
}

get {
url: {{base_url}}/Encounter?subject={{pat_id_other}}
body: none
auth: inherit
}

params:query {
subject: {{pat_id_other}}
}

headers {
Accept: application/json
X-Partition-Name: {{url_other}}
}
27 changes: 27 additions & 0 deletions bruno/SupplementalDataStore/Expunge/Expunge (local).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
meta {
name: Expunge (local)
type: http
seq: 3
}

post {
url: {{base_url}}/{{pat_id_local}}/$expunge
body: json
auth: inherit
}

body:json {
{
"resourceType": "Parameters",
"parameter": [
{
"name": "expungeDeletedResources",
"valueBoolean": true
},
{
"name": "_cascade",
"valueString": "delete"
}
]
}
}
31 changes: 31 additions & 0 deletions bruno/SupplementalDataStore/Expunge/Expunge (my.patient).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
meta {
name: Expunge (my.patient)
type: http
seq: 1
}

post {
url: {{base_url}}/{{pat_id_auth}}/$expunge
body: json
auth: inherit
}

headers {
X-Partition-Name: {{url_auth}}
}

body:json {
{
"resourceType": "Parameters",
"parameter": [
{
"name": "expungeDeletedResources",
"valueBoolean": true
},
{
"name": "_cascade",
"valueString": "delete"
}
]
}
}
27 changes: 27 additions & 0 deletions bruno/SupplementalDataStore/Expunge/Expunge (other.patient).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
meta {
name: Expunge (other.patient)
type: http
seq: 2
}

post {
url: {{base_url}}/{{pat_id_auth}}/$expunge
body: json
auth: inherit
}

body:json {
{
"resourceType": "Parameters",
"parameter": [
{
"name": "expungeDeletedResources",
"valueBoolean": true
},
{
"name": "_cascade",
"valueString": "delete"
}
]
}
}
16 changes: 16 additions & 0 deletions bruno/SupplementalDataStore/Linkage/Search All Linkages.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
meta {
name: Search All Linkages
type: http
seq: 1
}

get {
url: {{base_url}}/Linkage
body: none
auth: inherit
}

headers {
Accept: application/json
Origin: http://localhost:9999
}
51 changes: 51 additions & 0 deletions bruno/SupplementalDataStore/Linkage/Search My Linkages.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
meta {
name: Search My Linkages
type: http
seq: 2
}

get {
url: {{base_url}}/Linkage?item={{pat_id_auth}}
body: none
auth: inherit
}

params:query {
item: {{pat_id_auth}}
}

headers {
Accept: application/json
}

script:post-response {
function unexpectedData( msg ) {
console.error( msg );
return null ;
}

function extractSourcePatId( body ) {
if ( body.resourceType !== 'Bundle' )
return unexpectedData( `resource is not a Bundle` ) ;
if ( !body.entry )
return unexpectedData( `bundle has no entries` ) ;
for ( const entry of body.entry ) {
if ( !entry.resource )
continue ;
const resource = entry.resource ;
if ( resource.resourceType !== 'Linkage' )
return unexpectedData( `resource is not a Linkage` ) ;
for ( const item of resource.item ) {
if ( item.type == 'source' )
return item.resource.reference ;
}
}
return unexpectedData(`missing entry with source item`);
}

const pat_id_local = extractSourcePatId(res.body) ;
if ( pat_id_local )
bru.setEnvVar( 'pat_id_local', pat_id_local ) ;
else
bru.setEnvVar( 'pat_id_local', `---not set---` ) ;
}
23 changes: 23 additions & 0 deletions bruno/SupplementalDataStore/Read/Read Patient (local).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
meta {
name: Read Patient (local)
type: http
seq: 3
}

get {
url: {{base_url}}/{{pat_id_local}}
body: none
auth: inherit
}

headers {
Accept: application/json
}

body:json {
{
"id": "enc.0001",
"resourceType": "Encounter",
"subject": { "reference": "{{pat_id_auth}}" }
}
}
24 changes: 24 additions & 0 deletions bruno/SupplementalDataStore/Read/Read Patient (my.patient).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta {
name: Read Patient (my.patient)
type: http
seq: 1
}

get {
url: {{base_url}}/{{pat_id_auth}}
body: none
auth: inherit
}

headers {
Accept: application/json
X-Partition-Name: {{url_auth}}
}

body:json {
{
"id": "enc.0001",
"resourceType": "Encounter",
"subject": { "reference": "{{pat_id_auth}}" }
}
}
24 changes: 24 additions & 0 deletions bruno/SupplementalDataStore/Read/Read Patient (other.patient).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta {
name: Read Patient (other.patient)
type: http
seq: 2
}

get {
url: {{base_url}}/{{pat_id_other}}
body: none
auth: inherit
}

headers {
Accept: application/json
X-Partition-Name: {{url_other}}
}

body:json {
{
"id": "enc.0001",
"resourceType": "Encounter",
"subject": { "reference": "{{pat_id_auth}}" }
}
}
19 changes: 19 additions & 0 deletions bruno/SupplementalDataStore/Soft Delete/Soft Delete (local).bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
meta {
name: Soft Delete (local)
type: http
seq: 3
}

delete {
url: {{base_url}}/{{pat_id_local}}?_cascade=delete
body: none
auth: inherit
}

params:query {
_cascade: delete
}

headers {
Accept: application/json
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
meta {
name: Soft Delete (my.patient)
type: http
seq: 1
}

delete {
url: {{base_url}}/{{pat_id_auth}}?_cascade=delete
body: none
auth: inherit
}

params:query {
_cascade: delete
}

headers {
Accept: application/json
X-Partition-Name: {{url_auth}}
}
Loading

0 comments on commit 8221ee6

Please sign in to comment.