Quickstart

To get started clone the DEA repository and setup a conda environment for its dependencies

$ git clone git@github.com:JRC-COMBINE/DEA.git
$ cd DEA
$ conda create --name dea --file requirements.txt
$ conda activate dea # do not forget to work in the dea environment from now on!

You can use various sources for your data, for example the MIMIC-III dataset. For simplicities sake we provide testdata which can be used to get started quickly. Place the data in DEA/tests/data and continue following this guide.

First of all we need to convert the original data format into DEA encounters. The cohort class conveniently can be used for that. For our testdata they are already organized as cohort/encounter/data.csv, so we can just pass the root folder to the cohorts load method.

from dea.cohort import Cohort
coh = Cohort.from_path("../tests/data")
coh.save("data/test")

The included quickstart.py file includes exactly this code and can be run instead.

$ python quickstart.py

Alternatively you can create your Encounters manually and add them to the cohort.

from dea.cohort import Cohort
coh = Cohort()
for my_data in my_data_source:
    e = Encounter(my_data.id, extract_dynamic_data(my_data), static_data_mapping[my_data.id])
    coh.encounters.append(e)
coh.static = exotic_custom_format_to_df(static_data_mapping)
coh.save("data/test")

This will create a new directory in DEA/dea/data. Here the DEA stores all intermediate results. With the data prepared we can now launch the DEA and start interacting with our cohort.

$ conda activate dea  # activate conda environment, if you did not already do so before
$ cd dea/
$ flask run --debug  # this ensures changes to the code are reflected immediately

Now we can open the DEA in our browser at http://localhost:5000/ and start exploring our cohort.