気象データ基盤を実装

- apps/weather 新規作成(WeatherRecord モデル、5種APIエンドポイント)
- GET /api/weather/records/ 日次データ一覧
- GET /api/weather/summary/ 月別・年間集計
- GET /api/weather/gdd/ 有効積算温度(GDD)計算
- GET /api/weather/similarity/ 類似年分析(開花・収穫予測の基礎)
- POST /api/weather/sync/ Windmill向け日次更新(APIキー認証)
- management command: fetch_weather(初回一括・差分取得)
- Crop.base_temp フィールド追加(GDD基準温度、default=0.0℃)
- docker-compose.yml: MAIL_API_KEY 環境変数を追加(ローカルテスト修正)
- requirements.txt: requests>=2.31 追加

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Akira
2026-02-28 13:23:09 +09:00
parent b386ee4380
commit 2c515cca6f
19 changed files with 671 additions and 4 deletions

View File

@@ -0,0 +1,33 @@
# Generated by Django 5.0 on 2026-02-28 04:16
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='WeatherRecord',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField(unique=True, verbose_name='日付')),
('temp_mean', models.FloatField(blank=True, null=True, verbose_name='平均気温(℃)')),
('temp_max', models.FloatField(blank=True, null=True, verbose_name='最高気温(℃)')),
('temp_min', models.FloatField(blank=True, null=True, verbose_name='最低気温(℃)')),
('sunshine_h', models.FloatField(blank=True, null=True, verbose_name='日照時間(h)')),
('precip_mm', models.FloatField(blank=True, null=True, verbose_name='降水量(mm)')),
('wind_max', models.FloatField(blank=True, null=True, verbose_name='最大風速(m/s)')),
('pressure_min', models.FloatField(blank=True, null=True, verbose_name='最低気圧(hPa)')),
],
options={
'verbose_name': '気象記録',
'verbose_name_plural': '気象記録',
'ordering': ['date'],
},
),
]