Scripts to download and parse data from various red lists into standardized database and serve it via REST, e.g.
https://iredlist.haagfank.de/v1/redlist/status?name=Vanellus vanellus
- Python 99.2%
- Dockerfile 0.8%
| redlists | ||
| .gitignore | ||
| build.py | ||
| build_requirements.txt | ||
| database.py | ||
| fetch.py | ||
| fetch_requirements.txt | ||
| LICENSE | ||
| README.md | ||
| serve.Dockerfile | ||
| serve.py | ||
| serve_requirements.txt | ||
| utils.py | ||
The project consists of three scripts:
fetch.pyto download redlist databuild.pyto import the downloaded data into a singleredlist.sqlitedatabaseserve.pyto serve the database as a REST api
The scripts are largely independent and only require installation of the corresponding *_requirements.txt via pip install -r *_requirements.txt.
The only additional dependency is the gnparser binary, which must be in the root directory or in $PATH.
How certain redlists are downloaded and parsed is defined in the data directory under root.
Every redlist.py filed contained recursively in it, defines one redlist.
Three functions must be implemented:
fetch()downloading (and overwriting) the original ZIP/XLSX/CSV/PDF/... red list data.info()returning basic information about the redlist as a dict: TBCdatasets(gn=None)a generator yielding a tuple(info, df)whereinfois a dict anddfa pandas dataframe, where eachdfcontains the normalized data from one file andinfobasic associated information: The optional argument gn will be a GNParser instance. TBC