Metadata-Version: 2.1
Name: disruptsc-dataprep
Version: 1.0.0
Summary: Tools to help prepare data for the DisruptSC model.
Home-page: https://github.com/ccolon/disruptsc-dataprep
Author: Celian Colon
Author-email: celian.colon.2007@polytechnique.org
License: CC BY-NC-ND 4.0
Classifier: Programming Language :: Python :: 3
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: gadm==0.0.5

# What is it?

This repository contains tools to facilitate the data preparation for the DisruptSC model https://github.com/ccolon/disruptsc. 
The data preparation is done in Python.

# Installation

To install the package, run the following command:

```pip install disruptsc-dataprep```

It is advised to install the package in a virtual environment, especially if you have other packages that 
might conflict with the dependencies of this package (e.g, geopandas)

# Usage

Submodule admin_boundaries contains functions to download and prepare administrative boundaries data.

There are two functions.

```search_country_by_keyword(keyword: str)```

- This is a wrapper of the ``pycountry.countries.search_fuzzy`` function.
- It returns a list of countries that match the keyword.

```get_country_admin_boundaries(country_name: str, ad_level: int)```
- This is a wrapper of the ``gadm.GADMDownloader`` class.
- It returns a geopandas.DataFrame of the administrative boundaries of the country specified 
by the country_name at the administrative level specified.
- The search_country_by_keyword function can be used to check the country name beforehand
- It can then be saved to a file using the ``to_file`` method of the geopandas.DataFrame, 
- ex. ``gdf.to_file('path/to/file.geojson', driver="GeoJSON", index=False)``.

