Skip to content

nlp-pucrs/ddc-api

Repository files navigation

ddc-api

Build Status

Flask API for DDC Prescription Score

Tutorial

How To use DDC-API

1. Install

First, install the dependencies packages.

git clone https://github.com/nlp-pucrs/ddc-api.git
cd ddc-api
pip3 install -r requirements.txt --user --upgrade

2. Run API

Start DDC API

python3 ./ddcapi.py

3. Test the API

3.1 Request details

POST /ddc-api/score
Content-Type: multipart/form-data;boundary=----XXXX
Host: 127.0.0.1

----XXXX
Content-Disposition: form-data; name="userid"

hospital
----XXXX
Content-Disposition: form-data; name="file"; filename="test.csv.gz"
Content-Type: application/x-gzip

<multipart-file-content>
----XXXX--

3.2 Requesting with curl

curl -X POST -F "userid=1" -F 'file=@data/test.csv.gz' http://localhost:5000/score -o results.csv.gz

3.3 Examples

4. Run Unit Test

python3 -m pytest

5. CSV Format Example

The file must have the same header (columns names) and types:

https://github.com/nlp-pucrs/ddc-api/blob/master/data/test.csv

6. Zappa Deploy

  • Install Zappa
  • Configure zappa_settings.json and run the code below
  • Make sure you have a valid AWS account, your AWS credentials file is properly installed.
virtualenv env
source env/bin/activate
pip install -r requirements-zappa.txt
zappa deploy dev

PUCRS A.I. in HealthCare

This project belongs to GIAS at PUCRS, Brazil