cycquery.mimiciv.MIMICIVQuerier

class MIMICIVQuerier(dbms, user='', password='', host='', port=None, database='', schemas=None)[source]

Bases: DatasetQuerier

MIMICIV dataset querier.

Methods

chartevents

Query ICU chart events from the ICU module.

diagnoses_icd

Query MIMIC diagnosis data.

get_table

Get a table and possibly map columns to have standard names.

labevents

Query lab events from the hospital module.

list_columns

List columns in a table.

list_custom_tables

List custom tables methods provided by the dataset API.

list_schemas

List schemas in the database to query.

list_tables

List table methods that can be queried using the database.

patients

Query MIMIC patient data.

procedures_icd

Query MIMIC procedures data.

chartevents()[source]

Query ICU chart events from the ICU module.

Returns:

Constructed table, wrapped in an interface object.

Return type:

cycquery.interface.QueryInterface

diagnoses_icd()[source]

Query MIMIC diagnosis data.

Returns:

Constructed query, wrapped in an interface object.

Return type:

cycquery.interface.QueryInterface

get_table(schema_name, table_name, cast_timestamp_cols=True)

Get a table and possibly map columns to have standard names.

Standardizing column names allows for columns to be recognized in downstream processing.

Parameters:
  • schema_name (str) – Name of schema in the database.

  • table_name (str) – Name of table in the database.

  • cast_timestamp_cols (bool) – Whether to cast timestamp columns to datetime.

Returns:

Table with mapped columns.

Return type:

sqlalchemy.sql.selectable.Subquery

labevents()[source]

Query lab events from the hospital module.

Returns:

Constructed query, wrapped in an interface object.

Return type:

cycquery.interface.QueryInterface

list_columns(schema_name, table_name)

List columns in a table.

Parameters:
  • schema_name (str) – Name of schema in the database.

  • table_name (str) – Name of table in the database.

Returns:

List of column names.

Return type:

List[str]

list_custom_tables()

List custom tables methods provided by the dataset API.

Returns:

List of custom table names.

Return type:

List[str]

list_schemas()

List schemas in the database to query.

Returns:

List of schema names.

Return type:

List[str]

list_tables(schema_name=None)

List table methods that can be queried using the database.

Parameters:

schema_name (Optional[str]) – Name of schema in the database.

Returns:

List of table names.

Return type:

List[str]

patients()[source]

Query MIMIC patient data.

Returns:

Constructed query, wrapped in an interface object.

Return type:

cycquery.interface.QueryInterface

Notes

The function infers the approximate year a patient received care, using the anchor_year and anchor_year_group columns. The join and ops supplied are applied after the approximate year is inferred. dod is adjusted based on the inferred approximate year of care.

procedures_icd()[source]

Query MIMIC procedures data.

Returns:

Constructed query, wrapped in an interface object.

Return type:

cycquery.interface.QueryInterface