awslabs/fhir-works-on-aws-deployment

[Misc] Unable to search AllergyIntolerance when adding patient parameter to URL

inatam opened this issue · 6 comments

When we try to search AllergyIntolerance adding patient parameter to URL, no results are returned, even though the parameter matches the value in AllergyIntolerance.patient.reference.
For example:
The data "patient=9999999999" exists, but we cannot find it.

How to check

  1. AllergyIntolerance data registration
  • Data Registration
curl --location --request POST 'https://xxx.amazonaws.com/dev/AllergyIntolerance' \
--header 'Content-Type: application/json' \
--header 'x-api-key: XXX' \
--header 'Authorization: Bearer XXX' \
--data-raw '{
    "resourceType": "AllergyIntolerance",
    "id": "0000057725-ARG10-ARG010-1",
    "meta": {
        "lastUpdated": "2021-08-23T12:04:38.000+09:00"
    },
    "language": "ja",
    "clinicalStatus": {
        "coding": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                "version": "4.0.1",
                "code": "active",
                "display": "Active"
            }
        ]
    },
    "category": [
        "food"
    ],
    "code": {
        "text": "卵"
    },
    "patient": {
        "reference": "9999999999",
        "type": "Patient"
    },
    "onsetDateTime": "2021-09-01",
    "recordedDate": "2021-08-23T12:04:37+09:00",
    "recorder": {
        "reference": "Practitioner/XXX",
        "type": "Practitioner"
    },
    "reaction": [
        {
            "manifestation": [
                {
                    "text": "皮膚症状"
                }
            ]
        }
    ]
}
'
  • Response Body
{
    "resourceType": "AllergyIntolerance",
    "id": "1cea96d3-dbec-4d23-8986-0f4cbbfbeebd",
    "meta": {
        "lastUpdated": "2023-02-22T05:40:05.394Z",
        "versionId": "1"
    },
    "language": "ja",
    "clinicalStatus": {
        "coding": [
            {
                "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                "version": "4.0.1",
                "code": "active",
                "display": "Active"
            }
        ]
    },
    "category": [
        "food"
    ],
    "code": {
        "text": "卵"
    },
    "patient": {
        "reference": "9999999999",
        "type": "Patient"
    },
    "onsetDateTime": "2021-09-01",
    "recordedDate": "2021-08-23T12:04:37+09:00",
    "recorder": {
        "reference": "Practitioner/XXX",
        "type": "Practitioner"
    },
    "reaction": [
        {
            "manifestation": [
                {
                    "text": "皮膚症状"
                }
            ]
        }
    ]
}
  • Registration status to DynamoDB
id patient resourceType
1cea96d3-dbec-4d23-8986-0f4cbbfbeebd { "reference" : { "S" : "9999999999" }, "type" : { "S" : "Patient" } } AllergyIntolerance
  1. the GET method with patient parameters
  • search
curl --location --request GET 'https://xxx.amazonaws.com/dev/AllergyIntolerance?patient=9999999999' \
--header 'x-api-key: XXX' \
--header 'Authorization: Bearer XXX'
  • Response Body
{
    "resourceType": "Bundle",
    "id": "49f17772-0d3e-4934-b09d-31d335c6f8e7",
    "meta": {
        "lastUpdated": "2023-02-22T05:52:29.897Z"
    },
    "type": "searchset",
    "total": 0,
    "link": [
        {
            "relation": "self",
            "url": "https://xxx.amazonaws.com/dev/AllergyIntolerance?patient=9999999999"
        }
    ],
    "entry": []
}

Versions:

  • fhir-works-on-aws-deployment
    v4.0.0
  • JPCORE
    JP-CORE.Draft 1.0.5

Hi @inatam, it looks like the issue may be in your POST Body, the patient block should look like this. Everything else should work as expected after you make this update

"patient": {
    "reference": "Patient/id"
  },

