🌍 Structural Monitoring Platform API

RESTful API for managing structural sensor systems and accessing sensor data

✨ Features

System Management

Organize sensors into hierarchical systems and gateways

FTP Polling

Automatic polling and download of new sensor data files from flat folder structure

Data Storage

Local file storage mirroring FTP sensor folder structure

JSON API

Convert CSV files to JSON format via REST endpoints

📡 System & Gateway Endpoints

GET /api/systems
Get all structural monitoring systems
GET /api/systems/{system_id}
Get details of a specific system
GET /api/systems/{system_id}/gateways
Get all gateways for a system
GET /api/systems/{system_id}/gateways/{gateway_id}
Get details of a specific gateway

📊 Sensor Endpoints

GET /api/systems/{system_id}/sensors
Get all sensors for a system
GET /api/systems/{system_id}/gateways/{gateway_id}/sensors/{sensor_id}
Get details of a specific sensor
GET /api/sensors/{sensor_id}/files
Get all data files for a sensor
GET /api/sensors/{sensor_id}/latest
Get the latest data file and content for a sensor

📁 Data File Endpoints

GET /api/files
Get list of all stored files
Query params: ?extension=.DAT to filter by extension
GET /api/files/content?path={relative_path}
Get CSV file content converted to JSON format
Example: ?path=SN-001/seismic_data.DAT
GET /api/files/search?q={query}
Search files by name or path
Example: ?q=micrdata
GET /api/storage/stats
Get storage statistics (file count, size, types)
GET /api/storage/structure
Get the list of sensor folders and file counts from local storage

🔍 System Status

GET /api/health
Health check endpoint
GET /status
System status, FTP polling status, and statistics

🚀 Quick Start

Try these example requests:

# Get all systems
curl http://localhost:5000/api/systems

# Get file content as JSON
curl "http://localhost:5000/api/files/content?path=SN-001/data.DAT"

# Get latest sensor data
curl http://localhost:5000/api/sensors/SN-1-01/latest

# Check system status
curl http://localhost:5000/status

📝 Configuration

Configure the backend using the .env file: