API Reference¶
Inspector¶
inspectomop.Inspector
Constructor¶
Inspector (connection_url) |
Creates an Inspector object which can be used to run OMOP data queries |
Attributes¶
Inspector.connection_url |
password@host:port/database’ used to specify the dialect, location, etc. |
Inspector.engine |
A convenience hook to the underlying sqlalchemy engine. |
Inspector.tables |
A dictionary containing all OMOP CDM tables in the connected database. |
Inspector.vocabularies_tables |
A dictionary containing all of the Vocabularies OMOP CDM tables in the connected database. |
Inspector.metadata_tables |
A dictionary containing all of the MetaData OMOP CDM tables in the connected database. |
Inspector.clinical_tables |
A dictionary containing all of the Clinical OMOP CDM tables in the connected database. |
Inspector.health_system_tables |
A dictionary containing all of the Health System OMOP CDM tables in the connected database. |
Inspector.health_economics_tables |
A dictionary containing all of the Health Economics OMOP CDM tables in the connected database. |
Inspector.derived_elements_tables |
A dictionary containing all of the Derived Elements OMOP CDM tables in the connected database. |
Methods¶
Inspector.attach_sqlite_db (db_file, schema_name) |
For SQLite backends, attaches an additional sqlite database file. |
Inspector.execute (statement) |
Executes an SQL query on the OMOP CDM. |
Inspector.table_info (table_name) |
Return a Pandas DataFrame describing the fields and properties of a table. |
Results¶
inspectomop.Results
Constructor¶
Results (results_proxy) |
A cursor-like object with methods such as fetchone, fetchmany etc. |
Warning
Although a public constructor exists, Results objects are meant to be instantiated indirectly from calls to inspector.execute()
Methods¶
Results.as_pandas () |
Return all rows from a results object as a pandas DataFrame |
Results.as_pandas_chunks (chunksize) |
Yields a pandas DataFrame with n_rows = chunksize |
Results.fetchone () |
Fetch one row, just like DB-API cursor.fetchone() . |
Results.fetchmany ([size]) |
Fetch many rows, just like DB-API cursor.fetchmany(size=cursor.arraysize) . |
Results.fetchall () |
Fetch all rows, just like DB-API cursor.fetchall() . |
Queries¶
inspectomop.queries
Care Site¶
inspectomop.queries.care_site
facility_counts_by_type (inspector[, …]) |
Returns facility counts by type in the OMOP CDM i.e. |
patient_counts_by_care_site_type (inspector) |
Returns pateints counts by facility type. |
Condition¶
inspectomop.queries.condition
anatomical_site_by_keyword (keyword, inspector) |
Retrieves anitomical site concepts given a keyword. |
condition_concept_for_concept_id (concept_id, …) |
Retrieves the condition concept for a condition_concept_id. |
condition_concepts_for_keyword (keyword, …) |
Retrieves standard concepts for a condition/keyword. |
condition_concepts_for_source_codes (…[, …]) |
Retrieves standard condition concepts for source codes. |
condition_concepts_occurring_at_anatomical_site_concept_id (…) |
Retrieves condition concepts that occur at a given anatomical site. |
conditions_caused_by_pathogen_or_causative_agent_concept_id (…) |
Retreives all conditions caused by a pathogen or other causative agent concept_id. |
disease_causing_agents_for_keyword (keyword, …) |
Retrieves disease causing agents by keyword. |
source_codes_for_concept_ids (concept_ids, …) |
Retreives source condition concepts for OMOP concept_ids. |
pathogen_concept_for_keyword (keyword, inspector) |
Retrieves pathogen concepts based on a keyword with ‘Organsim’ as the concept_class_id. |
place_of_service_counts_for_condition_concept_id (…) |
Provides counts of conditions stratified by place_of_service (Office, Inpatient Hospital, etc.) |
Drug¶
inspectomop.queries.drug
drug_classes_for_drug_concept_id (concept_id, …) |
Returns drug classes for drug or ingredient concept_ids. |
drug_concepts_for_ingredient_concept_id (…) |
Get all drugs that contain a given ingredient. |
indications_for_drug_concept_id (concept_id, …) |
Find all indications for a drug given a concept_id. |
ingredients_for_drug_concept_ids (…[, …]) |
Get ingredients for brand or generic drug concept_ids. |
ingredient_concept_ids_for_ingredient_names (…) |
Get concept_ids for a list of ingredients. |
General¶
inspectomop.queries.general
ancestors_for_concept_id (concept_id, inspector) |
Find all ancestor concepts for a concept_id. |
children_for_concept_id (concept_id, inspector) |
Find all child concepts for a concept_id. |
concepts_for_concept_ids (concept_ids, inspector) |
Returns concept information for a list of concept_ids |
descendants_for_concept_id (concept_id, inspector) |
Find all descendant concepts for a concept_id. |
parents_for_concept_id (concept_id, inspector) |
Find all parent concepts for a concept_id. |
related_concepts_for_concept_id (concept_id, …) |
Find all concepts related to a concept_id. |
siblings_for_concept_id (concept_id, inspector) |
Find all sibling concepts for a concept_id i.e.(concepts that share common parents). |
synonyms_for_concept_ids (concept_ids, inspector) |
Returns concept information for a list of concept_ids |
standard_vocab_for_source_code (source_code, …) |
Convert source code to all mapped standard vocabulary concepts. |
Observation¶
inspectomop.queries.observation
observation_concepts_for_keyword (keyword, …) |
Search for LOINC and UCUM concepts by keyword. |
Payer Plan¶
inspectomop.queries.payer_plan
counts_by_years_of_coverage (inspector) |
Returns counts of payer coverage based on continuous coverage (payer_plan_period_start_date - payer_plan_period_end_date)365.25. |
patient_distribution_by_plan_type (inspector) |
Returns counts of payer coverage by plan type. |
Person¶
inspectomop.queries.person
patient_counts_by_gender (inspector[, …]) |
Returns patient counts grouped by gender for the database or alternativily, for a supplied list of person_ids. |
patient_counts_by_year_of_birth (inspector[, …]) |
Returns patient counts grouped by year of birth for the database or alternativily, for a supplied list of person_ids. |
patient_counts_by_residence_state (inspector) |
Returns patient counts grouped by state for the database or alternativily, for a supplied list of person_ids. |
patient_counts_by_zip_code (inspector[, …]) |
Returns patient counts grouped by zip code for the database or alternativily, for a supplied list of person_ids. |
patient_counts_by_year_of_birth_and_gender (…) |
Returns patient counts stratified by year of birth and gender for the database or alternativily, for a supplied list of person_ids. |