# p-ricer/p-rice architecture

> Architecture diagram of the GitHub repository p-ricer/p-rice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/p-ricer/p-rice
- Repository: https://github.com/p-ricer/p-rice

## Overview

P-RICE is a Philippine rice-price forecasting product: users choose a rice series and forecast horizon, then inspect the forecast, history, comparisons, and model explanation. The documented modeling workflow uses rice-price CSVs to evaluate XGBoost against ARIMA and a naive baseline, with SHAP explanations and exported results. The web client exposes those results through a dashboard. The server and notebook internals were not excerpted, so their implementation details and the handoff between them remain uncertain.

Main entry points: [`web/client/src/App.jsx`](https://github.com/p-ricer/p-rice/blob/main/web/client/src/App.jsx) (Dashboard coordinator), [`Model Development/P-RICE Model - All Rice Types (Monthly).ipynb`](https://github.com/p-ricer/p-rice/blob/main/Model%20Development/P-RICE%20Model%20-%20All%20Rice%20Types%20(Monthly).ipynb) (Forecast and evaluation), [`web/client/src/api.js`](https://github.com/p-ricer/p-rice/blob/main/web/client/src/api.js) (API client), [`web/client/src/components/TrendChart.jsx`](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/TrendChart.jsx) (Trend chart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data inputs"]
  node_price_csvs["Rice price datasets"]
  node_data_pipeline["External data fetchers"]
end

subgraph group_model["Forecast modeling"]
  node_forecast_notebook["Forecast and evaluation"]
  node_special_notebook["Special rice analysis"]
  node_results["Forecast results"]
end

subgraph group_web["Dashboard interface"]
  node_app["Dashboard coordinator<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_selector["Rice type selector"]
  node_forecast_card["Forecast card<br/>[ForecastCard.jsx]"]
  node_trend_chart["Trend chart<br/>[TrendChart.jsx]"]
  node_compare_table["Comparison table<br/>[CompareTable.jsx]"]
  node_model_info["Model explanation<br/>[ModelInfoPanel.jsx]"]
  node_about["Product overview<br/>[AboutPage.jsx]"]
  node_loading_views["Loading placeholders<br/>[Skeletons.jsx]"]
  node_exports["Browser exports<br/>[export.js]"]
end

subgraph group_backend["API service"]
  node_server["API server<br/>[server.mjs]"]
end

node_user(("Dashboard user"))

node_price_csvs -->|"provides inputs"| node_forecast_notebook
node_forecast_notebook -->|"generates results"| node_results
node_user -.->|"uses dashboard"| node_app
node_app -->|"requests data"| node_api_client
node_app -->|"renders"| node_selector
node_app -->|"renders"| node_forecast_card
node_app -->|"renders"| node_trend_chart
node_app -->|"renders"| node_compare_table
node_app -->|"renders"| node_model_info
node_app -->|"renders"| node_about
node_app -->|"renders"| node_loading_views
node_trend_chart -->|"uses"| node_exports
node_compare_table -->|"uses"| node_exports
node_api_client -.->|"calls API"| node_server
node_server -.->|"serves forecasts"| node_results

click node_price_csvs "https://github.com/p-ricer/p-rice/tree/main/Model%20Development"
click node_data_pipeline "https://github.com/p-ricer/p-rice/tree/main/Model%20Development/data_pipeline"
click node_forecast_notebook "https://github.com/p-ricer/p-rice/blob/main/Model%20Development/P-RICE%20Model%20-%20All%20Rice%20Types%20(Monthly).ipynb"
click node_special_notebook "https://github.com/p-ricer/p-rice/blob/main/Model%20Development/Local%20Special%20Rice%20-%20Model%20Development%20(with%20charts).ipynb"
click node_results "https://github.com/p-ricer/p-rice/blob/main/Model%20Development/P-RICE%20Results.xlsx"
click node_app "https://github.com/p-ricer/p-rice/blob/main/web/client/src/App.jsx"
click node_api_client "https://github.com/p-ricer/p-rice/blob/main/web/client/src/api.js"
click node_selector "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/RiceTypeSelector.jsx"
click node_forecast_card "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/ForecastCard.jsx"
click node_trend_chart "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/TrendChart.jsx"
click node_compare_table "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/CompareTable.jsx"
click node_model_info "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/ModelInfoPanel.jsx"
click node_about "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/AboutPage.jsx"
click node_loading_views "https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/Skeletons.jsx"
click node_exports "https://github.com/p-ricer/p-rice/blob/main/web/client/src/utils/export.js"
click node_server "https://github.com/p-ricer/p-rice/blob/main/web/server/server.mjs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_price_csvs,node_data_pipeline,node_user toneBlue
class node_forecast_notebook,node_special_notebook,node_results toneAmber
class node_app,node_api_client,node_selector,node_forecast_card,node_trend_chart,node_compare_table,node_model_info,node_about,node_loading_views,node_exports toneMint
class node_server toneRose
```

## Components

### Data inputs

- [Rice price datasets](https://github.com/p-ricer/p-rice/tree/main/Model%20Development): `Model Development`
- [External data fetchers](https://github.com/p-ricer/p-rice/tree/main/Model%20Development/data_pipeline): `Model Development/data_pipeline`

### Forecast modeling

- [Forecast and evaluation](https://github.com/p-ricer/p-rice/blob/main/Model%20Development/P-RICE%20Model%20-%20All%20Rice%20Types%20(Monthly).ipynb): `Model Development/P-RICE Model - All Rice Types (Monthly).ipynb`
- [Special rice analysis](https://github.com/p-ricer/p-rice/blob/main/Model%20Development/Local%20Special%20Rice%20-%20Model%20Development%20(with%20charts).ipynb): `Model Development/Local Special Rice - Model Development (with charts).ipynb`
- [Forecast results](https://github.com/p-ricer/p-rice/blob/main/Model%20Development/P-RICE%20Results.xlsx): `Model Development/P-RICE Results.xlsx`

### Dashboard interface

- [Dashboard coordinator](https://github.com/p-ricer/p-rice/blob/main/web/client/src/App.jsx): `web/client/src/App.jsx`
- [API client](https://github.com/p-ricer/p-rice/blob/main/web/client/src/api.js): `web/client/src/api.js`
- [Rice type selector](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/RiceTypeSelector.jsx): `web/client/src/components/RiceTypeSelector.jsx`
- [Forecast card](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/ForecastCard.jsx): `web/client/src/components/ForecastCard.jsx`
- [Trend chart](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/TrendChart.jsx): `web/client/src/components/TrendChart.jsx`
- [Comparison table](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/CompareTable.jsx): `web/client/src/components/CompareTable.jsx`
- [Model explanation](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/ModelInfoPanel.jsx): `web/client/src/components/ModelInfoPanel.jsx`
- [Product overview](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/AboutPage.jsx): `web/client/src/components/AboutPage.jsx`
- [Loading placeholders](https://github.com/p-ricer/p-rice/blob/main/web/client/src/components/Skeletons.jsx): `web/client/src/components/Skeletons.jsx`
- [Browser exports](https://github.com/p-ricer/p-rice/blob/main/web/client/src/utils/export.js): `web/client/src/utils/export.js`

### API service

- [API server](https://github.com/p-ricer/p-rice/blob/main/web/server/server.mjs): `web/server/server.mjs`

### Other components

- **Dashboard user**

## Connections

- Rice price datasets → Forecast and evaluation: provides inputs (evidence: `README.md`)
- Forecast and evaluation → Forecast results: generates results (evidence: `README.md`)
- Dashboard user → Dashboard coordinator: uses dashboard
- Dashboard coordinator → API client: requests data (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Rice type selector: renders (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Forecast card: renders (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Trend chart: renders (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Comparison table: renders (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Model explanation: renders (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Product overview: renders (evidence: `web/client/src/App.jsx`)
- Dashboard coordinator → Loading placeholders: renders (evidence: `web/client/src/App.jsx`)
- Trend chart → Browser exports: uses (evidence: `web/client/src/components/TrendChart.jsx`)
- Comparison table → Browser exports: uses (evidence: `web/client/src/components/CompareTable.jsx`)
- API client → API server: calls API
- API server → Forecast results: serves forecasts
