Content
# Health Data API Service
This is a lightweight health data API service based on Flask, used for managing user information and health data.
## Project Structure
```
project/
│
├── app.py # Main application file, contains API routes
├── models.py # Data models, handles data read and write
├── config.py # Configuration file
├── data/ # Data directory
│ ├── user.json # User data
│ └── health.json # Health data
└── requirements.txt # Project dependencies
```
## Install Dependencies
```bash
pip install -r requirements.txt
```
## Run the Service
```bash
python app.py
```
The service will start at http://127.0.0.1:5000
## API Endpoints
### Initialize Sample Data
```
GET /api/init
```
Generates and saves sample user data and health data. This API needs to be called when running the application for the first time.
### User Information
```
GET /api/user
```
Returns the user's basic information (name, age, contact information, etc.).
### Update User Information
```
PUT /api/user
Content-Type: application/json
{
"name": "李四",
"age": 50,
"contact": "13900139000"
}
```
Updates user information via JSON, allowing any field to be updated.
### Health Data Query
```
GET /api/health?start_date=2023-01-01&end_date=2023-01-31&metric=blood_pressure
```
Queries health data based on the date range and metric.
Query parameters:
- `start_date`: Start date (YYYY-MM-DD), optional
- `end_date`: End date (YYYY-MM-DD), optional
- `metric`: Type of health metric, such as 'blood_pressure', optional
If no parameters are provided, all health data will be returned.
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.