Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sprivite committed Nov 12, 2024
1 parent 137a60e commit 8016d9e
Show file tree
Hide file tree
Showing 9 changed files with 381 additions and 364 deletions.
157 changes: 157 additions & 0 deletions arch.drawio

Large diffs are not rendered by default.

Binary file added arch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
313 changes: 0 additions & 313 deletions architecture.drawio

This file was deleted.

Binary file removed architecture.jpg
Binary file not shown.
157 changes: 157 additions & 0 deletions docs/assets/architecture.drawio

Large diffs are not rendered by default.

Binary file added docs/assets/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 10 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<div id="main_title" class="my-class">
PhenEx
</div>
Expand All @@ -9,30 +8,30 @@ Implementing observational studies using real-world data (RWD) is challenging, r

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.
- 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
![Architecture](assets/architecture.png)

# Getting started
To get started, please head over to our tutorial and demos.

To get started, please head over to our [tutorials](tutorials.md).
88 changes: 51 additions & 37 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,84 @@
# Installation instructions
## Setup environment

Before installing, it is best to use a separate virtual environment for the installation. You can create a conda virtual environment as follows:

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
conda create -n phenex python=3.12
```
Then, change into the directory containing the code:

If you do not have condas, 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:

```
cd phenx
conda activate phenex
```
# User installation

Use these instructions if you do not plan to change code within phenx.
With condas, sometimes you have explicitly reference python3.12; to avoid this, you can set up an alias:

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
alias python=python3.12
```
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:
## Source installation

The code can currently only be installed from git source. To install the code, first clone the repository:

```
git clone git@github.com:Bayer-Group/PhenEx.git
```

Then, change into the directory containing the code:

```
conda activate phenx
cd PhenEx
```

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

After activating the virtual environment, install the required dependencies with

```
pip install -r requirements.txt
```
and install phenx with

and install PhenEx 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
### Running the tests

A good way to check your source installation is to run the extensive test suite that PhenEx comes with. You can do so by running:

```
python3.11 -m ipykernel install --user --name phenx --display-name "Python (phenx)"
pytest
```
That's it! Proceed to the :ref:`Demos`.

# Pip installation
Coming soon!
from the root directory of the project.

# Docker installation
## Installing Jupyter

We also support an installation via Docker. You may want to try the Docker installation if you have trouble with the standard installation.
If you wish to use PhenEx within a Jupyter notebook, you can install the Jupyter kernel with

You can generate a docker image with
```
docker build -t phenx:latest .
```
and then run it with
python3.12 -m ipykernel install --user --name phenex --display-name "PhenEx"
```
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`.

That's it! Proceed to the [tutorials](tutorials.md).

## Pip installation

Coming soon!

## Check installation

Check that the installation has succeeded:

# 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
python3.12 -c "import phenex;print(phenex.__version__)"
```
from the root directory of the project.

This will display the installed version of PhenEx.
9 changes: 6 additions & 3 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# My Documentation
# PhenEx Tutorials

Here is a Jupyter Notebook:
Click on the link below to see the corresponding notebook!

![Tutorial](CodelistPhenotype_Tutorial.ipynb)
- [Codelist Phenotype](tutorials/phenotypes/CodelistPhenotype_Tutorial.ipynb)
- [Measurement Phenotype](tutorials/phenotypes/MeasurementPhenotype_Tutorial.ipynb)
- [Arithmetic Phenotype](tutorials/phenotypes/ArithmeticPhenotype_Tutorial.ipynb)
- [Logic Phenotype](tutorials/phenotypes/LogicPhenotype_Tutorial.ipynb)

0 comments on commit 8016d9e

Please sign in to comment.