Skip to content

Commit

Permalink
Merge branch 'main' into update_actions_versions
Browse files Browse the repository at this point in the history
  • Loading branch information
amrit110 authored Apr 17, 2024
2 parents fe895bd + ab4aca4 commit b7786ef
Show file tree
Hide file tree
Showing 34 changed files with 502 additions and 1,047 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ venv
mlruns
.profile
.env
*.html
_extract
*.gzip
*checkpoint*
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to cyclops-query
# Contributing to cycquery

Thanks for your interest in contributing to cyclops-query tool!
Thanks for your interest in contributing to cycquery tool!

To submit PRs, please fill out the PR template along with the PR. If the PR
fixes an issue, don't forget to link the PR to the issue!
Expand Down
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
cyclops-query
cycquery
--------------------------------------------------------------------------------

[![PyPI](https://img.shields.io/pypi/v/cycquery)](https://pypi.org/project/cycquery)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cycquery)
[![code checks](https://github.com/VectorInstitute/cyclops-query/actions/workflows/code_checks.yml/badge.svg)](https://github.com/VectorInstitute/cyclops-query/actions/workflows/code_checks.yml)
[![integration tests](https://github.com/VectorInstitute/cyclops-query/actions/workflows/integration_tests.yml/badge.svg)](https://github.com/VectorInstitute/cyclops-query/actions/workflows/integration_tests.yml)
[![docs](https://github.com/VectorInstitute/cyclops-query/actions/workflows/docs_deploy.yml/badge.svg)](https://github.com/VectorInstitute/cyclops-query/actions/workflows/docs_deploy.yml)
[![codecov](https://codecov.io/gh/VectorInstitute/cyclops-query/branch/main/graph/badge.svg)](https://codecov.io/gh/VectorInstitute/cyclops-query)
[![license](https://img.shields.io/github/license/VectorInstitute/cyclops-query.svg)](https://github.com/VectorInstitute/cyclops-query/blob/main/LICENSE)
[![code checks](https://github.com/VectorInstitute/cycquery/actions/workflows/code_checks.yml/badge.svg)](https://github.com/VectorInstitute/cycquery/actions/workflows/code_checks.yml)
[![integration tests](https://github.com/VectorInstitute/cycquery/actions/workflows/integration_tests.yml/badge.svg)](https://github.com/VectorInstitute/cycquery/actions/workflows/integration_tests.yml)
[![docs](https://github.com/VectorInstitute/cycquery/actions/workflows/docs_deploy.yml/badge.svg)](https://github.com/VectorInstitute/cycquery/actions/workflows/docs_deploy.yml)
[![codecov](https://codecov.io/gh/VectorInstitute/cycquery/branch/main/graph/badge.svg)](https://codecov.io/gh/VectorInstitute/cycquery)
[![license](https://img.shields.io/github/license/VectorInstitute/cycquery.svg)](https://github.com/VectorInstitute/cycquery/blob/main/LICENSE)

``cyclops-query`` is a tool for querying relational databases using a simple Python API. It is specifically developed to query
``cycquery`` is a tool for querying relational databases using a simple Python API. It is specifically developed to query
Electronic Health Record (EHR) databases. The tool is a wrapper around [SQLAlchemy](https://www.sqlalchemy.org/) and can be used
to write SQL-like queries in Python, including joins, conditions, groupby aggregation and many more.

## 🐣 Getting Started

### Installing cyclops-query using pip
### Installing cycquery using pip

```bash
python3 -m pip install cycquery
Expand Down Expand Up @@ -89,27 +89,9 @@ make html SPHINXOPTS="-D nbsphinx_allow_errors=True"

### Contributing

Contributing to ``cyclops-query`` is welcomed.
See [Contributing](https://vectorinstitute.github.io/cyclops-query/api/contributing.html) for
Contributing to ``cycquery`` is welcomed.
See [Contributing](https://vectorinstitute.github.io/cycquery/api/contributing.html) for
guidelines.


## 📚 [Documentation](https://vectorinstitute.github.io/cyclops-query/)


## 🎓 Citation

Reference to cite when you use ``cyclops-query`` in a project or a research paper:

```
@article {Krishnan2022.12.02.22283021,
author = {Krishnan, Amrit and Subasri, Vallijah and McKeen, Kaden and Kore, Ali and Ogidi, Franklin and Alinoori, Mahshid and Lalani, Nadim and Dhalla, Azra and Verma, Amol and Razak, Fahad and Pandya, Deval and Dolatabadi, Elham},
title = {CyclOps: Cyclical development towards operationalizing ML models for health},
elocation-id = {2022.12.02.22283021},
year = {2022},
doi = {10.1101/2022.12.02.22283021},
publisher = {Cold Spring Harbor Laboratory Press},
URL = {https://www.medrxiv.org/content/early/2022/12/08/2022.12.02.22283021},
journal = {medRxiv}
}
```
## 📚 [Documentation](https://vectorinstitute.github.io/cycquery/)
8 changes: 0 additions & 8 deletions cycquery/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
"""The ``query`` API provides classes to query EHR databases."""

try:
import sqlalchemy
except ImportError:
raise ImportError(
"CyclOps is not installed with query API support! Please install using 'pip install cyclops[query]'.", # noqa: E501
) from None


from cycquery.base import DatasetQuerier
from cycquery.eicu import EICUQuerier
from cycquery.gemini import GEMINIQuerier
Expand Down
32 changes: 16 additions & 16 deletions cycquery/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _to_subquery(table: TableTypes) -> Subquery:
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
Table to convert.
Returns
Expand Down Expand Up @@ -104,7 +104,7 @@ def _to_select(table: TableTypes) -> Select:
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
Table to convert.
Returns
Expand Down Expand Up @@ -184,7 +184,7 @@ def table_params_to_type(to_type: TableTypes) -> Callable[..., Any]:
Parameters
----------
to_type: cyclops.query.util.TableTypes
to_type: cycquery.util.TableTypes
The type to which to convert.
Returns
Expand Down Expand Up @@ -217,7 +217,7 @@ def get_column(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table with the column.
col: str
Name of column to extract.
Expand All @@ -244,7 +244,7 @@ def filter_columns(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table with the column.
cols: str or list of str
Name of columns to keep.
Expand Down Expand Up @@ -275,7 +275,7 @@ def get_columns(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
cols: str or list of str
Names of columns to extract.
Expand All @@ -295,7 +295,7 @@ def get_column_names(table: TableTypes) -> List[str]:
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
Returns
Expand All @@ -317,7 +317,7 @@ def has_columns(
Parameters
----------
table : cyclops.query.util.TableTypes
table : cycquery.util.TableTypes
Table to check.
cols: str or list of str
Required columns.
Expand Down Expand Up @@ -413,7 +413,7 @@ def drop_columns(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
col : str or list of str
Names of columns to drop.
Expand All @@ -440,7 +440,7 @@ def rename_columns(table: TableTypes, rename_map: Dict[str, str]) -> Subquery:
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
rename_map : dict
Dictionary mapping current column names (key) to new ones (value).
Expand All @@ -465,7 +465,7 @@ def reorder_columns(table: TableTypes, cols: List[str]) -> Subquery:
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table to reorder.
cols : list of str
New order of columns, which must include all existing columns.
Expand Down Expand Up @@ -514,7 +514,7 @@ def apply_to_columns(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
col_names: str or list of str
Columns to which to apply the function.
Expand Down Expand Up @@ -575,7 +575,7 @@ def trim_columns(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
cols: str or list of str
Names of columns to trim.
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def _check_column_type(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
cols: str or list of str
Column names to check.
Expand Down Expand Up @@ -1144,7 +1144,7 @@ def check_timestamp_columns(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
cols: str or list of str
Column names to check.
Expand Down Expand Up @@ -1177,7 +1177,7 @@ def get_delta_column(
Parameters
----------
table: cyclops.query.util.TableTypes
table: cycquery.util.TableTypes
The table.
years: None or str
Years column.
Expand Down
2 changes: 1 addition & 1 deletion cycquery/utils/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Common utility functions that can be used across multiple cyclops packages."""
"""Common utility functions that can be used across multiple cycquery packages."""

import warnings
from datetime import datetime
Expand Down
6 changes: 6 additions & 0 deletions docs/source/_static/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
requirejs.config({
paths: {
base: '/static/base',
plotly: 'https://cdn.plot.ly/plotly-2.30.0.min.js?noext',
},
});
1 change: 1 addition & 0 deletions docs/source/_static/require.min.js

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions docs/source/_templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<!doctype html>
<html class="no-js"{% if language is not none %} lang="{{ language }}"{% endif %}>
<head>
{%- block site_meta -%}
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark">
<meta name="google-site-verification" content="i0qQRaR9OA3tSz_9tDocdcXGY27Ox_cy4FrvTHD2C_0" />

{%- if metatags %}{{ metatags }}{% endif -%}

{# Make sure all pages have a description or Bing does not like us #}
{% if 'name="description"' not in metatags %}
<meta name="description" content="CyclOps Python API documentation">
{% endif %}

{%- block linktags %}
{%- if hasdoc('about') -%}
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
{%- endif -%}
{%- if hasdoc('genindex') -%}
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
{%- endif -%}
{%- if hasdoc('search') -%}
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
{%- endif -%}
{%- if hasdoc('copyright') -%}
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
{%- endif -%}
{%- if next -%}
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
{%- endif -%}
{%- if prev -%}
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
{%- endif -%}
{#- rel="canonical" (set by html_baseurl) -#}
{%- if pageurl %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- endif %}
{%- endblock linktags %}

{# Favicon #}
{%- if favicon_url -%}
<link rel="shortcut icon" href="{{ favicon_url }}"/>
{%- endif -%}

{#- Generator banner -#}
<meta name="generator" content="sphinx-{{ sphinx_version }}, furo {{ furo_version }}"/>

{# Bing webmasters meta tag #}
<meta name="msvalidate.01" content="8D2A5032F006424CAF54C0DDCD16F666" />

{%- endblock site_meta -%}

{#- Site title -#}
{%- block htmltitle -%}
{# See Sphinx monkey patch in conf.py #}
{% if 'title' in metas %}
<title>{{ metas.title }}</title>
{% elif not docstitle %}
<title>{{ title|striptags|e }}</title>
{% elif pagename == master_doc %}
<title>{{ docstitle|striptags|e }}</title>
{% else %}
<title>{{ title|striptags|e }} - {{ docstitle|striptags|e }}</title>
{% endif %}
{%- endblock -%}

{%- block styles -%}

{# Custom stylesheets #}
{%- block regular_styles -%}
{%- for css in css_files -%}
{% if css|attr("filename") -%}
{{ css_tag(css) }}
{%- else -%}
<link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" />
{%- endif %}
{% endfor -%}
{%- endblock regular_styles -%}

{#- Theme-related stylesheets -#}
{%- block theme_styles %}
{% include "partials/_head_css_variables.html" with context %}
{%- endblock -%}

{%- block extra_styles %}
{%- endblock -%}

{%- endblock styles -%}

{#- Custom front matter #}
{%- block extrahead -%}{%- endblock -%}

{# Custom JS #}
{%- block regular_scripts -%}
{% for path in script_files -%}
{{ js_tag(path) }}
{% endfor -%}
{%- endblock regular_scripts -%}

{# Theme-related JavaScript code #}
{%- block theme_scripts -%}
{%- endblock -%}

{# Footer icons #}
<script src="https://kit.fontawesome.com/2c1f516901.js" crossorigin="anonymous"></script>

</head>
<body>
{% block body %}
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
{% endblock %}

{%- block scripts -%}
{%- endblock scripts -%}
</body>
</html>
2 changes: 1 addition & 1 deletion docs/source/_templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
</div>
<div class="footer-container" style="text-align: center;">
<div class="footer-small-text">
<br> All <a href="https://github.com/VectorInstitute/cyclops">source code for cyclops</a> is freely available under the terms of an <a href="https://opensource.org/licenses/Apache-2.0">Apache-2.0</a> license.
<br> All <a href="https://github.com/VectorInstitute/cycquery">source code for cycquery</a> is freely available under the terms of an <a href="https://opensource.org/licenses/Apache-2.0">Apache-2.0</a> license.
</div>

<div class="footer-small-text">
Expand Down
Loading

0 comments on commit b7786ef

Please sign in to comment.