Skip to content

Instantly share code, notes, and snippets.

@jacksmith15
Last active September 5, 2019 13:29
Show Gist options
  • Save jacksmith15/deebdae9d76ddca304eccd86d2ab6909 to your computer and use it in GitHub Desktop.
Save jacksmith15/deebdae9d76ddca304eccd86d2ab6909 to your computer and use it in GitHub Desktop.

Overview

This document provides some JSON examples to aid with re-integration of consumers to breaking API changes for patient records brought about by NDMS-1984.

Included are happy path before/after examples for common cases:

  • With and without NHS Number
  • Read and write payloads
  • With and without explicit reason for missing NHS Number

as well as some canonical invalid payloads.

This document is provided to supplement the written explanation of changes found in the description of NDMS-1985 and the full before and after specifications attached.

Happy Path Before/After

Patient Create/Update

With NHS Number

Before

{
  "identifiers": [
    {
      "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
      "value": "0123456789",
      "created_by": null,
    },
    {
      "type": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",  // localid
      "value": "abcdef",
      "created_by": null,
    },
  ]
}

After

{
  "identifiers": [
    {
      "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
      "value": "0123456789",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null,
    },
    {
      "type": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",  // localid
      "value": "abcdef",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null,
    },
  ]
}

Without NHS Number

Before

{
  "identifiers": [
    {
      "type": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",  // localid
      "value": "abcdef",
      "created_by": null
    }
  ]
}

After

{
  "identifiers": [
    {
      "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
      "value": null,
      "created_by": null,
      "missing_reason": "5acbc0c5-f3ba-47db-8a68-602009cdab2e",  // foetalpatient
      "missing_reason_description": null
    },
    {
      "type": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",  // localid
      "value": "abcdef",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null
    }
  ]
}

OR

{
  "identifiers": [
    {
      "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
      "value": null,
      "created_by": null,
      "missing_reason": "163923c9-0553-413f-9c27-23a06eefa345",  // other
      "missing_reason_description": "This Patient's NHS number has not yet been entered in SPINE"
    },
    {
      "type": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",  // localid
      "value": "abcdef",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null
    }
  ]
}

Patient Detail and Search

With NHS Number

Before

{
  "identifiers": [
    {
      "type": {
        "uid": "0ad2397c-a8b3-4962-901a-8e9892a41f14",
        "codesystem_uri": "identifier_type",
        "code": "nhsnumber",
        "display": "NHS Number"
      },
      "value": "0123456789",
      "created_by": null
    },
    {
      "type": {
        "uid": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",
        "codesystem_uri": "identifier_type",
        "code": "localid",
        "display": "Local Identifier"
      },
      "value": "abcdef",
      "created_by": null
    }
  ]
}

After

{
  "identifiers": [
    {
      "type": {
        "uid": "0ad2397c-a8b3-4962-901a-8e9892a41f14",
        "codesystem_uri": "identifier_type",
        "code": "nhsnumber",
        "display": "NHS Number"
      },
      "value": "0123456789",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null
    },
    {
      "type": {
        "uid": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",
        "codesystem_uri": "identifier_type",
        "code": "localid",
        "display": "Local Identifier"
      },
      "value": "abcdef",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null
    }
  ]
}

Without NHS Number

Before

{
  "identifiers": [
    {
      "type": {
        "uid": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",
        "codesystem_uri": "identifier_type",
        "code": "localid",
        "display": "Local Identifier"
      },
      "value": "abcdef",
      "created_by": null
    }
  ]
}

After

{
  "identifiers": [
    {
      "type": {
        "uid": "0ad2397c-a8b3-4962-901a-8e9892a41f14",
        "codesystem_uri": "identifier_type",
        "code": "nhsnumber",
        "display": "NHS Number",
      },
      "value": null,
      "created_by": null,
      "missing_reason": {
        "uid": "e4f5f51a-b14b-42e5-9073-a23aeb853420",
        "codesystem_uri": "identifier_missing_reason",
        "code": "foetal_patient",
        "display": "Foetal Patient"
      },
      "missing_reason_description": null
    },
    {
      "type": {
        "uid": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",
        "codesystem_uri": "identifier_type",
        "code": "localid",
        "display": "Local Identifier",
      },
      "value": "abcdef",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null
    }
  ]
}

OR

{
  "identifiers": [
    {
      "type": {
        "uid": "0ad2397c-a8b3-4962-901a-8e9892a41f14",
        "codesystem_uri": "identifier_type",
        "code": "nhsnumber",
        "display": "NHS Number",
      },
      "value": null,
      "created_by": null,
      "missing_reason": {
        "uid": "e4f5f51a-b14b-42e5-9073-a23aeb853420",
        "codesystem_uri": "identifier_missing_reason",
        "code": "other",
        "display": "Other"
      },
      "missing_reason_description": "This Patient's NHS number has not yet been entered in SPINE"
    },
    {
      "type": {
        "uid": "0e5913f3-3e8f-41c5-90c1-589a89c0921e",
        "codesystem_uri": "identifier_type",
        "code": "localid",
        "display": "Local Identifier",
      },
      "value": "abcdef",
      "created_by": null,
      "missing_reason": null,
      "missing_reason_description": null
    }
  ]
}

Errors

The following NHS Number Identifiers are invalid and will result in a 400 Bad Request:

{
  "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
  "value": null,
  "created_by": null,
  "missing_reason": null,
  "missing_reason_description": null
}  // ERROR: Must provide one of `value` or `missing_reason` for NHS Number
{
  "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
  "value": null,
  "created_by": null,
  "missing_reason": "5acbc0c5-f3ba-47db-8a68-602009cdab2e",  // foetalpatient
  "missing_reason_description": "This is a foetal patient"  // ERROR: Dont provide `missing_reason_description`` if `missing_reason` is not "Other"
}
{
  "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
  "value": "0123456789",
  "created_by": null,
  "missing_reason": "5acbc0c5-f3ba-47db-8a68-602009cdab2e",  // ERROR: Dont provide `missing_reason` if providing a value
  "missing_reason_description": null
}
{
  "type": "0ad2397c-a8b3-4962-901a-8e9892a41f14",  // nhsnumber
  "value": null,
  "created_by": null,
  "missing_reason": "e4f5f51a-b14b-42e5-9073-a23aeb853420",  // Other
  "missing_reason_description": null  // ERROR: Must provide a description it missing reason is Other
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment