A CRUD API for telemetry devices using FastAPI, with a visualization screen for the data:

- Asynchronous database calls using SQLAlchemy and aiosqlite
- Pydantic models for data validation
- Logging and error handling
- Unit testing with pytest and pytest-asyncio
- Continuous Integration/Continuous Deployment (CI/CD) with GitHub Actions to Google Cloud Run
- Dependency management with Poetry
- Python 3.8+
- Poetry
git clone https://github.com/gustavoflw/telemetry-api.git
cd telemetry_apipoetry lock
poetry installpython src/init_db.pyuvicorn src.main:app --reloadAfter this, the data can be visualized in http://127.0.0.1:8000/.
Option A: run the Python script
python src/populate_db.pyOption B: use API endpoints
curl -X POST "http://localhost:8000/telemetry/" \
-H "Content-Type: application/json" \
-d '{"name": "Temperature Sensor A", "location": "Building 1", "data": 23.5}'
curl -X POST "http://localhost:8000/telemetry/" \
-H "Content-Type: application/json" \
-d '{"name": "Pressure Sensor B", "location": "Building 2", "data": 1.2}'
curl -X POST "http://localhost:8000/telemetry/" \
-H "Content-Type: application/json" \
-d '{"name": "Humidity Sensor C", "location": "Building 3", "data": 45.0}'FastAPI automatically generates interactive API documentation using OpenAPI standards. You can access the documentation by running the application and navigating to the following URLs:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc

This project uses pytest as the testing framework to ensure the correctness and reliability of the code. Pytest is a simple yet powerful testing tool that makes it easy to write, maintain, and execute test cases.
To run:
pytestThis project was deployed to Google Cloud Run as a service. See the CI file.