# compute_api **Repository Path**: dufzh/compute_api ## Basic Information - **Project Name**: compute_api - **Description**: numpy接口 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-16 - **Last Updated**: 2026-03-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Compute API A computation service API based on FastAPI for performing various algorithmic processing on sensor data. ## Project Overview Compute API is a lightweight computation service providing online processing capabilities for sensor data. It supports multiple algorithms, including commonly used data processing methods such as moving average and outlier removal. ## Features - **RESTful API Endpoint**: Provides the `/api/compute` endpoint for data computation - **Algorithm Support**: - Moving Average - Remove Outliers - **Dynamic Reloading**: Supports dynamic reloading of algorithm modules via the `/api/system/reload` endpoint - **SQLite Storage**: Built-in SQLite database for data persistence ## Technology Stack - Python 3.x - FastAPI - A modern, high-performance web framework - Pydantic - Data validation - SQLite - Lightweight database ## Quick Start ### Install Dependencies ```bash pip install -r requirements.txt ``` ### Start the Service ```bash python main.py ``` The service runs by default at `http://localhost:8000` ### API Documentation After starting the service, access the following URLs to view the interactive API documentation: - Swagger UI: `http://localhost:8000/docs` - ReDoc: `http://localhost:8000/redoc` ## API Usage Examples ### Compute Endpoint **Request Example:** ```bash curl -X POST "http://localhost:8000/api/compute" \ -H "Content-Type: application/json" \ -d '{ "algorithm": "moving_average", "data": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "params": {"window": 3} }' ``` ### Reload Algorithms ```bash curl -X POST "http://localhost:8000/api/system/reload" ``` ## Project Structure ``` . ├── main.py # Main program, containing API endpoint definitions ├── algorithms.py # Algorithm implementations ├── requirements.txt # Python dependencies ├── sensor_data.csv # Sample sensor data ├── sim_data_linspace.py # Simulated data generator ├── sqlite.db # SQLite database ├── env.txt # Environment configuration └── .gitignore # Git ignore configuration ``` ## License This project is for learning and communication purposes only.