Giter Club home page Giter Club logo

seizure_detection_pipeline's Introduction

Seizure Detection pipeline

This project aims to use machine learning algorithms to detect seizure from ECG data, in a MLOps environment. Here is an overview of the automated ML pipeline :

Automated pipeline

This pipeline runs inside a dockerised environment, represented below :

Architecture

Prerequisites

Dependencies

The pipeline requires these packages to run :

  • Python >= 3.7
  • pandas == 1.1.5
  • numpy == 1.19.5
  • pyEDFlib == 0.1.22
  • click == 8.0.1
  • py-ecg-detectors == 1.0.2
  • wfdb == 3.4.0
  • biosppy == 0.7.3
  • hrv-analysis == 1.0.4
  • ecg-qc == 1.0b5
  • great-expectations == 0.13.25
  • airflow-provider-great-expectations == 0.0.7
  • psycopg2-binary == 2.8.6

You can install them in a virtual environment on your machine via the command :

    $ pip install -r requirements.txt

Environment

You need to have docker and docker-compose installed on your machine to set the environment up.

Getting started

Setting up environment and launch docker-compose

After cloning this repository, replace the value of the environment variable DATA_PATH in the env.sh file with the absolute path of the data you are working with.

You can now run these commands :

    $ source setup_env.sh
    $ docker-compose build
    $ docker-compose up airflow-init
    $ docker-compose up -d

Warning: Here are the default ports used by the different services. If one of them is already in use on your machine, change the value of the corresponding environment variables in the env.sh file before running the commands above.

Service Default port
Postgresql 5432
InfluxDB 8086
Airflow 8080
Grafana 3000
MLFlow 5000
Great expectations (via NGINX) 8082
Flower 5555
Redis 6379

UI

Once the services are up, you can interact with their UI :

When required, usernames and passwords are admin.

Executing script separately

First export the python path to access the scripts :

    $ export PYTHONPATH=$(pwd)

You can now execute each Python script separately by running :

    $ python3 <path-to-Python-script> [OPTIONS]

The required options are shown by running the --help option.

Setting down the environment

You can stop all services by running :

    $ docker-compose down 

If you add the -v option, all services' persistent data will be erased.

License

This project is licensed under the GNU GENERAL PUBLIC License.

seizure_detection_pipeline's People

Contributors

alexisgcomte avatar clecoued avatar infini11 avatar ncleyetmarrel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

seizure_detection_pipeline's Issues

Docker deployment fails to run: No module named 'ecg_qc'

I have followed the steps described in the repo's readme to setup the Aura docker images.

After issuing the docker-compose up command, images are being built and after some time setup is ready. But when I try to access:

  • port 80 it redirects to https, no connection.
  • port 8082 I get a 403 forbidden
  • port 5000 (mlflow) the list of experiments/models is empty.
  • port 8080 (airflow) I get a "DAG import error" saying "ModuleNotFoundError: No module named 'ecg_qc'"

Full error report in the 8080 UI is

Broken DAG: [/opt/airflow/dags/seizure_detection_pipeline.py] Traceback (most recent call last):
  File "/opt/airflow/dags/seizure_detection_pipeline.py", line 7, in <module>
    from src.usecase.apply_ecg_qc import apply_ecg_qc
  File "/opt/airflow/src/usecase/apply_ecg_qc.py", line 5, in <module>
    import ecg_qc
ModuleNotFoundError: No module named 'ecg_qc'

Docker log is attached below:
aura_setup.log

fetch_database doesn't work with TUH format

There are some places where the script fetch_database.py is hardcoded to use the teppe format instead of tuh. We can fix this locally for now by adding the following to the script:

TEPPE_PATIENT_PATTERN = TUH_PATIENT_PATTERN
DB = 'tuh'

but that is just a temporary fix. It seems like the script was intended to support both formats, so there should be a better way of fixing this problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.