Skip to content

Giswater/giswater_api_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Giswater FastAPI Service

A lightweight, modular FastAPI application with Swagger UI, Docker support, and Gunicorn + Uvicorn for production.

📂 Project Structure

giswater_api_server/
│── app/
│   │── routers/        # API endpoints (organized by feature)
│   │── services/       # Business logic and processing
│   │── models/         # Pydantic models for validation
│   │── dependencies.py # Shared dependencies
│   │── config.py       # Configuration settings
│   │── main.py         # Entry point of the FastAPI app
│
│── tests/              # Unit and integration tests
│── .gitignore          # Git ignore rules
│── requirements.txt    # Python dependencies
│── Dockerfile          # Dockerization setup
│── gunicorn.conf.py    # Gunicorn configuration
│── README.md           # Project documentation

🚀 Quick Start

1️⃣ Clone the Repository

git clone https://github.com/Giswater/giswater_api_server.git
cd giswater_api_server

2️⃣ Set Up Virtual Environment

python3 -m venv venv
source venv/bin/activate  # for Windows PowerShell: .\venv\Scripts\activate
pip install -r requirements.txt

3️⃣ Run Locally

uvicorn app.main:app --reload

📌 API Docs available at: http://127.0.0.1:8000/docs


🐳 Running with Docker

Build the Image

docker build -t giswater_api_server .

Run the Container

docker run -d -p 8000:8000 giswater_api_server

🏗️ Deployment (Gunicorn + Uvicorn)

For production, run:

gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 app.main:app

🛠️ API Endpoints

Endpoint Method Description
/ GET Root endpoint
/features/getfeaturechanges GET Fetch feature changes for GMAO
/mincut/setmincut POST Set mincut parameters
/waterbalance/getdmahydrometers GET Retrieve DMA hydrometers data
/digitaltwin/getepafile GET Get EPA file data

✅ Testing

Run tests using pytest:

pytest

📌 License

This project is free software, licensed under the GNU General Public License (GPL) version 3 or later. Refer to the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages