Skip to content

About

FastAPI REST API practice with SQLite and SQLAlchemy

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Industrial Asset Management API

A FastAPI-based REST API for managing industrial assets, operational measurements, asset health, status, and maintenance records.

Features

  • Asset CRUD operations
  • Operational measurement storage
  • Measurement history
  • Asset health assessment
  • Asset status monitoring
  • Maintenance records
  • SQLite database with SQLAlchemy
  • Python API client
  • Swagger API documentation

API Endpoints

Assets

POST   /assets
GET    /assets
GET    /assets/{asset_id}
PUT    /assets/{asset_id}
DELETE /assets/{asset_id}

Measurements

POST /measurements
GET  /assets/{asset_id}/measurements

Health & Status

GET /assets/{asset_id}/health
GET /assets/{asset_id}/status

Maintenance

POST /maintenance
GET  /assets/{asset_id}/maintenance

Example Asset

{
  "name": "Transformer-01",
  "asset_type": "Distribution Transformer",
  "rated_power": 400,
  "voltage": "11kV/433V",
  "location": "MGIT",
  "status": "Operational",
  "installation_year": 2005
}

Technology Stack

  • Python
  • FastAPI
  • Pydantic
  • SQLAlchemy
  • SQLite
  • Requests
  • Uvicorn
  • REST / JSON

Project Structure

fastapi-learning/
├── main.py
├── database.py
├── client.py
├── README.md
└── .gitignore

Setup

pip install fastapi uvicorn sqlalchemy requests

Run the API:

uvicorn main:app --reload

API:

http://127.0.0.1:8000

Swagger documentation:

http://127.0.0.1:8000/docs

Database Relationships

Asset
 ├── Measurements
 └── Maintenance Records

One asset can have multiple measurements and maintenance records.

Learning Outcomes

  • REST API development
  • FastAPI
  • Pydantic validation
  • SQLAlchemy ORM
  • SQLite databases
  • CRUD operations
  • Database relationships
  • Industrial asset modelling
  • Operational data handling
  • Basic asset health assessment
  • Python API integration

Future Development

  • PostgreSQL
  • Alembic migrations
  • Authentication
  • Real-time measurement ingestion
  • Sensor integration
  • Predictive maintenance
  • Data visualization
  • Digital twin integration

Disclaimer

The health assessment is a simplified learning example and is not intended for real-world transformer diagnosis or safety-critical decisions.

Author

Shoumik Gunda

Electrical and Electronics Engineering
MGIT, Hyderabad

About

FastAPI REST API practice with SQLite and SQLAlchemy

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages