Skip to content

IE Middleware API

Noranda Brown edited this page Sep 22, 2017 · 50 revisions

Intervention Engine API

Table of Contents

Name GET POST PUT DELETE
Care Teams * List Care Teams
* Show Individual Care Team
* Create Care Team * Update Care Team * Delete Care Team
Patients * List Patients
* Show Individual Patient
* List Printable Patients
Huddles * List Huddles * Add Patient to Huddle * Remove Patient from Huddle
Populations * List Populations
* Show Individual Population
* Create Population
* Get Filter Builder Counts
* Update Population * Delete Population
Risk Assessments * List Risk Services
* List Risk Assessments
* List Risk Assessment Breakdown
* Bulk Update Risk Assessments
Events * List Events

Care Teams

List Care Teams

GET /api/care_teams

Parameters

Name Type Description
huddle_id string Filters results by huddle ID
patient_id string Filters results by patient ID

Response (HTTP 200)

{
  "care_teams": [
    {
      "id": "576c9bbf8bd4d4bdc2ac4189",
      "name": "Care Team A",
      "leader": "Jane Doe, MD",
      "created_at": "2017-01-06T00:00:00Z"
    }
  ]
}

Create Care Team

POST /api/care_teams

Parameters

Name Type Description
name string Name of Care Team
leader string Name of Care Team leader

Response (HTTP 201)

{
  "care_team": {
    "id": "576c9bbf8bd4d4bdc2ac4189",
    "name": "Care Team A",
    "leader": "Jane Doe, MD",
    "created_at": "2017-01-06T00:00:00Z"
  }
}

Show Individual Care Team

GET /api/care_teams/:id

Response (HTTP 200)

{
  "care_team": {
    "id": "576c9bbf8bd4d4bdc2ac4189",
    "name": "Care Team A",
    "leader": "Jane Doe, MD",
    "created_at": "2017-01-06T00:00:00Z"
  }
}

Update Care Team

PUT /api/care_teams/:id

Parameters

Name Type Description
name string Name of Care Team
leader string Name of Care Team leader

Response (HTTP 200)

{
  "care_team": {
    "id": "576c9bbf8bd4d4bdc2ac4189",
    "name": "Care Team A",
    "created_at": "2017-01-06T00:00:00Z",
    "leader": "John Doe, MD"
  }
}

Delete Care Team

DELETE /api/care_team/:id

Response (HTTP 204)

empty response

Patients

List Patients

GET /api/patients

Parameters

Name Type Description
huddle_id string Filter by huddle ID
care_team_id string Filter by care team ID
population_ids string Filter by one or more populations (comma delimited)
population_filter_method string Population filter method (one of: intersection, union). Default: intersection
sort_by string Sort by options (name, birthdate, gender, address, riskScore, notifications). Up to two sort values can be passed in, separated by commas. The first value will be the primary sort. A + can be prepended to an option to sort ascending. A - can be prepended to an option to sort descending. (e.g., sort_by=-name,age would sort by name descending as primary and age ascending as secondary)
search_term string Search term to filter patients by name
page number The page to get, default: 1
per_page number How many records to fetch per page, default: 10

Response (HTTP 200)

{
  [
    {
      "id": "576c9bcc8bd4d4bdc2ac42b5",
      "address": {
        "street": ["4691 7th Way"],
        "city": "Loyalton",
        "state": "WY",
        "postal_code": "01409"
      },
      "age": 34,
      "gender": "female",
      "birth_date": "1982-07-21",
      "name": {
        "family": "Banks9849",
        "given": "Jacqueline",
        "middle_initial": null,
        "full": "Jacqueline Banks9849"
      },
      "next_huddle": {
        "care_team_name": "Care Team A",
        "huddle_date": "2017-02-12T15:04:43-05:00",
        "huddle_id": "576c9bcc8bd4d4bdc2ac42b4",
        "reason": "Manually Added",
        "reason_type": "MANUAL_ADDITION",
        "reviewed": true,
        "reviewed_at": "2017-02-15T22:42:37-04:00"
      },
      "recent_risk_assessment": {
        "id": "576c9bcf8bd4d4bdc2ac481c",
        "risk_assessment_group_id": "576c9bcc8bd4d4bdc2ac429d",
        "date": "2016-01-01",
        "value": 3
      }
    }
  ]
}

Show Individual Patient

GET /api/patients/:id

Response (HTTP 200)

