Fetching AGP report status

Client can check the status of the AGP report generation by sending a GET request to the endpoint returned by the report generation request. For example:

curl -sS "https://${server}/fhir/r5/api/DiagnosticReport/482c9449-add0-4312-a6ba-07831d5ffa5b/$status" \
  -H "client_id: ${client_id}" \
  -H "client_secret: ${client_secret}" \
  -H "org_id: ${org_id}" \
  -H "certificate: ${certificate}" | jq

The above request checks the status of the AGP report generation using the Content-Location URL returned by the initial report generation request. This process follows the Asynchronous Interaction Request Pattern.

The client should poll for the status of the AGP report generation until the server responds with HTTP 200 OK status code, which indicates that the report generation is completed. The recommended polling interval is as specified by the Retry-After header in the response.

Response

Report generation Pending

The server respond with HTTP 202 Accepted status code if the Report generation is still in-progress.

Report generation completed successfully

In accordance with the Asynchronous Interaction Request Pattern, when a status request is made for a report generation operation that succeeded, the server responds with an HTTP 200 OK status code and includes a Bundle resource in the payload.

  • The first entry in the Bundle represents the outcome, with 200 OK in its response.status field.

  • The second entry in the Bundle is a DiagnosticReport resource that contains the details of the AGP report. This entry also includes a list of Observation resources as contained resources.

  • Example of a successful report generation completed with adequate data:

{
  "resourceType": "Bundle",
  "type": "batch-response",
  "entry": [
    {
      "response": {
        "status": "200 OK"
      }
    },
    {
      "resource": {
        "resourceType": "DiagnosticReport",
        "contained": [
          {
            "resourceType": "Observation",
            "id": "4979d6cc-2102-4e85-b87e-1d82d39fd6db",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "97507-8",
                  "display": "Average glucose [Mass/ volume] in Interstitial fluid during Reporting Period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 173,
              "unit": "mg/dL"
            }
          },
          {
            "resourceType": "Observation",
            "id": "f01d7558-afe7-4de6-8e02-c6946c407cd3",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "97504-5",
                  "display": "Percent sensor usage"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 99,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "0619c110-edee-487b-b884-de3895303a04",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "97506-0",
                  "display": "Glucose management  indicator"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 7.5,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "8b8e3c3d-c22f-4816-82ca-f4b29c9daf0a",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "65375-8",
                  "display": "CGM Glycemic Variability (%GV) during reporting period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 46,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "b077f04d-8868-49e4-83e0-b0022d488e15",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "97510-2",
                  "display": "Glucose measurements in range out of Total glucose measurements during reporting period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 32,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "bedde59e-8fa2-4cb4-852a-1826cd769818",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "65376-6",
                  "display": "CGM Time above range, very high (TAR-VH), % of readings and time >250 mg/dL (>13.9 mmol/L), during reporting period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 16,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "4a5a0c1a-facd-4843-a284-3fa36e749b4f",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "65377-4",
                  "display": "CGM Time above range, high (TAR-H), % of readings and time 181–250 mg/ dL (10.1–13.9 mmol/L), during reporting period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 40,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "bd11630a-469e-47fe-a27a-fae54233f09c",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "65380-8",
                  "display": "CGM Time below range, very low (TBR-VL), % of readings and time <54 mg/dL (<3.0 mmol/L), during reporting period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 0,
              "unit": "%"
            }
          },
          {
            "resourceType": "Observation",
            "id": "a445a340-e3fd-4a96-bb71-b5acc2f43a44",
            "meta": {
              "profile": [
                "http://roche.com/fhir/iop/StructureDefinition/Observation"
              ]
            },
            "code": {
              "coding": [
                {
                  "system": "http://loinc.org",
                  "code": "65379-0",
                  "display": "CGM Time below range, low (TBR-L), % of readings and time 54–69 mg/dL (3.0–3.8 mmol/L), during reporting period"
                }
              ]
            },
            "subject": {
              "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
            },
            "effectiveDateTime": "2025-01-13T10:48:23+00:00",
            "valueQuantity": {
              "value": 12,
              "unit": "%"
            }
          }
        ],
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "http://roche.com/fhir/iop/cs",
              "code": "AGP_Report",
              "display": "CGM Ambulatory Glucose Profile (AGP) During Reporting Period"
            }
          ]
        },
        "subject": {
          "reference": "Patient/itBKL38V0PNndc1ESu3rdl05fNeAqoc"
        },
        "effectivePeriod": {
          "start": "2025-09-01T00:00:00+00:00",
          "end": "2025-09-14T23:59:59+00:00"
        },
        "performer": [
          {
            "reference": "Organization/3156161"
          }
        ],
        "presentedForm": [
          {
            "contentType": "application/pdf",
            "url": "https://devus-emr-integration-data-store-s3.s3.amazonaws.com/in/reports/AGP/EMR/PDF/47e9a931-fce3-4962-b8a7-4da962fa7dd6-0.pdf?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEAMaCXVzLWVhc3QtMSJHMEUCIQCujO8JXi3uaLQ0JpRD3G3KN2yVnaPlGf2bulrTGyFALwIgdUmM2fazR5ULPAMWQ309d2VIYxHc7e5r81KcAW5CLt8qugII7P%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAFGgwwMTkzNjQ0ODEwOTEiDF1gylT%2FUfcyiBPkMyqOAmeW%2FffXBmNwp17jkfhGDfs1nGXWAFJZD1ij9mRv%2FLsKwJF3TA7lK6FVDgfddumLsEIv9fMNWHF%2FSzQPTWKZtnDM7zyA%2BqjbiuWj4JI%2BDC7mH%2B2foyRbOu5RG3iutwi3aiok6hJ9YCx%2FTL7Fzmiul6bAkqseyEafj%2FTPb6H3YiVedue1yVFo4LL%2BkSC%2BTNT0ug4mdJGln1hGUr1gGErv5Y%2F6Svbh4pPfPl3YaCTnSRY4EXlqsMfk7yUvFtjyGeyPHIRk8uBGpeifEgM7mld5GisAWPmdtDykCTao8RYKRdIpuqSOCMUUe0GGrd4ZDjCTjr48xMiv8Ckw5MfzfAqLLZxVGOH%2Bo9mSonQ3yvcpPzDd1ZO8BjqdAREWXW0mmyMxMxQCkpOTaDwFd4ttefO6wspCtZT2XsU21q%2BVI2SCDNlddvisjTr4o2W0nqw00TldjJO3YqzmrOnpUkuw78T9YIpcN3Mb2A%2Bo%2BkIfLQnWQ%2FAc8v9HN392Z%2BPwdSg%2BaMTuCgEzO1k7dtNr%2FQkenUlH7d8cPWyOa4daWB3ze0OfKLLw6rg9yyefImoTVPIwwE0DXyJoGqE%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250113T104855Z&X-Amz-SignedHeaders=host&X-Amz-Credential=ASIAQJARWRBB5WEBXNZ5%2F20250113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Expires=1800&X-Amz-Signature=25f9725b4d2ff7e49e518f35ac2c0b9398b03b02b4a6adbe53cdf543219263df",
            "title": "AGP-Report",
            "creation": "2025-01-13T10:48:23+00:00"
          }
        ]
      }
    }
  ]
}

  • If the patient does not have sufficient data to generate an AGP report, the server responds with an HTTP 404 NOT_FOUND status code and includes a Bundle resource in the payload.
  • The payload contains a report without data. Example of a successful report generation completed with insufficient data:
{
  "resourceType": "Bundle",
  "type": "batch-response",
  "entry": [
    {
      "response": {
        "status": "404 NOT_FOUND",
        "outcome": {
          "resourceType": "OperationOutcome",
          "issue": [
            {
              "severity": "error",
              "code": "processing",
              "diagnostics": "Report could not be generated due to insufficient data."
            }
          ]
        }
      }
    },
    {
      "resource": {
        "resourceType": "DiagnosticReport",
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "http://roche.com/fhir/iop/cs",
              "code": "AGP_Report",
              "display": "CGM Ambulatory Glucose Profile (AGP) During Reporting Period"
            }
          ]
        },
        "subject": {
          "reference": "Patient/123"
        },
        "effectivePeriod": {
          "start": "2011-05-23T00:00:00+00:00",
          "end": "2011-05-27T23:59:59+00:00"
        },
        "performer": [
          {
            "reference": "Organization/org1234"
          }
        ],
        "presentedForm": [
          {
            "contentType": "application/pdf",
            "url": "https://emr-integration-data-store-s3.s3.amazonaws.com/in/reports/AGP/EMR/PDF/08cbb4b5-5a58-457c-8a7f-da7e001071db-0.pdf?X-Amz-Security-Token=7Y4mB7WPG73gP5Ftn3evL0%2BogqgA%2F%2FWayx3bfrwIq8vbO%2FFOVRcpV5kMjKVZa81w%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241211T070308Z&X-Amz-SignedHeaders=host&X-Amz-Credential=ASIAQJARWRBBZZUKPMD3%2F20241211%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Expires=1800&X-Amz-Signature=0461cb4f4e200bec04b79918c20fae45bdc6e52f47990f7805f99877634b4622",
            "title": "AGP-Report",
            "creation": "2024-12-09T05:27:12+00:00"
          }
        ]
      }
    }
  ]
}

