2026-08-26 13:46:05 +07:00
2026-09-29 15:19:10 +07:00
2026-08-26 13:46:05 +07:00
2026-10-01 13:23:45 +07:00
2026-08-26 13:46:05 +07:00
2026-09-29 15:19:10 +07:00
2026-08-26 13:46:05 +07:00
2026-08-26 13:46:05 +07:00
2026-08-26 13:46:05 +07:00
2026-08-26 13:46:05 +07:00
2026-08-26 13:46:05 +07:00
2026-10-01 13:23:45 +07:00
2026-10-01 13:23:45 +07:00
2026-08-26 13:46:05 +07:00
2026-08-26 13:46:05 +07:00
2026-09-02 13:16:06 +07:00
2026-08-26 13:46:05 +07:00
2026-08-26 13:46:05 +07:00
2026-10-01 13:23:45 +07:00

dashboard-cpsp

Poultry dashboard SPA. Looks like the legacy dashboard/ app and talks to the Django API in backend/ (/api/v1/).

Project layout

dashboard-cpsp/
  backend/          ← Django API (manage.py, apps, migrations)
  components/       ← pages and UI
  services/         ← API client
  ...

Prerequisites

  • Node 20+
  • Python 3.11+

First-time setup

Backend (terminal 1):

Install the Python dependencies once — only needed if Django/DRF aren't already in your Python environment (they're listed in backend/requirements.txt):

cd dashboard-cpsp/backend
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt

Then set up the database and seed data:

cd dashboard-cpsp/backend
python manage.py migrate
python manage.py seed_demo
# or via the npm wrapper:  npm run seed

Seed logins:

  • admin / admin123 — superadmin (can create/manage sites and kandang)
  • staff / staff123 — active staff (owns the seeded site; can read sites/kandang and create cycles, but cannot create/edit/delete sites or kandang)

seed_demo creates both logins plus an API key, then seeds the default Sukawarna demo data: Kandang 1 (45,000 DOC) and Kandang 2 (50,000 DOC), both 49-day closed cycles (22 May – 9 Jul 2026) with full daily data (chicken counting, chicken weight, feed sacks, manual input, KPI) and 10-minute IoT panel readings (144 readings per day per flock). Feed-sack out (keluar) data only occurs in the final week of the cycle (~20 sacks total), separate from usage (feed_use).

Frontend (terminal 2):

cd dashboard-cpsp
cp .env.example .env
npm install

Run (two terminals, like old dashboard)

Terminal 1 — API:

cd dashboard-cpsp/backend
npm run dev
# `node dev.mjs` starts Django runserver :8000, preferring the .venv python if
# present, otherwise the global python (so no pip install is needed when the
# deps are already installed). Or directly: python manage.py runserver 0.0.0.0:8000

Terminal 2 — UI:

cd dashboard-cpsp
npm run dev

Open http://localhost:3001. Vite proxies /api to Django on :8000.

Docker deployment

Full-stack deployment (Postgres + Django API + cron + Nginx frontend), modeled on the legacy dashboard/ Docker setup:

cd dashboard-new-v2
cp docker/.env.example .env
# edit SECRET_KEY and DB_PASSWORD
docker compose up -d --build
docker compose exec api python manage.py bootstrap_admin

For dev demo data only: docker compose exec api python manage.py seed_demo (not for production).

See DOCKER.md for architecture, env vars, cron, and troubleshooting.

Daily publish rule: dashboard data for calendar day D is only visible from 17:00 WIB on day D — except IoT Panel, which syncs every 10 minutes and shows live readings.

Screens

Login, Dashboard (KPI + AI insight + Total Pakan section + in-memory Harian/Akhir Siklus report), Hitung Ayam, Berat Ayam, Standar Ross, Hitung Karung (Sync hari ini + Saldo Awal + daily in/use/out tables), Standar Performa, Panel IoT (per-day 10-minute readings with charts), FCR, EEF, Pengaturan.

Reports are generated in the browser from live /api/v1/ data and exportable as PDF (multi-page A4, block-aware page breaks, compressed JPEG) and Excel (Chicken Counting, Weight, Feed In, Feed Use, Feed Out, FCR, EEF sheets with IoT-vs-manual accuracy). Closing the overlay drops the result; nothing is saved on Django.

The Saldo Awal feature on Hitung Karung posts feed_initial_balance to the cycle and compares the manual feed-in against the IoT-detected "in" for that date (from karung-web-admin GET /api/combined) with an accuracy figure.

Karung Sync calls karung-web-admin. If that host is down the API often returns 502; stored rows still render.

Tests

npm run test:run
S
Description
No description provided
Readme
45 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 52.4%
Python 46.5%
HTML 0.5%
Shell 0.4%
JavaScript 0.1%