{
  {
    "id": "576c9bcc8bd4d4bdc2ac42b5",
    "address": {
      "street": ["4691 7th Way"],
      "city": "Loyalton",
      "state": "WY",
      "postal_code": "01409"
    },
    "age": "34",
    "gender": "female",
    "birth_date": "1982-07-21",
    "name": {
      "family": "Banks9849",
      "given": "Jacqueline",
      "middle_initial": null,
      "full": "Jacqueline Banks9849"
    },
    "next_huddle_id": "576c9bbf8bd4a4bdc2ac2038",
    "active_conditions": [
      {
        "name": "Liver Cancer",
        "start_date": "2015-12-14",
        "end_date": null
      },
      {
        "name": "Bronchitis",
        "start_date": "2012-05-30",
        "end_date": null
      }
    ],
    "active_medications": [
      {
        "name": "Sorafenib Oral Tablet",
        "start_date": "2010-04-01",
        "end_date": null
      }
    ],
    "active_allergies": [
      {
        "name": "Peanut",
        "start_date": "1987-01-01",
        "end_date": null
      }
    ]
  }
}

List Printable Patients

GET /api/patients/print

Parameters

Name Type Description
risk_assessment_group_id string Filter by risk assessment group ID
huddle_id string Filter by huddle ID
care_team_id string Filter by care team ID
population_ids string Filter by one or more populations (comma delimited)
population_filter_method string Population filter method (one of: intersection, union). Default: intersection
sort_by string Sort by options (name, birthdate, gender, address, riskScore, notifications). Up to two sort values can be passed in, separated by commas. The first value will be the primary sort. A + can be prepended to an option to sort ascending. A - can be prepended to an option to sort descending. (e.g., sort_by=-name,age would sort by name descending as primary and age ascending as secondary)
search_term string Search term to filter patients by name

Response (HTTP 200)

{
  "patients": [
    {
      "id": "576c9bcc8bd4d4bdc2ac42b5",
      "age": 34,
      "gender": "female",
      "name": "Jacqueline Banks9849",
      "next_huddle": {
        "id": "576c9bce8bd4d4bdc2ac47c7",
        "reason": "Risk Score Warrants Discussion",
        "reason_type": "RISK_SCORE",
        "reviewed": true,
        "reviewed_at": "2017-01-06T11:20:00Z"
      },
      "recent_risk_assessment": {
        "id": "576c9bcf8bd4d4bdc2ac481c",
        "risk_assessment_group_id": "576c9bcc8bd4d4bdc2ac429d",
        "date": "2016-01-01",
        "value": 3
      }
    }
  ]
}

Huddles

List Huddles

GET /api/care_teams/:id/huddles

Parameters

Name Type Description
patient_id string Filters results by patient ID
date date Filters results for huddles that occur on the date. Expected to be a ISO 8601 formatted date without timestamp: YYYY-MM-DD

Response (HTTP 200)

{
  "huddles": [
    {
      "id": "576c9bbf8bd4d4bdc2ac4189",
      "date": "2017-01-06",
      "care_team_id": "576c9bcc8bd4d4bdc2ac42b5",
      "patients": [
        {
          "id": "576c9bce8bd4d4bdc2ac47c7",
          "reason": "Risk Score Warrants Discussion",
          "reason_type": "RISK_SCORE",
          "reviewed": true,
          "reviewed_at": "2017-01-06T11:20:00Z"
        }
      ]
    }
  ]
}

Add Patient to Huddle

POST /api/care_teams/:id/huddles

Parameters

Name Type Description
date date The date the huddle will occur on. Expected to be a ISO 8601 formatted date without timestamp: YYYY-MM-DD
patient_id string The patient to add
huddle_id string The huddle the patient is being added to
reason string Reason code for being added. Ex. RISK_CODE

Behavior

If a huddle on the given date does not exist for the care team it will be created and the patient added to it. If a huddle already exists then the patient is added to it.

Response (HTTP 201 on huddle create, HTTP 200 on huddle update)

{
  "huddle": {
    "id": "5805a1298bd4d4495e38af3c",
    "date": "2017-01-07",
    "care_team_id": "576c9bcc8bd4d4bdc2ac42b5",
    "patients": [
      {
        "id": "576c9bce8bd4d4bdc2ac470b",
        "reason": "My reason",
        "reason_type": "MANUAL_ADDITION",
        "reviewed": false,
        "reviewed_at": null
      }
    ]
  }
}

Remove Patient from Huddle

DELETE /api/huddle/:id/patients/:patient_id

Behavior

If the patient being removed is the last patient in the huddle, then the huddle will be deleted as well.

Response (HTTP 200) - patient is not the last patient in the huddle

{
  "huddle": {
    "id": "5805a1298bd4d4495e38af3c",
    "date": "2017-01-07",
    "care_team_id": "576c9bcc8bd4d4bdc2ac42b5",
    "patients": [
      {
        "id": "576c9bce8bd4d4bdc2ac470b",
        "reason": "My reason",
        "reason_type": "MANUAL_ADDITION",
        "reviewed": false,
        "reviewed_at": null
      },
      {
        "id": "576c9bcc8bd4d4bdc2ac4235",
        "reason": "My other reason",
        "reason_type": "MANUAL_ADDITION",
        "reviewed": false,
        "reviewed_at": null
      }
    ]
  }
}

