Skip to content

Instantly share code, notes, and snippets.

@jacksmith15
Last active December 13, 2019 08:39
Show Gist options
  • Save jacksmith15/14eec45fe68ffeb2db00fa8dd99a9418 to your computer and use it in GitHub Desktop.
Save jacksmith15/14eec45fe68ffeb2db00fa8dd99a9418 to your computer and use it in GitHub Desktop.

Patient

Request

POST /sample-message/patient

{
  "query": {
    "human_readable_id": [
      "p10001400859"
    ]
  }
}

Response

200 OK

{
  "created": "2019-12-12T17:17:54.825741+00:00",
  "data": [
    {
      "administrative_gender": {
        "code": "male",
        "codesystem_uri": "administrative_gender",
        "display": "Male",
        "uid": "0848af8e-42f0-465e-97bc-0465c20e069f"
      },
      "ethnicity": {
        "code": "A",
        "codesystem_uri": "ethnicity",
        "display": "A - White - British",
        "uid": "1cf60c60-9aeb-49e1-9735-4b557d70515d"
      },
      "human_readable_id": "p10001400859",
      "id": "167ccc48-0b01-4e3c-8fc2-e8b5b1121265",
      "identifiers": [
        {
          "created_by": "77c26bc5-2755-5a45-8808-bd8e239367b6",
          "effective_from": null,
          "effective_to": null,
          "type": {
            "code": "nhsnumber",
            "codesystem_uri": "identifier_type",
            "display": "NHS number",
            "uid": "b1b2b198-e294-4321-9ba7-605c7b8becdd"
          },
          "value": "266726124"
        }
      ],
      "masked_pid": "PID:1:1:FnzMSAsBTjyPwui1sRISZQ==:pVR7JJviHC7OWrwJ+KjLI1cy7WeGsEDaeNLJXv21PSVKej2HciCz+3tE1HBNni8KgNdtTk0h3nOVZ6ZKLZfPOD6dpvNli54qhbvGaRett83+oIN8NsBl9Z1W7SC3aLn1U+dQiJFx2GVJoEudYWKiP2HawqhAlUlGPl4kqYpndKh7gzvEKaQVanmIqCMp87DWiZ0f975eB9MY4q4wuseW723kADbUo3iy/1hMDm7JUNMD/AKbaYrJAZSYMeLLzPbEydmBUSxsjCSv5L8LhUqgUlwz8FH9dxndws2nFBsM1r+9OE2EOuM13QevGqmCpEVisl/69zEKDOqf4xS85CNuvWcXkQb1QaFTIdYCZLPGtIbM/DfYOJj9SHYAhP/bW1OFW3ND7AhhM60kgmKLfcmHrjyYqosIAIZqJS7RIUQR95ARGWXWLnN8NL+2fK53cgM6DXz7diyNOd/HSJnrh4+nuv6qyznAW1lUOFg/y0wVSIi/7zoFdJRHJR6EGUIq9ApmpL8UJ87FvR+90n3G98ZrQwBrMd78udqxjcwgu4CT+Tr+4t87MbQ//TxkAhuSCM92RPnUoeVG+tOnHEsZxDoyIgoEshs46hUUxE9ryNrKm6tzmMlVhe3TZItlx90B6FNmzVd4L/UakV9iRZy2mj2apTh3zm02+YhLCzjxFIXuwju07dAwLgr/taS3P2+PavAnVa3bYLDs5hW/sLD8GEnlT76TfZHVGmaCNEjdQxhbWy3RUX45g+SKrX51VxGwy3oby4Iaqps88S6pnL0LSioNT8mDrx/4RvVSRJ+XfuckZXQQSrs78T5b57iSLhLmto1RyniMR8bylamBqTbH2OwUAJXpLpappThZX8RKDD3ETTxpEMpV1UgtW59QLo5kZpX5+MRJohZ/3KP411CRs6fEsYuhB4XgJKabtuEaaufLdg65YCXIy1oHs8Sx88FxMvzAPn3ixXg9O84COvhrbUygiJ8bNpRqcyNmVBWsXKO5y+y6IHLdSRO2xDd3D0T9mchkPZu/Yp/GpW55U6NukJH1RqxAfKPiDmABWQQjP/+f6VsZ/MMeXagRtFvem/z+q0yAQh3xy9H/tzCULX6pZvCs34BrjyhbXLo2dHcrsEqma7U5xjY+aWNttV2bl9TsKzZx5J38FwUU7+72YbcbK595KxE3wNzO2h8YVUtAmn6DypjNWYaIuwZNJiFwEMUdqGa0NxsWO5OEKt29y7iy/r/CTXmpMIZnVltTaGgmgLspzRrOKS+ZH5wGx5qJpUSqfV+9D/3YBxkmIrRMGdhNZ7rVzYEO0wdoW/ZPrgS19u6hllBtS/a8AAjzTg1X8PlcdjMceaSzNezoR1h+DuDKmjh6Skg30J1csmgBg8GjJnPYkXI=",
      "samples": []
    }
  ],
  "errors": []
}

