Metadata-Version: 2.4
Name: hestia_earth_utils
Version: 0.16.2
Summary: HESTIA's utils library
Home-page: https://gitlab.com/hestia-earth/hestia-utils
Author: HESTIA Team
Author-email: guillaumeroyer.mail@gmail.com
License: MIT
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: hestia-earth-schema>=35.0.1
Requires-Dist: requests>=2.24.0
Requires-Dist: urllib3~=1.26.0
Requires-Dist: python-dateutil>=2.8.1
Requires-Dist: numpy>=2
Requires-Dist: flatten_json
Provides-Extra: pivot-csv
Requires-Dist: pandas>=2; extra == "pivot-csv"
Provides-Extra: table
Requires-Dist: pandas>=2; extra == "table"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# HESTIA Utils

## Install

1. Install the module:
```bash
pip install hestia_earth.utils
```
2. Add this to your environment variables:
```
API_URL=https://api.hestia.earth
WEB_URL=https://www.hestia.earth
```

## Usage

1. To download a file from the HESTIA API:
```python
from hestia_earth.schema import SchemaType
from hestia_earth.utils.api import download_hestia

cycle = download_hestia('cycleId', SchemaType.CYCLE)
sandContent = download_hestia('sandContent', SchemaType.TERM)
```

2. To search for a specific Node on HESTIA:
```python
from hestia_earth.schema import SchemaType
from hestia_earth.utils.api import find_node_exact

source = find_node_exact(SchemaType.SOURCE, {'bibliography.title': 'My Bibliography'})
```

3. To get a lookup table from local file system:
```python
from hestia_earth.schema import SchemaType
from hestia_earth.utils.lookup import load_lookup

df = load_lookup('path/to/my/lookup.csv')
```

4. To get a lookup table from HESTIA:
```python
from hestia_earth.schema import SchemaType
from hestia_earth.utils.lookup import download_lookup

df = download_lookup('crop.csv')
```