Response (HTTP 204) - patient was the last patient in the huddle

empty response

Populations

List Populations

GET /api/populations

Response (HTTP 200)

{
  "populations": [
    {
      "id": "2805a12a8bd4d4d95e38a43c",
      "name": "Age 65 and under"
    }
  ]
}

Show Individual Population

GET /api/populations/:id

Response (HTTP 200)

{
  "population": {
    "id": "2805a12a8bd4d4d95e38a43c",
    "name": "Age 65 and under",
    "filters": [
      {
        "filter_type": "age",
        "time_unit": "years",
        "comparator": "between",
        "range": {
          "low": 0,
          "high": 65
        }
      },
      {
        "filter_type": "gender",
        "value": "male"
      },
      {
        "filter_type": "condition",
        "codes": [
          {
            "system": "IDC-9",
            "code": "427.31"
          }
        ]
      },
      {
        "filter_type": "encounter",
        "codes": [
          {
            "system": "IDC-9",
            "code": "427.31"
          }
        ]
      }
    ]
  }
}

Create Population

POST /api/populations

Parameters

Name Type Description
name string The population name
filters string JSON encoded filter representation

Response (HTTP 201)

{
  "population": {
    "id": "2805a12a8bd4d4d95e38a43c",
    "name": "Age 65 and under",
    "filters": [
      {
        "filter_type": "age",
        "time_unit": "years",
        "comparator": "between",
        "range": {
          "low": 0,
          "high": 65
        }
      }
    ]
  }
}

Update Population

PUT /api/populations/:id

Parameters

Name Type Description
name string The population name
filters string JSON encoded filter representation

Response (HTTP 200)

{
  "population": {
    "id": "2805a12a8bd4d4d95e38a43c",
    "name": "Age 70 and under",
    "filters": [
      {
        "filter_type": "age",
        "time_unit": "years",
        "comparator": "between",
        "range": {
          "low": 0,
          "high": 70
        }
      }
    ]
  }
}

Delete Population

DELETE /api/populations/:id

Response (HTTP 204)

empty response

Get Filter Builder Counts

POST /api/filter_builder_counts

Parameters

Name Type Description
filters string JSON encoded filter representation

Response (HTTP 200)

{
  "conditions": 61,
  "encounters": 99,
  "patients": 33
}

Risk Assessments

List Risk Services

GET /api/risk_services

Response (HTTP 200)

[
    {
      "id": "MultiFactor",
      "name": "Catastrophic Health Event"
    },
    {
      "id": "Stroke",
      "name": "Ischemic Stroke Risk"
    }
]

List Risk Assessments

GET /api/patients/:id/risk_assessments

Parameters

Name Type Description
risk_service_id string Filter by the risk service ID, required
start_date date Optional. Returns risk assessments that occurred at or after this date
end_date date Optional. Returns risk assessments that occurred at or before this date

Response (HTTP 200)

{
  "risk_assessments": [
    {
      "id": "576c9bcf8bd4d4bdc2ac481c",
      "risk_service_id": "576c9bcc8bd4d4bdc2ac429d",
      "date": "2016-01-01",
      "value": 3
    }
  ]
}

List Risk Assessment Breakdown

GET /api/risk_assessments/:id/breakdown

Response (HTTP 200)

[
      {
        "name": "Clinical Risk",
        "weight": 25,
        "value": 1,
        "max_value": 4
      },
      {
        "name": "Functional and Environmental Risk",
        "weight": 25,
        "value": 1,
        "max_value": 4
      },
      {
        "name": "Psychosocial and Mental Health Risk",
        "weight": 25,
        "value": 2,
        "max_value": 4
      },
      {
        "name": "Utilization Risk",
        "weight": 25,
        "value": 1,
        "max_value": 4
      }
]

Events

List Events

GET /api/patients/:id/events

Parameters

Name Type Description
risk_service_id string Risk service id (required when querying for risk_change)
type string Comma separated string, filters results by event type (medication, condition, encounter, and risk_change)
start_time string Filters results by start time (required for risk change events)
end_time string Filters results by end time

Response (HTTP 200)

[
    {
      "id": "576c9bbf8bd4d4bdc2ac4189",
      "type": "medication_start",
      "display_name": "Sorafenib Oral Tablet",
      "start_date": "2015-07-06T00:00:00Z"
    },
    {
      "id": "576c9bbf8bd4d4bdc2ac4190",
      "type": "risk_change",
      "display_name": "Catastrophic Health Event",
      "start_date": 2015-07-06T00:00:00Z,
      "end_date": 2017-07-06T00:00:00Z,
      "old_value": 3,
      "new_value": 2
    }
]
Clone this wiki locally