Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sprivite committed Nov 11, 2024
1 parent fff5043 commit 8ac0fb5
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dist/
.DS_Store
notebooks/*
mlruns/*
docs/*
site/*
.devcontainer/*
.idea
.idea/*
Expand Down
3 changes: 3 additions & 0 deletions docs/api/phenotypes/codelist_phenotype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CodelistPhenotype

::: phenx.phenotypes.codelist_phenotype
3 changes: 3 additions & 0 deletions docs/api/phenotypes/measurement_phenotype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# MeaurementPhenotype

::: phenx.phenotypes.measurement_phenotype
Binary file added docs/assets/fonts/SNPro-Black.otf
Binary file not shown.
Binary file added docs/assets/fonts/SNPro-Bold.otf
Binary file not shown.
Binary file added docs/assets/fonts/SNPro-Regular.otf
Binary file not shown.
Binary file added docs/assets/phenex_feather_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/phenx_feather.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/phenx_feather_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions docs/assets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* custom.css */
@font-face {
font-family: "SNPro-regular";
src: url("./fonts/SNPro-Regular.otf") format("opentype");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "SNPro-bold";
src: url("./fonts/SNPro-Bold.otf") format("opentype");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "SNPro-black";
src: url("./fonts/SNPro-Black.otf") format("opentype");
font-weight: normal;
font-style: normal;
}

/* Example usage */
body {
font-family: "SNPro-regular", sans-serif; /* Use the custom font */
}

#main_title {
font-family: "SNPro-black", sans-serif; /* Use the custom font */
background-size: 100% 100%; /* Ensure the gradient covers the entire text */
background: linear-gradient(#e32b0e 20%, #71010c 80%);
-webkit-background-clip: text; /* Clip the background to the text */
-webkit-text-fill-color: transparent; /* Make the text color transparent */
font-size: 150px; /* Change size of h1 headings */
}

h1,
h2,
h3 {
font-family: "SNPro-bold", sans-serif; /* Apply to headings */
background: linear-gradient(#e32b0e 20%, #71010c 80%);
-webkit-background-clip: text; /* Clip the background to the text */
-webkit-text-fill-color: transparent; /* Make the text color transparent */
}

h2 {
font-size: 100px;
}
h3 {
font-size: 25px;
}
34 changes: 34 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Introduction

Implementing observational studies using real-world data (RWD) is challenging, requiring expertise in epidemiology, medical practice, and data engineering. Currently, observational studies are often implemented as bespoke software packages by individual data analysts or small teams. While tools exist, such as open-source tools from the OHDSI program in the R language and proprietary tools from vendors like Aetion or Panalgo, there are no open-source tools for Python-based implementation of observational studies using RWD.

PhenEx (Automated Phenotype Extraction) aims to fill this gap. PhenEx is a Python-based software package that aims to provide reusuable and end-to-end tested implementations of commonly performed operations in the implementation of observational studies. PhenEx is designed with a focus on ease of writing and reading cohort definitions. Medical domain knowledge should be clear and simple, without requiring an understanding of complex data schemas. Ideally, a cohort definition should read like free text.

# Basics of PhenEx design

## The Phenotype class

The most basic concept in PhenEx is the phenotype. A Phenotype is a set of criteria that define a cohort of patients. In a clinical setting, a Phenotype is usually identified by the phrase "patient presents with ...". For example, a phenotype could be "patient presents with diabetes". In the observational setting, we would cacluate the phenotype "patient presents with diabetes" by looking for patients who have a diagnosis of diabetes in their medical record in certain time frame.

A phenotype can reference other phenotypes. For instance, the phenotype "untreated diabetic patients" might translate to real-world data as "having a diagnosis of diabetes but not having a prescription for insulin or metformin". In this case, the prescription phenotype refers to the diabetes phenotype to build the overall phenotype. In PhenEx, your job is to simply specify these criteria. PhenEx will take care of the rest.

All studies are built through the calculation of various phenotypes:

- entry criterion phenotype
- inclusion phenotypes
- exclusion phenotypes
- baseline characteristic phenotypes, and
- outcome phenotypes.

After defining the parameters of all these phenotypes in the study definition file, PhenEx will compute the phenotypes and return a cohort table, which contains the set of patients which satisfied all the inclusion / exclusion / entry criteria for the specified study. Additionally, a baseline characteristics table will be computed and reports generated, including a waterfall chart, the distributions of baseline characteristics.

# Architecture

Below is an illustration of the basic design of the PhenEx in the evidence generation ecosystem.

.. image:: architecture.jpg
:width: 500

# Getting started

To get started, please head over to our tutorial and demos.
70 changes: 70 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Installation instructions


The code can currently only be installed from git source. To install the code, first clone the repository:
```
git clone git@github.com:bayer-int/phenx.git
```
Then, change into the directory containing the code:
```
cd phenx
```
# User installation

Use these instructions if you do not plan to change code within phenx.

It is best to use a separate virtual environment for the installation. You can create a conda virtual environment as follows:
```
conda create -n phenx python=3.11
```
If you do not have conda, you can install it by following the instructions `here <https://conda.io/projects/conda/en/latest/user-guide/install/index.html>`_.
phenx requires Python 3.9 or above.

To use the virtual environment, activate it:
```
conda activate phenx
```
After activating the virtual environment, install the required dependencies with
```
pip install -r requirements.txt
```
and install phenx with
```
pip install .
```
Check that the installation has succeeded:
```
python3.11 -c "import phenx;print(phenx.__version__)"
```
This will display the installed version of phenx.

If you wish to use phenx within a Jupyter notebook, you can install the Jupyter kernel with
```
python3.11 -m ipykernel install --user --name phenx --display-name "Python (phenx)"
```
That's it! Proceed to the :ref:`Demos`.

# Pip installation
Coming soon!

# Docker installation

We also support an installation via Docker. You may want to try the Docker installation if you have trouble with the standard installation.

You can generate a docker image with
```
docker build -t phenx:latest .
```
and then run it with
```
docker run --entrypoint /bin/bash -v $(pwd):/phenx -it phenx:latest
```
This will drop you into a shell inside the docker container with the current directory (i.e. the source code directory) mounted at `/phenx`.


# Running the tests
A good way to check your installation is to run the extensive test suite that phenx comes with. You can do so by running:
```
pytest
```
from the root directory of the project.
5 changes: 5 additions & 0 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# My Documentation

Here is a Jupyter Notebook:

![Tutorial](CodelistPhenotype_Tutorial.ipynb)

0 comments on commit 8ac0fb5

Please sign in to comment.