Skip to content

Instantly share code, notes, and snippets.

@jacksmith15
Created November 18, 2019 11:24
Show Gist options
  • Save jacksmith15/ba5ae0605995f7975bb2dc80e6434e3f to your computer and use it in GitHub Desktop.
Save jacksmith15/ba5ae0605995f7975bb2dc80e6434e3f to your computer and use it in GitHub Desktop.

Patient Status: Key Actions

Deactivating a patient

  1. Display the available reason concepts for the user to select GET /codes-search/patient_deactivation_reason
{
  "total": 2,
  "limit": 10,
  "offset": 0,
  "hits": [
    {
      "uid": "bc6bed35-c070-484f-8d2a-971b56fcc090",
      "code": "duplicate_record",
      "display": "Duplicate",
      "codesystem_uri": "patient_deactivation_reason"
    },
    {
      "uid": "667edaff-74e0-4fb3-9a7b-90c57262f25f",
      "code": "entered_in_error",
      "display": "Created in error",
      "codesystem_uri": "patient_deactivation_reason"
    }
  ]
}
  1. Send patient status change including reference to reason and description field POST /patient/{patient_id}/status-changes
{
  "data": {
    "type": "patient_status_change",
    "attributes": {
      "active": false,
      "description": "This patient was entered twice (SERVICE DESK TICKET)."
    },
    "relationships": {
      "reason": {
        "data": {
          "type": "concept",
          "id": "bc6bed35-c070-484f-8d2a-971b56fcc090"
        }
      }
    }
  }
}

Reactivating a patient

  1. Send a patient status change including description field, and null reason. POST /patient/{patient_id}/status-changes
{
  "data": {
    "type": "patient_status_change",
    "attributes": {
      "active": true,
      "description": "This patient was deactivated in error."
    },
    "relationships": {
      "reason": {
        "data": null
      }
    }
  }
}

Getting a history of status changes

  1. Retrieve status changes for a patient GET /patient/{patient_id}/status-changes
{
  "links": {
    "self": {
      "href": "/patient/dae02edc-3cca-4130-8d00-c79434965867/status-changes"
    },
    "patient": {
      "href": "/patient/dae02edc-3cca-4130-8d00-c79434965867"
    }
  },
  "data": [
    {
      "type": "patient_status_change",
      "id": "da265e8b-6e01-4ddf-b856-087530213c5d",
      "attributes": {
        "active": true,
        "description": "This patient was deactivated in error.",
        "created": "2019-10-26T11:32:21.765892"
      },
      "relationships": {
        "reason": {
          "data": null
        }
      }
    },
    {
      "type": "patient_status_change",
      "id": "03d9eb29-ab55-43b7-a16b-8e20adbc97d6",
      "attributes": {
        "active": false,
        "description": "This patient was entered twice (SERVICE DESK TICKET).",
        "created": "2019-10-25T15:46:00.689183"
      },
      "relationships": {
        "reason": {
          "links": {
            "related": "/concept/bc6bed35-c070-484f-8d2a-971b56fcc090"
          },
          "data": {
            "type": "concept",
            "id": "bc6bed35-c070-484f-8d2a-971b56fcc090"
          }
        }
      }
    },
    {
      "type": "patient_status_change",
      "id": "29c1e981-f225-452a-b59b-9670a15cf163",
      "attributes": {
        "active": true,
        "description": "Created record.",
        "created": "2019-10-24T16:22:00.123456"
      },
      "relationships": {
        "reason": {
          "data": null
        }
      }
    }
  ],
  "included": [
    {
      "type": "concept",
      "id": "bc6bed35-c070-484f-8d2a-971b56fcc090",
      "attributes": {
        "codeystem_uri": "patient_deactivation_reason",
        "code": "duplicate_record",
        "display": "Duplicate"
      },
      "links": {
        "self": "/concept/bc6bed35-c070-484f-8d2a-971b56fcc090"
      }
    }
  ]
}

Patient search filtering

  • Show only active patients matching criteria: /patient-search?human_readable_id=p10001400859
  • Show only inactive patients matching criteria: /patient-search?human_readable_id=p10001400859&active=false
  • Show only active patients matching criteria: /patient-search?human_readable_id=p10001400859&active=true&active=false

Display patient status from patient detail and search results

GET /patient/{patient_id}

{
  "id": "0c13bd1a-db61-4e1f-bedd-d010adf9b095",
  "active": true,
  "human_readable_id": "p10001400859",
  "identifiers": [
    // ...
  ],
  // ...
}

GET /patient-search?human_readable_id=p10001400859

{
  "total": 1,
  "hits": [
    {
      "id": "0c13bd1a-db61-4e1f-bedd-d010adf9b095",
      "active": true,
      "human_readable_id": "p10001400859",
      "identifiers": [
        // ...
      ],
      // ...
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment