Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination Fix #4613

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions build/jobs/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ steps:
$acrSettings = $appSettings | where {$_.Name -eq "FhirServer__Operations__ConvertData__ContainerRegistryServers__0"}
$acrLoginServer = $acrSettings[0].Value
$acrAccountName = ($acrLoginServer -split '\.')[0]
$acrPassword = (Get-AzContainerRegistryCredential -ResourceGroupName $(ResourceGroupName) -Name $acrAccountName).Password
Write-Host "##vso[task.setvariable variable=TestContainerRegistryServer]$($acrLoginServer)"
Write-Host "##vso[task.setvariable variable=TestContainerRegistryPassword]$($acrPassword)"

## This needs to be moved to MI, WI #125246
# $acrPassword = (Get-AzContainerRegistryCredential -ResourceGroupName $(ResourceGroupName) -Name $acrAccountName).Password
# Write-Host "##vso[task.setvariable variable=TestContainerRegistryServer]$($acrLoginServer)"
# Write-Host "##vso[task.setvariable variable=TestContainerRegistryPassword]$($acrPassword)"

$exportStoreSettings = $appSettings | where {$_.Name -eq "FhirServer__Operations__Export__StorageAccountUri"}
$exportStoreUri = $exportStoreSettings[0].Value
Expand Down Expand Up @@ -97,8 +99,6 @@ steps:
'TestEnvironmentUrl_${{ parameters.version }}_Sql': $(TestEnvironmentUrl_${{ parameters.version }}_Sql)
'Resource': $(Resource)
'AllStorageAccounts': $(AllStorageAccounts)
'TestContainerRegistryServer': $(TestContainerRegistryServer)
'TestContainerRegistryPassword': $(TestContainerRegistryPassword)
'TestExportStoreUri': $(TestExportStoreUri)
'TestExportStoreKey': $(TestExportStoreKey)
'TestIntegrationStoreUri': $(TestIntegrationStoreUri)
Expand Down
110 changes: 110 additions & 0 deletions docs/rest/Bug Repros/Pagination Bug - 8-2024/PaginationBug.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
@hostname = localhost:44348

### Get the bearer token, if authentication is enabled
# @name bearer
POST https://{{hostname}}/connect/token
content-type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id=globalAdminServicePrincipal
&client_secret=globalAdminServicePrincipal
&scope=fhir-api

###
@token = {{bearer.response.body.access_token}}

### Pagination bug 1 - Counting included resources and missing matched resources when using include, decending sort, and the right _count value
# Setup test data
# @name batch
POST https://{{hostname}}
Content-Type: application/json
Authorization: Bearer {{token}}

< ./PaginationBugData.json

### Reindex
# Trigger a reindexing operation.
# @name reindex
POST https://{{hostname}}/$reindex HTTP/1.1
Authorization: Bearer {{token}}
content-type: application/json

{ "resourceType": "Parameters", "parameter": [] }

### Records the reindex job location
@reindexLocation = {{reindex.response.headers.Content-Location}}

###
# Check the status of the reindexing operation
GET {{reindexLocation}} HTTP/1.1
Authorization: Bearer {{token}}

