Skip to content

Commit

Permalink
Merge pull request #13 from luabida/binary-build
Browse files Browse the repository at this point in the history
refactor(episcanner): move binary build branch to updated main
  • Loading branch information
luabida authored Dec 22, 2023
2 parents 380272a + 1280347 commit b25251c
Show file tree
Hide file tree
Showing 22 changed files with 8,231 additions and 2,016 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: EpiScanner Build

on: [pull_request]

env:
HOST_GID: 1000
HOST_UID: 1000
ENV: prod

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,6 +47,6 @@ jobs:
pre-commit install
pre-commit run --all-files
# - name: Pytest
# run: |
# test-fetch-data
- name: Pytest
run: |
make tests
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
with:
node-version: 18

- name: Install dependencies
run: poetry install

- name: Test release
if: ${{ github.event_name != 'workflow_dispatch' }}
env:
Expand Down
6 changes: 6 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
"prepareCmd": "poetry build"
}
],
[
"@semantic-release/github",
{
"assets": ["dist/*.whl", "dist/*.tar.gz"]
}
],
[
"@semantic-release/git",
{
Expand Down
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
ENV:=$(ENV)


.PHONY: create-dotenv
create-dotenv:
.PHONY: dotenv
dotenv:
export HOST_UID=$$(id -u) && \
export HOST_GID=$$(id -g) && \
envsubst < env.tpl > .env

# Export data for all states and diseases to Parquet files in the default output directory
.PHONY:fetch-data
fetch-data:
python epi_scanner/downloader/export_data.py -s all -d dengue chikungunya

# Run pytest for all tests in epi_scanner/tests inside the container
.PHONY:test-fetch-data
test-fetch-data:
pytest -vv epi_scanner/tests
.PHONY:tests
tests:
pytest -vv src/tests

.PHONY: clean
clean: ## clean all artifacts
Expand Down
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Episcanner Downloader

Episcanner Downloader is a data downloader for the Episcanner application. It retrieves data related to diseases like dengue and chikungunya and saves it in a specified directory.
Episcanner Downloader is a data downloader for the Episcanner application. It retrieves data related to diseases like dengue, zika and chikungunya and saves it in a specified directory with the formats csv, parquet or duckdb.

## Features

Expand All @@ -27,9 +27,9 @@ To install Episcanner Downloader, follow these steps:
```shell
conda env create -f conda/env-base.yaml
```
2. conda activate episcanner
2. conda activate episcanner-downloader
```shell
conda activate episcanner
conda activate episcanner-downloader
```
3. Install the dependencies using Poetry:
```shell
Expand All @@ -52,30 +52,24 @@ To install Episcanner Downloader, follow these steps:
Before running Episcanner Downloader, make sure to set the required environment variables for connecting to the PSQL database. You can use the provided Makefile to create a .env file with the exported variables:
1. Set the required environment variables for connecting to the PSQL database:
```shell
export PSQL_USER=<your_psql_user>
export PSQL_PASSWORD=<your_psql_password>
export PSQL_HOST=<your_psql_host>
export PSQL_PORT=<your_psql_port>
export PSQL_USER=<your_psql_database>
export EPISCANNER_PSQL_URI="postgresql://user:password@host:port/database"
```

2. Create a .env file in the project root directory with the exported variables.
```shell
make create-dotenv
make dotenv
```
## Usage
To use Episcanner Downloader, follow these steps:

1. Activate the project's virtual environment:
1. Execute the binary (examples for Linux):
```shell
source /path/to/episcanner-downloader/venv/bin/activate
cd dist/
./episcanner -h
./episcanner -y 2023 -s RJ -d dengue -o /tmp -f duckdb
./episcanner -y 2021 2022 2023 --all -d zika -f csv parquet --verbose
```
2. Run the Episcanner Downloader:
```shell
mkdir data
python epi_scanner/downloader/export_data.py -s <source> -d <diseases> -o data
```
*Replace <source> with the desired source (e.g., 'MG', or 'all' to download all states) and <diseases> with the specific diseases you want to download (e.g., 'dengue chikungunya'). Specify the <output_directory> where the data should be saved.*
*Replace <source> with the desired source (e.g., 'MG', or '--all' to download all states) and <diseases> with the specific diseases you want to download (e.g., 'dengue chikungunya'). Specify the <output_directory> where the data should be saved.*

## License
Episcanner Downloader is licensed under the [MIT License](https://github.com/AlertaDengue/episcanner-downloader/blob/main/LICENSE). See the LICENSE file for more details.
11 changes: 1 addition & 10 deletions env.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
# Host
HOST_GID=$HOST_GID
HOST_UID=$HOST_UID

# Used to fetch data from the database
PSQL_DB=$PSQL_DB
PSQL_HOST=$PSQL_HOST
PSQL_PASSWORD=$PSQL_PASSWORD
PSQL_PORT=$PSQL_PORT
PSQL_USER=$PSQL_USER
EPISCANNER_PSQL_URI=$EPISCANNER_PSQL_URI
Binary file removed epi_scanner/data/muni_br.gpkg
Binary file not shown.
Empty file removed epi_scanner/downloader/__init__.py
Empty file.
170 changes: 0 additions & 170 deletions epi_scanner/downloader/export_data.py

This file was deleted.

Loading

0 comments on commit b25251c

Please sign in to comment.