Metadata-Version: 2.4
Name: simple_module_datasets
Version: 0.0.3
Summary: Geospatial + tabular dataset upload, parsing (shapely) and slugging for simple_module apps
Project-URL: Homepage, https://github.com/antosubash/simple_module_python
Project-URL: Repository, https://github.com/antosubash/simple_module_python
Project-URL: Issues, https://github.com/antosubash/simple_module_python/issues
Project-URL: Changelog, https://github.com/antosubash/simple_module_python/blob/main/CHANGELOG.md
Author-email: Anto Subash <antosubash@live.com>
License-Expression: MIT
License-File: LICENSE
Keywords: datasets,geospatial,gis,shapely,simple-module
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: celery>=5.4
Requires-Dist: python-slugify>=8.0
Requires-Dist: shapely>=2.0
Requires-Dist: simple-module-background-tasks==0.0.3
Requires-Dist: simple-module-core==0.0.3
Requires-Dist: simple-module-db==0.0.3
Requires-Dist: simple-module-file-storage==0.0.3
Requires-Dist: simple-module-hosting==0.0.3
Description-Content-Type: text/markdown

# simple_module_datasets

Geospatial + tabular dataset upload module for [simple_module](https://github.com/antosubash/simple_module_python) apps. Users upload CSV/GeoJSON/Shapefile; the module parses, slugs a canonical name, and stores geometry using `shapely`.

## Install

```bash
pip install simple_module_datasets
```

Also needs `simple_module_file_storage` + `simple_module_background_tasks` (declared as deps).

## What it provides

- `POST /api/datasets` — multipart upload; the file is staged via `simple_module_file_storage`, then a Celery job parses it in the background.
- `Dataset` SQLModel record with `name`, `slug` (via `python-slugify`), `geometry_type`, `row_count`, `bbox`.
- Shapely-backed parsers for GeoJSON, CSV with lat/lon columns, and zipped Shapefiles.
- Admin UI for browsing + deleting datasets.

## Usage

Upload from a form:

```bash
curl -X POST -F "file=@cities.geojson" http://localhost:8000/api/datasets
```

Query parsed datasets:

```python
from datasets.service import DatasetService   # type: ignore[import-not-found]

async def list_by_bbox(svc: DatasetService = Depends(DatasetService), ...):
    return await svc.intersects(bbox=(-74.1, 40.6, -73.8, 40.9))
```

## Depends on

- `simple_module_core`, `simple_module_db`, `simple_module_hosting`
- `simple_module_file_storage`, `simple_module_background_tasks`
- `shapely>=2.0`, `python-slugify>=8.0`, `celery>=5.4`

## License

MIT — see [LICENSE](https://github.com/antosubash/simple_module_python/blob/main/LICENSE).