I tried following patterns as your comments, but failed to search.

  1. Edit data already stored in DynamoDB + Search by "Patient/id"
  2. Edit data already stored in DynamoDB + Search by "id"
  3. Registrate new data by using POST + Search by "Patient/id"
  4. Registrate new data by using POST + Search by "id"
  • Edit data already stored in DynamoDB
    • Before edit
    {
        "clinicalStatus": {
            "coding": [
                {
                    "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                    "code": "active",
                    "version": "4.0.1",
                    "display": "Active"
                }
            ]
        },
        "recordedDate": "2021-09-29T15:46:34+09:00",
        "reaction": [
            {
                "manifestation": [
                    {
                        "text": "食物症状1"
                    },
                    {
                        "text": "食物症状2"
                    },
                    {
                        "text": "食物症状3"
                    }
                ]
            }
        ],
        "meta": {
            "lastUpdated": "2023-01-17T05:23:56.964Z",
            "versionId": "1"
        },
        "onsetDateTime": "2021-09-02",
        "language": "ja",
        "patient": {
            "reference": "Patient/9999001990",
            "type": "Patient"
        },
        "note": [
            {
                "text": "食物根拠"
            }
        ],
        "code": {
            "text": "くるみ"
        },
        "resourceType": "AllergyIntolerance",
        "category": [
            "food"
        ],
        "id": "b8f90d8d-1ce9-41f6-8547-b3ff46cf7a3c",
        "recorder": {
            "reference": "Practitioner/EGMAIN00",
            "type": "Practitioner"
        }
    }
    
    • After edit
    {
      "clinicalStatus": {
          "coding": [
              {
                  "code": "active",
                  "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                  "version": "4.0.1",
                  "display": "Active"
              }
          ]
      },
      "recordedDate": "2021-09-29T15:46:34+09:00",
      "reaction": [
          {
              "manifestation": [
                  {
                      "text": "食物症状1"
                  },
                  {
                      "text": "食物症状2"
                  },
                  {
                      "text": "食物症状3"
                  }
              ]
          }
      ],
      "meta": {
          "lastUpdated": "2023-01-17T05:23:56.964Z",
          "versionId": "1"
      },
      "onsetDateTime": "2021-09-02",
      "language": "ja",
      "patient": {
          "reference": "Patient/9999001990"
      },
      "code": {
          "text": "くるみ"
      },
      "note": [
          {
              "text": "食物根拠"
          }
      ],
      "resourceType": "AllergyIntolerance",
      "category": [
          "food"
      ],
      "id": "b8f90d8d-1ce9-41f6-8547-b3ff46cf7a3c",
      "recorder": {
          "reference": "Practitioner/EGMAIN00",
          "type": "Practitioner"
      }
    }
    
  1. Search by "Patient/id"
    • GET
      curl --location 'https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=Patient%2F9999001990' \
      --header 'x-api-key: XXX' \
      --header 'Authorization: Bearer XXX'
      
    • Response Body
      {
          "resourceType": "Bundle",
          "id": "8284c5ff-5c5a-4ae7-9b0c-9b07c5fef42d",
          "meta": {
              "lastUpdated": "2023-03-02T05:40:03.193Z"
          },
          "type": "searchset",
          "total": 0,
          "link": [
              {
                  "relation": "self",
                  "url": "https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=Patient%2F9999001990"
              }
          ],
          "entry": []
      }
      
  2. Search by "id"
    • GET
      curl --location 'https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=9999001990' \
      --header 'x-api-key: XXX' \
      --header 'Authorization: Bearer XXX'
      
    • Response Body
      {
          "resourceType": "Bundle",
          "id": "e5f12b1a-fb47-4903-bd16-e7fc0eb86b56",
          "meta": {
              "lastUpdated": "2023-03-02T05:46:30.460Z"
          },
          "type": "searchset",
          "total": 0,
          "link": [
              {
                  "relation": "self",
                  "url": "https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=9999001990"
              }
          ],
          "entry": []
      }
      
  • Registrate new data by using POST
    • POST
    curl --location 'https://XXX.amazonaws.com/dev/AllergyIntolerance' \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: XXX' \
    --header 'Authorization: Bearer XXX' \
    --data '{
        "resourceType": "AllergyIntolerance",
        "id": "9999001990-ARG01-ARG001-1",
        "meta": {
            "lastUpdated": "2021-09-29T15:46:34.000+09:00"
        },
        "language": "ja",
        "clinicalStatus": {
            "coding": [
                {
                    "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                    "version": "4.0.1",
                    "code": "active",
                    "display": "Active"
                }
            ]
        },
        "category": [
            "medication"
        ],
        "code": {
            "text": "アーテン錠2mg"
        },
        "patient": {
            "reference": "Patient/9999001990"
        },
        "onsetDateTime": "2021-09-01",
        "recordedDate": "2021-09-29T15:46:34+09:00",
        "recorder": {
            "reference": "Practitioner/EGMAIN00",
            "type": "Practitioner"
        },
        "note": [
            {
                "text": "薬剤根拠"
            }
        ],
        "reaction": [
            {
                "manifestation": [
                    {
                        "text": "薬剤症状1"
                    },
                    {
                        "text": "薬剤症状2"
                    },
                    {
                        "text": "薬剤症状3"
                    }
                ]
            }
        ]
    }'
    
    • Response Body
    {
        "resourceType": "AllergyIntolerance",
        "id": "9158358b-bd85-408e-89b7-b6324f6e433a",
        "meta": {
            "lastUpdated": "2023-03-02T05:54:41.068Z",
            "versionId": "1"
        },
        "language": "ja",
        "clinicalStatus": {
            "coding": [
                {
                    "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                    "version": "4.0.1",
                    "code": "active",
                    "display": "Active"
                }
            ]
        },
        "category": [
            "medication"
        ],
        "code": {
            "text": "アーテン錠2mg"
        },
        "patient": {
            "reference": "Patient/9999001990"
        },
        "onsetDateTime": "2021-09-01",
        "recordedDate": "2021-09-29T15:46:34+09:00",
        "recorder": {
            "reference": "Practitioner/EGMAIN00",
            "type": "Practitioner"
        },
        "note": [
            {
                "text": "薬剤根拠"
            }
        ],
        "reaction": [
            {
                "manifestation": [
                    {
                        "text": "薬剤症状1"
                    },
                    {
                        "text": "薬剤症状2"
                    },
                    {
                        "text": "薬剤症状3"
                    }
                ]
            }
        ]
    }
    
  1. Search by "Patient/id"
    • GET
      curl --location 'https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=Patient%2F9999001990' \
      --header 'x-api-key: XXX' \
      --header 'Authorization: Bearer XXX'
      
    • Response Body
      {
          "resourceType": "Bundle",
          "id": "d9894489-a537-4124-b47e-211d0880b9c6",
          "meta": {
              "lastUpdated": "2023-03-02T05:59:05.155Z"
          },
          "type": "searchset",
          "total": 0,
          "link": [
              {
                  "relation": "self",
                  "url": "https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=Patient%2F9999001990"
              }
          ],
          "entry": []
      }
      
  2. Search by "id"
    • GET
      curl --location 'https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=9999001990' \
      --header 'x-api-key: XXX' \
      --header 'Authorization: Bearer XXX'
      
    • Response Body
      {
          "resourceType": "Bundle",
          "id": "ca3c4f62-ac4b-4e41-9e6a-6e884c685cbd",
          "meta": {
              "lastUpdated": "2023-03-02T06:01:15.029Z"
          },
          "type": "searchset",
          "total": 0,
          "link": [
              {
                  "relation": "self",
                  "url": "https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=9999001990"
              }
          ],
          "entry": []
      }
      

Are there any other reasons?

What region is your service deployed in?

Asia Pacific (Tokyo)

Hi @inatam,

I tried reproducing the issue you're facing, and I believe the search request you used need to be updated:

curl --location 'https://XXX.amazonaws.com/dev/AllergyIntolerance?patient=Patient%2F9999001990' \
--header 'x-api-key: XXX' \
--header 'Authorization: Bearer XXX'

Note the reference value Patient/9999001990 was encoded to Patient%2F9999001990. If you could update that back to Patient/9999001990, the search request should work.

Meanwhile, I would suggest using the Postman collection, which is preloaded with search params and example resources for testing.

Thanks,
Yanyu

Thanks
I was able to search in a different environment.

Versions:

  • fhir-works-on-aws-deployment
    v5.1.0
  • JPCORE
    JP-CORE.Draft 1.0.5