Skip to content

Commit

Permalink
add readme, change default dateend
Browse files Browse the repository at this point in the history
  • Loading branch information
p-phung committed Nov 22, 2024
1 parent f01dd50 commit 7fd100c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# Near real-time rainfall pipeline

TBD
Near real-time rainfall monitoring. Part of the project RIPOSTE for Cameroon Red Cross Society.

## Description
The pipeline roughly consists of three steps:

- Extract daily data on rainfall measurement of the past days (e.g. last 14 days) from [NOAA's GPM](https://gpm.nasa.gov/data/directory)
- Transform the data into pre-defined areas (health districts) and calculate average rainfall of the past days. Then determine which area has its average rainfall higher than pre-defined thresholds.
- Send this data as alert to the EspoCRM for the NS.

## Basic Usage
To run the pipeline locally

1. Fill in the secrets in .env.example and rename the file to .env; in this way, they will be loaded as environment variables
2. Install requirements
```
pip install poetry
poetry install --no-interaction
```
3. Run the pipeline : `python nrt_rainfall_pipeline.py --extract --transform --send`
```
Usage: nrt_rainfall_pipeline.py [OPTIONS]
Options:
--country TEXT country ISO3
--extract extract rainfall data
--transform calculate rainfall data into pre-defined
--send send to IBF app
--dateend specify date until which the data should be extracted
--help Show this message and exit.
```
2 changes: 1 addition & 1 deletion nrt_rainfall_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@click.option(
"--dateend",
help="date start in YYYY-mm-dd",
default=(datetime.now(timezone.utc)-timedelta(days=1)).strftime("%Y-%m-%d"),
default=(datetime.now(timezone.utc)-timedelta(days=2)).strftime("%Y-%m-%d"),
)

def run_nrt_rainfall_pipeline(
Expand Down
2 changes: 1 addition & 1 deletion nrt_rainfall_pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run_pipeline(
transform: bool = True,
send: bool = True,
save: bool =True,
dateend: datetime = datetime.now(timezone.utc)-timedelta(days=1),
dateend: datetime = datetime.now(timezone.utc)-timedelta(days=2),
# debug: bool = False
):
"""Run the flood data pipeline"""
Expand Down

0 comments on commit 7fd100c

Please sign in to comment.