Skip to content

Nek0mush1/weather-wind-ai-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Wind AI Backend

气象风力预测 AI 后端服务,提供气象数据录入、查询及基于 ML 的风场预测。

技术栈

  • Web 框架: FastAPI
  • 数据库: SQLite (可替换为 PostgreSQL)
  • ML: scikit-learn + RandomForest
  • 缓存: Redis

快速开始

# 安装依赖
pip install -r requirements.txt

# 初始化数据库
python -c "from app.db.session import engine, Base; from app.models import wind_data; Base.metadata.create_all(bind=engine)"

# 启动服务
uvicorn app.main:app --reload --port 8000

# 访问 Swagger 文档
# http://localhost:8000/docs

Docker 部署

docker-compose up -d

项目结构

weather-wind-ai-backend/
├── app/                 # FastAPI 应用
│   ├── main.py          # 应用入口
│   ├── api/             # API 路由
│   ├── core/            # 配置
│   ├── services/        # 业务服务
│   ├── schemas/         # Pydantic 模型
│   ├── models/          # SQLAlchemy 模型
│   ├── db/              # 数据库连接
│   └── utils/           # 工具函数
├── data/                # 数据目录
│   ├── raw/             # 原始数据
│   └── processed/       # 处理后数据
├── ml/                  # 机器学习
│   ├── train.py         # 训练脚本
│   ├── predict.py       # 推理模块
│   └── saved_models/    # 保存的模型
├── tests/               # 测试
├── Dockerfile
├── docker-compose.yml
└── requirements.txt

API 端点

方法 路径 说明
GET / 根路径
GET /health 健康检查
POST /api/v1/wind/data 录入气象数据
GET /api/v1/wind/data 查询数据列表
GET /api/v1/wind/data/{id} 获取单条数据
POST /api/v1/wind/predict 风场预测

训练模型

python ml/train.py --data data/raw/training_data.csv --output ml/saved_models/wind_model.pkl

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors