init
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# 2026-08-12 Project Memory
|
||||
|
||||
> Auto-generated by AI Agent. Entries are append-only within a day.
|
||||
|
||||
---
|
||||
|
||||
## [09:48] fields_history CSV file export
|
||||
|
||||
**Type**: solution
|
||||
**Tags**: `refactor`, `export`
|
||||
|
||||
В конце `fields_history.js` вместо `console.table` / CSV в консоль — запись в `fields_history_${SEASON_YEAR}.csv` (UTF-8 с BOM для Excel). Паттерн как в `get_weather.js` (`fs` + `path`).
|
||||
|
||||
**Status**: ✅ verified
|
||||
|
||||
---
|
||||
|
||||
## [12:15] fields_history_pg.js Cropwise → Postgres sync
|
||||
|
||||
**Type**: solution
|
||||
**Tags**: `architecture`, `dependency`, `performance`
|
||||
|
||||
Добавлен `fields_history_pg.js`: создаёт БД `ak_fields`, таблицы `crops` / `group_folders` / `field_groups` / `fields`, синкает API. Фильтр ветки `GROUP_FOLDER_ROOT_ID=27`. В `fields`: `zone_hierarchy` + `history_items` JSONB (без фильтра по годам). `.env` + `pg`/`dotenv`. Параллелизм `CONCURRENCY=20` + resume по уже залитым `history_items`.
|
||||
|
||||
**Status**: ✅ verified
|
||||
@@ -0,0 +1,14 @@
|
||||
# 2026-11-09 Project Memory
|
||||
|
||||
> Auto-generated by AI Agent. Entries are append-only within a day.
|
||||
|
||||
---
|
||||
|
||||
## [19:09] Dashboard урожайности ak_fields + clusters
|
||||
|
||||
**Type**: decision
|
||||
**Tags**: `architecture`, `analytics`, `dashboard`
|
||||
|
||||
Интерактивный дашборд в `dashboard/`: JSON из Postgres (`build-data.js`), кластеры копируются из `fertilizer_project_test.fields_clustered_all` → `ak_fields.fields_clustered_all` (`sync-clusters.js`, join по `field_id`). UI: `index.html` + Chart.js, данные в `data/dashboard.json` и `dashboard-data.js`. npm: `dashboard:clusters`, `dashboard:data`, `dashboard:build`, `dashboard`. Разрезы: дивизионы/предприятия/ПО, матрица урожайность×стабильность, тренды культур ц/га 2018–2025, пшеница-флагман, звёзды/риск.
|
||||
|
||||
**Status**: ✅ verified
|
||||
@@ -0,0 +1,36 @@
|
||||
# 2026-11-10 Project Memory
|
||||
|
||||
> Auto-generated by AI Agent. Entries are append-only within a day.
|
||||
|
||||
---
|
||||
|
||||
## [12:30] Страница анализа дат сева/уборки + навигация
|
||||
|
||||
**Type**: solution
|
||||
**Tags**: `analytics`, `dashboard`
|
||||
|
||||
Добавлены `dashboard/dates.html` (heatmap неделя сева × неделя уборки → медиана ц/га, мультифильтры дивизион/ПО/год/культура/гибрид, таблица выборки), данные `npm run dashboard:dates` → `data/dates-data.js`. Заглушки `predecessor.html`, `fertilizers.html` с описанием будущего дашборда. Общая `site-nav` на всех страницах.
|
||||
|
||||
**Status**: ✅ verified
|
||||
|
||||
---
|
||||
|
||||
## [15:55] Загрузка актов удобрений + страница анализа
|
||||
|
||||
**Type**: solution
|
||||
**Tags**: `analytics`, `dashboard`, `postgres`, `fertilizer`
|
||||
|
||||
CSV `data/fertilizer_field_final_utf.csv` → таблица `fertilizer_field_acts` (39 050 строк) + view `v_fertilizer_field`. Связь с `fields` по `field_name`→`fields.name` (`field_id`): 36 158 linked / 9 387 полей. Скрипт `load_fertilizer_field.js` / `npm run fertilizer:load`. Дашборд: `fertilizers.html` + `fertilizers-app.js`, данные `npm run dashboard:fert`. Агроконтекст: вынос NPK из skill `agriculture_operations.md`, баланс внесено−вынос, dose–response по N, органика.
|
||||
|
||||
**Status**: ✅ verified
|
||||
|
||||
---
|
||||
|
||||
## [16:08] Страница аудита качества данных удобрений
|
||||
|
||||
**Type**: solution
|
||||
**Tags**: `analytics`, `dashboard`, `data-quality`
|
||||
|
||||
Добавлена `fertilizer-quality.html`: флаги выбросов NPK/массы/органики, missing_dv, npk_gt_mass, multi_crop; вердикт пригодности к анализу влияния. Данные: `npm run dashboard:fert-quality`. На текущей выгрузке ~84% строк «готовы к анализу», verdict=`usable`.
|
||||
|
||||
**Status**: ✅ verified
|
||||
@@ -0,0 +1,22 @@
|
||||
# Project Overview
|
||||
|
||||
**Name**: cropwise_weather
|
||||
**Tech Stack**: Node.js, axios, pg, dotenv, Cropwise Operations API (v3), PostgreSQL, Chart.js dashboard
|
||||
**Last Updated**: 2026-11-10
|
||||
|
||||
## Architecture
|
||||
Scripts fetch field/weather data from Cropwise Operations API. CSV reports locally (`get_weather.js`, `fields_history.js`) and Postgres sync (`fields_history_pg.js` → DB `ak_fields`). Fertilizer write-off acts live in `fertilizer_field_acts` (linked to `fields` by name). Analytics dashboard in `dashboard/` reads aggregates from JSON regenerated by `build-data.js` / `build-dates-data.js` / `build-fertilizers-data.js`.
|
||||
|
||||
## Key Decisions
|
||||
- Reports written as UTF-8 CSV files (with BOM for Excel Cyrillic) instead of console dump — 2026-08-12
|
||||
- Field history sync scopes to group_folder subtree root id=27; history_items stored as JSONB on fields — 2026-08-12
|
||||
- Field clusters live in `ak_fields.fields_clustered_all` (synced from `fertilizer_project_test`); dashboard is static JSON + HTML, no backend — 2026-11-09
|
||||
- Factor pages: dates heatmap (`dates.html`), fertilizers analysis (`fertilizers.html`), fertilizer quality audit (`fertilizer-quality.html`), stub for predecessor; shared site-nav — 2026-11-10
|
||||
- Fertilizer acts: table `fertilizer_field_acts` + view `v_fertilizer_field`; join key = field name — 2026-11-10
|
||||
|
||||
## Known Issues
|
||||
|
||||
## Resolved Patterns
|
||||
- CSV export: `fs.writeFileSync` + `path.join(__dirname, ...)` with season/year in filename
|
||||
- PG sync of many fields: Pool + CONCURRENCY workers + resume skip where history_items already set
|
||||
- Dashboard rebuild: `npm run dashboard:build` then open `dashboard/index.html` or `npm run dashboard`
|
||||
Reference in New Issue
Block a user