###
# Count <=2 gives one match and no next link, total = 1
# Count =3 gives one match and a next link, total = 2
# Count >=4 gives two matches and no next link, total = 2
#
# With just Condition:extension-care-goals a count of 2 produces the issue
POST https://{{hostname}}/Condition/_search
Content-Type: application/x-www-form-urlencoded
Accept: application/json, text/plain, */*
Authorization: Bearer {{token}}

patient=859f091b-75a0-4690-8f45-ce192c5e045a
&category=main
&_count=2
&_total=accurate
&_sort=-onset-date
&_include=Condition:extension-care-goals

###
# when the sort order is decreasing
GET https://{{hostname}}/MedicationDispense?_include=MedicationDispense:prescription&_sort=-whenprepared&_count=3&_total=accurate&_tag=a696ad4e-9e07-4266-8727-d1e3b9f193cd
Authorization: Bearer {{token}}


### Pagination bug 2 - Reverse chain counting deleted resources when it shouldn't
# Setup data
POST https://{{hostname}}
Content-Type: application/json
Authorization: Bearer {{token}}

< ./PaginationBugData2.json

### Delete Patient
DELETE https://{{hostname}}/Patient/pagination-patient2
Authorization: Bearer {{token}}

### Gets the first patient but has the wrong total value
# @name getservicerequest
POST https://{{hostname}}/Patient/_search
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{token}}

_total=accurate
&_count=1
&_has:CareTeam:patient:participant=pagination-practitioner1

### Gets the summary count (also wrong)
GET https://{{hostname}}/Patient?_summary=count&_has:CareTeam:patient:participant=pagination-practitioner1
Authorization: Bearer {{token}}

### Tests if a non-existant referenced resource is counted (it isn't)
PUT https://{{hostname}}/CareTeam/pagination-careteam4
Content-Type: application/json
Authorization: Bearer {{token}}

{
"resourceType": "CareTeam",
"id": "pagination-careteam4",
"participant": [
{
"member": {
"reference": "Practitioner/pagination-practitioner1"
}
}
],
"subject": {
"reference": "Patient/pagination-patient-invalid"
}
}
153 changes: 153 additions & 0 deletions docs/rest/Bug Repros/Pagination Bug - 8-2024/PaginationBugData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"resource": {
"resourceType": "Condition",
"id": "c96b32a1-ac09-4c1a-8007-0baa001f16ac",
"extension": [
{
"extension": [
{
"url": "care_goal",
"valueReference": {
"reference": "Goal/fc7e482e-c69c-4027-9d06-a3ca1131c03f",
"type": "Goal",
"display": "John Smith"
}
},
{
"url": "care_goal",
"valueReference": {
"reference": "Goal/18f1d605-351e-4db9-ae2a-c2749b42ccbf",
"type": "Goal",
"display": "John Smith"
}
}],
"url": "https://domo.health/fhir/extension/care_goals"
}],
"category": [
{
"coding": [
{
"system": "http://www.domo.health/coding",
"code": "main",
"display": "John Smith"
}],
"text": "Diagnosis that can have Subsidiary diagnosis"
}],
"subject": {
"reference": "Patient/859f091b-75a0-4690-8f45-ce192c5e045a",
"type": "Patient"
},
"onsetDateTime": "2024",
"recordedDate": "2024-08-07T10:50:35.441Z"
},
"request": {
"method": "PUT",
"url": "Condition/c96b32a1-ac09-4c1a-8007-0baa001f16ac"
}
},
{
"resource": {
"resourceType": "Goal",
"id": "fc7e482e-c69c-4027-9d06-a3ca1131c03f",
"lifecycleStatus": "active",
"subject": {
"reference": "Patient/859f091b-75a0-4690-8f45-ce192c5e045a",
"type": "Patient"
},
"description": [
{
"text": "something"
}],
"startDate": "2024-06-24",
"statusDate": "2024-06-24"
},
"request": {
"method": "PUT",
"url": "Goal/fc7e482e-c69c-4027-9d06-a3ca1131c03f"
}
},
{
"resource": {
"resourceType": "Goal",
"id": "18f1d605-351e-4db9-ae2a-c2749b42ccbf",
"lifecycleStatus": "active",
"subject": {
"reference": "Patient/859f091b-75a0-4690-8f45-ce192c5e045a",
"type": "Patient"
},
"description": [
{
"text": "something"
}],
"startDate": "2024-07-10",
"statusDate": "2024-07-10"
},
"request": {
"method": "PUT",
"url": "Goal/18f1d605-351e-4db9-ae2a-c2749b42ccbf"
}
},
{
"resource": {
"resourceType": "Condition",
"id": "7b06a53c-1eb4-4352-a810-d9b4651d1b1f",
"category": [
{
"coding": [
{
"system": "http://www.domo.health/coding",
"code": "main",
"display": "John Smith"
}],
"text": "Diagnosis that can have Subsidiary diagnosis"
}],
"subject": {
"reference": "Patient/859f091b-75a0-4690-8f45-ce192c5e045a",
"type": "Patient"
},
"recordedDate": "2024-06-12T11:40:41.846Z"
},
"request": {
"method": "PUT",
"url": "Condition/7b06a53c-1eb4-4352-a810-d9b4651d1b1f"
}
},
{
"resource": {
"resourceType": "SearchParameter",
"url": "https://domo.health/fhir/search-params/extension-care-goals",
"name": "extensionCareGoals",
"publisher": "DomoSafety SA",
"status": "active",
"contact": [
{
"telecom": [
{
"system": "url",
"value": "https://www.domo-safety.com/"
}]
}],
"description": "Returns care goals with a goal id matching the specified string.",
"code": "extension-care-goals",
"base": [
"Composition",
"Condition",
"MedicationRequest",
"ServiceRequest"
],
"type": "reference",
"expression": "extension.where(url = 'https://domo.health/fhir/extension/care_goals').extension.where(url = 'care_goal').value",
"multipleOr": true,
"multipleAnd": true
},
"request": {
"method": "POST",
"url": "SearchParameter"
}
}
]
}
106 changes: 106 additions & 0 deletions docs/rest/Bug Repros/Pagination Bug - 8-2024/PaginationBugData2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"resource": {
"resourceType": "CareTeam",
"id": "pagination-careteam1",
"participant": [
{
"member": {
"reference": "Practitioner/pagination-practitioner1"
}
}
],
"subject": {
"reference": "Patient/pagination-patient1"
}
},
"request": {
"method": "PUT",
"url": "CareTeam/pagination-careteam1"
}
},
{
"resource": {
"resourceType": "CareTeam",
"id": "pagination-careteam2",
"participant": [
{
"member": {
"reference": "Practitioner/pagination-practitioner1"
}
}
],
"subject": {
"reference": "Patient/pagination-patient2"
}
},
"request": {
"method": "PUT",
"url": "CareTeam/pagination-careteam2"
}
},
{
"resource": {
"resourceType": "CareTeam",
"id": "pagination-careteam3",
"participant": [
{
"member": {
"reference": "Practitioner/pagination-practitioner1"
}
}
],
"subject": {
"reference": "Patient/pagination-patient3"
}
},
"request": {
"method": "PUT",
"url": "CareTeam/pagination-careteam3"
}
},
{
"resource": {
"resourceType": "Patient",
"id": "pagination-patient1"
},
"request": {
"method": "PUT",
"url": "Patient/pagination-patient1"
}
},
{
"resource": {
"resourceType": "Patient",
"id": "pagination-patient2"
},
"request": {
"method": "PUT",
"url": "Patient/pagination-patient2"
}
},
{
"resource": {
"resourceType": "Patient",
"id": "pagination-patient3"
},
"request": {
"method": "PUT",
"url": "Patient/pagination-patient3"
}
},
{
"resource": {
"resourceType": "Practitioner",
"id": "pagination-practitioner1"
},
"request": {
"method": "PUT",
"url": "Practitioner/pagination-practitioner1"
}
}
]
}
Loading
Loading