Report generation completed with failure

In accordance with the Asynchronous Interaction Request Pattern, when a status request is made for a report generation operation that failed, the server also responds with an HTTP 200 OK status code (indicated that the status was successfully returned) and includes a Bundle resource in the payload. The Bundle has a single entry that represents the outcome in its response field. The details of the error are provided in the response.status and response.outcome subfields.

This example illustrates a situation where the report generation process fails. The server returns a 500 INTERNAL_SERVER_ERROR status code along with an OperationOutcome resource detailing the error. The payload includes a Bundle that does not contain a PDF.

{
    "resourceType": "Bundle",
    "type": "batch-response",
    "entry": [
        {
            "response": {
                "status": "500 INTERNAL_SERVER_ERROR",
                "outcome": {
                    "resourceType": "OperationOutcome",
                    "issue": [
                        {
                            "severity": "error",
                            "code": "processing",
                            "diagnostics": "Report could not be generated."
                        }
                    ]
                }
            }
        },
        {
            "resource": {
                "resourceType": "DiagnosticReport",
                "status": "final",
                "code": {
                    "coding": [
                        {
                            "system": "http://roche.com/fhir/iop/cs",
                            "code": "AGP Report",
                            "display": "CGM Ambulatory Glucose Profile (AGP) During Reporting Period"
                        }
                    ]
                },
                "subject": {
                    "reference": "Patient/123"
                },
                "effectivePeriod": {
                    "start": "2024-01-01T00:00:00+00:00",
                    "end": "2024-02-28T00:00:00+00:00"
                },
                "performer": [
                    {
                        "reference": "Organization/org1234"
                    }
                ]
            }
        }
    ]
}

Report generation status request processing failed.

If there is an error while processing the status request, the server returns an OperationOutcome resource. Here is an example of an error response:

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "Unable to check report generation status."
    }
  ]
}