Referral

Request

POST /sample-message/referral

{
  "query": {
    "human_readable_id": [
      "r19698886184"
    ]
  }
}

Response

200 OK

{
  "created": "2019-12-12T17:22:56.066942+00:00",
  "data": [
    {
      "clinical_indication_id": "5e77423a-f8f7-47a8-b015-762e263b14a6",
      "date_last_submitted": "2018-10-30",
      "date_submitted": null,
      "human_readable_id": "r19698886184",
      "id": "001a6c42-3b45-4dec-80d1-0f2a0c3ca20b",
      "ordering_entity_id": "77c26bc5-2755-5a45-8808-bd8e239367b6",
      "participants": [
        {
          "is_proband": true,
          "patient_id": "af91c91e-3e26-4e55-aae8-b04e365f1d73"
        }
      ],
      "priority": {
        "code": "routine",
        "codesystem_uri": "priority",
        "display": "Routine",
        "uid": "af11fa07-f94f-414c-8b83-df94a51a08e3"
      },
      "samples": [
        {
          "sample_id": "67b895f3-5199-47d4-819b-5b1a44596fad"
        }
      ],
      "tests": [
        {
          "ci_test_type_id": "7b2207db-1fed-48d3-869f-a120acd2cec6"
        }
      ],
      "tumour": {
        "id": "998b3ce1-d663-4e5d-9031-e9be3a33bdc3",
        "morphology": [
          {
            "morphology": {
              "code": "SCTID:45881000",
              "codesystem_uri": "snomed_tumour_morpho",
              "display": "Carcinoma simplex",
              "uid": "5bcfe49a-38e5-4a8c-b76e-78a1a9626be5"
            }
          }
        ],
        "topography": [
          {
            "actual_body_site": {
              "code": "SCTID:302547009",
              "codesystem_uri": "snomed_topo",
              "display": "Entire toe",
              "uid": "0bb1e387-d5a8-4c80-9bf5-f817f72bf838"
            },
            "primary_body_site": {
              "code": "SCTID:2255006",
              "codesystem_uri": "snomed_topo",
              "display": "Subserosa",
              "uid": "bf3b09aa-cd50-42f0-94a8-a7048b2c558f"
            }
          }
        ]
      }
    }
  ],
  "errors": []
}

Errors

There are two types of HRID errors:

  • invalid_human_readable_id - if the HRID is malformed
  • not_found - if no matching record was found

In these cases, entries in the errors collection will be returned.

Request

POST /sample-message/referral

{
  "query": {
    "human_readable_id": [
      "notahrid",  // invalid
      "r98765432102",  // valid but not found
      "r19698886184"  // valid
    ]
  }
}

Response

200 OK

{
  "created": "2019-12-12T17:27:17.901612+00:00",
  "data": [
    {
      "human_readable_id": "r19698886184",
      ...
    }
  ],
  "errors": [
    {
      "code": "not_found",
      "human_readable_id": "r98765432102"
    },
    {
      "code": "invalid_human_readable_id",
      "human_readable_id": "notahrid"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment