Files
dashboard/DATA_SOURCE_MAPPING.md
T
Alberto-Audrix 32a36cceff
CI / lint-and-test (push) Canceled after 0s
first commit
2026-07-28 08:55:05 +07:00

28 KiB

Data Source Mapping - Dashboard Solusi AI Peternakan Ayam

This document maps every page, section, graph, and box to their respective data sources (internal backend vs external API).

Base URLs

  • External API (CPSP): https://dashboard.cpsp.id
  • Internal Backend: http://localhost:5001/api (or VITE_API_URL env variable)

1. Main Dashboard (/)

Page Components

1.1 Filter Dropdowns Section

  • Component: FilterDropdown (Area & Kandang)
  • Data Source: Internal Backend
    • API: GET /api/kandangs/by-cycle/{cycleId}
    • Usage: Load kandang options for dropdown filter

1.2 KPI Cards (6 cards)

  • Component: KpiCard
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/cage/9f556d2a-af5c-41b0-bcd0-6cea0dfa0fed
    • Data Path: response.data.kpi
    • KPIs:
      1. Rata-rata Bobot (Average Weight)
      2. Total Populasi (Total Population)
      3. FCR (Feed Conversion Ratio)
      4. Deplesi (Depletion/Mortality Rate)
      5. Mortalitas (Mortality Count)
      6. Umur (Age/Days)

1.3 Chicken Counting Dashboard

  • Component: ChickenCountingDashboard
  • Data Sources: Multiple
1.3.1 Counting Stats Cards
  • Component: CountingStats
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting?startDate={start}&endDate={end}&kandangId={id}
    • Metrics:
      • Total Count (today)
      • Average Count (period)
      • Change from yesterday
      • Data points count
1.3.2 Camera Count Cards (Multiple cameras)
  • Component: CameraCountCard
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting?startDate={start}&endDate={end}&kandangId={id}
    • Filtered by: Camera name
    • Displays: Latest count per camera
1.3.3 Population Trend Chart
  • Component: SimplePopulationChart
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting?startDate={start}&endDate={end}&kandangId={id}
    • Chart Type: Line chart showing population over time
    • Aggregation: Sum of all cameras per day
1.3.4 Location Count Breakdown
  • Component: LocationCountBreakdown
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting?startDate={start}&endDate={end}
    • Displays: Breakdown by kandang location

1.4 Daily Weight Gain Chart

  • Component: DailyWeightGainChart
  • Data Source: Multiple (External API + Internal Backend)
    • Weight Data API: GET https://dashboard.cpsp.id/api/iot/flocks/distribusi_bobot/?mode=range&start_date={start}&end_date={end}
    • FCR Data API: GET https://dashboard.cpsp.id/api/data-support/fcrtable/{dow}/{population}/{day}/
    • Mortality Data: Internal Backend - GET /api/mortality/{cycleId}
    • Chart Metrics:
      • Actual Weight (kg)
      • Standard Weight (kg)
      • Daily Gain (g)
      • ADG (Average Daily Gain)
      • FCR
      • IP (Performance Index)
    • Caching: 1-hour cache for weight distribution, 24-hour cache for FCR

2. Weight Monitoring Page (/weight-monitoring)

Page Components

2.1 Weight Stats Cards

  • Component: WeightStats
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/flocks/distribusi_bobot/?mode=yesterday
    • Metrics:
      • Average Weight
      • Uniformity %
      • Standard Deviation
      • Min/Max Weight
      • Total Predictions
      • Chicken Count

2.2 Weight Distribution Chart

  • Component: WeightDistributionChart
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/flocks/distribusi_bobot/?mode=range&start_date={start}&end_date={end}
    • Chart Type: Histogram/Bar chart
    • Displays: Weight range distribution with frequency
    • Caching: 1-hour cache grouped by 14-day periods

2.3 Weight Trend Chart

  • Component: WeightTrendChart
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/flocks/distribusi_bobot/?mode=range&start_date={start}&end_date={end}
    • Chart Type: Line chart
    • Metrics: Average weight over time with standard weight comparison

2.4 Combined Weight Trend Chart

  • Component: CombinedWeightTrendChart
  • Data Source: Multiple (External + Internal)
    • Weight API: GET https://dashboard.cpsp.id/api/iot/flocks/distribusi_bobot/
    • Mortality API: Internal Backend - GET /api/mortality/{cycleId}
    • Chart Type: Multi-line chart with dual Y-axis
    • Metrics: Weight trend + mortality overlay

2.5 Weight Analysis

  • Component: WeightAnalysis
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/flocks/distribusi_bobot/?mode=yesterday
    • Analysis Includes:
      • Growth rate calculation
      • Uniformity assessment
      • Performance indicators
      • Alerts and recommendations

2.6 Sensor Weight Summary

  • Component: SensorWeightSummary
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/summary?start_date={date}&end_date={date}
    • Displays: Per-device weight summary table
    • Metrics per device:
      • Device name
      • Total weight (prediction & actual)
      • Average weight (prediction & actual)
      • Chicken count

2.7 Live Scale View

  • Component: LiveScaleView
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/range?start_date={start}&end_date={end}
    • Displays: Real-time scale readings
    • Updates: Periodic polling

3. Multi-Coop Weight Comparison Page (/multi-coop-weight)

Page Components

3.1 Multi-Coop Analysis

  • Component: MultiCoopAnalysis
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/cage/9f556d2a-af5c-41b0-bcd0-6cea0dfa0fed
    • Data Path: response.data.kpi (multi-coop structure)
    • Metrics per coop:
      • Average Weight
      • Population
      • FCR
      • Mortality
      • Growth rate
    • Chart Type: Comparison bar charts

3.2 Comparison Analysis

  • Component: ComparisonAnalysis
  • Data Source: External API (CPSP)
    • Same API as above
    • Analysis: Statistical comparison between coops
    • Displays:
      • Best/worst performers
      • Performance gaps
      • Recommendations

3.3 Device Weight Comparison Chart

  • Component: DeviceWeightComparisonChart
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/summary
    • Chart Type: Bar chart comparing devices
    • Metrics: Average weight per device/coop

4. Feed Sack Counting Page (/feed-sack-counting)

Page Components

4.1 Feed Saldo Card (Balance Summary)

  • Component: FeedSaldoCard
  • Data Sources: Multiple (External + Internal)
    • Feed Sack API: GET https://dashboard.cpsp.id/api/counting/sacks/{siteId}/{cameraName}/
    • Manual Entries API: Internal Backend - GET /api/manual-feed-sack?startDate={start}&endDate={end}
    • Metrics:
      • Opening balance (Saldo Awal)
      • Inbound sacks (Karung Masuk)
      • Usage (Pemakaian)
      • Closing balance (Saldo Akhir)

4.2 Feed Stats Cards

  • Component: FeedStats
  • Data Source: External API + Internal Backend
    • External API: GET https://dashboard.cpsp.id/api/counting/sacks/{siteId}/
    • Internal API: GET /api/manual-feed-sack
    • Metrics:
      • Total inbound (today/period)
      • Total usage (today/period)
      • Average daily usage
      • Days of supply remaining

4.3 Feed Trend Chart

  • Component: FeedTrendChart
  • Data Source: External API + Internal Backend (merged)
    • External API: GET https://dashboard.cpsp.id/api/counting/sacks/{siteId}/
    • Internal API: GET /api/manual-feed-sack
    • Chart Type: Multi-line chart
    • Lines: Inbound, Usage, Balance over time

4.4 Feed Activity Log

  • Component: FeedActivityLog
  • Data Source: External API + Internal Backend (merged)
    • External API: GET https://dashboard.cpsp.id/api/counting/sacks/{siteId}/
    • Internal API: GET /api/manual-feed-sack
    • Displays: Timestamped feed sack transactions
    • Types: Inbound, Usage, Outbound, Manual entries

4.5 Feed Daily Summary Table

  • Component: FeedDailySummaryTable
  • Data Source: External API + Internal Backend
    • Aggregation: Daily totals by camera/location
    • Editable: Manual entry corrections via Internal Backend
    • API for edits: PUT /api/manual-feed-sack

4.6 Feed Comparison Charts

  • Component: FeedSackComparisonCharts
  • Data Source: External API + Internal Backend
    • Chart Types:
      • Camera comparison bar chart
      • Location comparison bar chart
      • Time-series comparison

4.7 Live Feed View

  • Component: LiveFeedView
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/counting/sacks/{siteId}/
    • Updates: Real-time polling
    • Displays: Latest camera readings

4.8 Column Configuration

  • Component: ColumnConfigModal
  • Data Source: Internal Backend
    • API GET: GET /api/feed-sack-column-config
    • API PUT: PUT /api/feed-sack-column-config
    • Purpose: Save user's column visibility preferences

5. Chicken Counting Page (/chicken-counting)

Page Components

5.1 Counting Stats

  • Component: CountingStats
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting?startDate={start}&endDate={end}&kandangId={id}
    • Metrics: Same as dashboard section

5.2 Chicken Count Trend Chart

  • Component: ChickenCountTrendChart
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting?startDate={start}&endDate={end}&kandangId={id}
    • Chart Type: Line chart with area fill
    • Metrics: Daily population trend

5.3 Combined Trend Chart (Count + Mortality)

  • Component: CombinedTrendChart
  • Data Source: Multiple Internal Backend
    • Counting API: GET /api/chicken-counting
    • Mortality API: GET /api/mortality/{cycleId}
    • Chart Type: Multi-line with dual Y-axis
    • Displays: Population vs mortality correlation

5.4 Population Trend Chart

  • Component: PopulationTrendChart
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting
    • Chart Type: Area chart
    • Shows: Population change over cycle

5.5 Live Count View

  • Component: LiveCountView
  • Data Source: Internal Backend
    • API: GET /api/chicken-counting
    • Updates: Periodic polling for latest counts

5.6 Kandang Management

  • Component: KandangManagementPage
  • Data Source: Internal Backend
    • API GET: GET /api/kandangs
    • API POST: POST /api/kandangs
    • API PUT: PUT /api/kandangs/{id}
    • API DELETE: DELETE /api/kandangs/{id}
    • DOC In Count: PUT /api/kandangs/{kandangId}/cycle/{cycleId}

5.7 Data Management

  • Component: DataManagementPage
  • Data Source: Internal Backend
    • Submit Count: POST /api/chicken-counting?source=manual
    • Requires: X-API-Key header

6. IoT Panel / Environment Monitoring (/iot-panel)

Page Components

6.1 IoT Panel Environment Column

  • Component: IotPanelEnvironmentColumn
  • Data Source: External API (CPSP)
    • Latest Sensor API: GET https://dashboard.cpsp.id/api/iot/flocks/sensors/latest/
    • Range API: GET https://dashboard.cpsp.id/api/iot/flocks/sensors/range/?start_date={start}&end_date={end}
    • Metrics:
      • Temperature (Suhu)
      • Humidity (Kelembapan)
      • Ammonia (Amonia)
    • Aggregation: 5-minute intervals, last 12 hours
    • Filter: Removes sensor failures (zero values)

6.2 Environment Chart

  • Component: EnvironmentChart
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/flocks/sensors/range/
    • Chart Type: Multi-line chart
    • Lines: Temperature, Humidity, Ammonia
    • Time Range: Last 12 hours (filtered)

6.3 IoT Panel Devices Column

  • Component: IotPanelDevicesColumn
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/cage_sites/get_all/
    • Displays:
      • Device list (scales, sensors)
      • Device status
      • Last reading timestamp

6.4 Activity Log Panel

  • Component: ActivityLogPanel
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/log-act/last/?limit={limit}
    • Displays: Recent IoT system activities
    • Log Types: Device actions, alerts, status changes

6.5 IoT Sensor History Modal

  • Component: IotSensorHistoryModal
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/iot/flocks/sensors/range/
    • Chart Type: Historical line chart
    • Date Range: User-selectable

7. Manual Weighing Page (/manual-weighing)

Page Components

7.1 Manual Weighing Stats

  • Component: ManualWeighingStats
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/range
    • Metrics:
      • Total manual entries
      • Average weight
      • Sample size
      • Last weighing date
  • Component: ManualWeighingTrends
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/range
    • Chart Type: Line chart
    • Displays: Manual weighing data trend

7.3 Manual Weighing Analysis

  • Component: ManualWeighingAnalysis
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/range
    • Analysis:
      • Comparison with sensor data
      • Variance analysis
      • Accuracy metrics

7.4 Weighing Record Cards

  • Component: WeighingRecordCard
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/scales/predictions/range
    • Displays: Individual manual weighing records

7.5 AI Weighing Analysis Modal

  • Component: AiWeighingAnalysisModal
  • Data Source: Mock/Client-side AI
    • Note: AI analysis is currently client-side processing

8. Cycle Management (/cycle-timeline)

Page Components

8.1 Cycle Timeline

  • Component: CycleTimeline
  • Data Source: Internal Backend
    • API: GET /api/cycles
    • Displays:
      • Cycle start/end dates
      • Current day
      • Total days
      • Progress bar

8.2 Cycle Create Modal

  • Component: CycleCreateModal
  • Data Source: Internal Backend
    • API POST: POST /api/cycles
    • Fields:
      • Start date
      • End date
      • Total days
      • Chick-in weight
      • DOC in count
      • Status

8.3 Active Cycle Info

  • Data Source: Internal Backend
    • API: GET /api/cycles/active
    • Used Throughout App: Context provider

8.4 Cycle Update

  • Data Source: Internal Backend
    • API PUT: PUT /api/cycles/{id}

9. Mortality Tracking (Embedded in multiple pages)

Components

9.1 Mortality Records Table

  • Data Source: Internal Backend
    • API GET: GET /api/mortality/{cycleId}
    • API GET (by Kandang): GET /api/mortality/{cycleId}?kandangId={id}
    • API GET (Totals): GET /api/mortality/{cycleId}/totals
    • Displays:
      • Daily mortality count
      • Chicken count
      • Panen (harvest)
      • Afkir (culling)
      • Keterangan (notes)

9.2 Mortality Update

  • Data Source: Internal Backend
    • API PUT: PUT /api/mortality/{cycleId}/{day}
    • Body: mortalityCount, chickenCount, kandangId, panen, keterangan, afkir

9.3 Mortality Delete

  • Data Source: Internal Backend
    • API DELETE: DELETE /api/mortality/{cycleId}/{day}

10. FCR Calculation (Multiple Pages)

Component

10.1 FCR Comparison Chart

  • Component: FcrComparisonChart
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/data-support/fcrtable/{dow}/{population}/{day}/
    • Parameters:
      • dow: Day of week (strain type)
      • population: Initial population
      • day: Current day in cycle
    • Caching: 24-hour localStorage cache
    • Batch Fetch: Can fetch multiple days at once
    • Metrics:
      • Weight
      • ADG (Average Daily Gain)
      • Daily Gain
      • Daily Feed
      • Feeds Use
      • FCR
      • Total Feed
      • Bags Feed

11. Cobb Standard Reference (/cobb-standard)

Page Components

11.1 Weight Standard Table

  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/data-support/fcrtable/{dow}/{population}/{day}/
    • Display: Cobb standard weight by day
    • Comparison: Actual vs standard

11.2 Performance Index

  • Data Source: Multiple (External + Internal)
    • Weight: External API
    • Mortality: Internal Backend
    • Calculation: Client-side based on fetched data

12. Location/Cage Management (/location-management)

Page Components

12.1 Location Structure

  • Component: StructureColumn
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/cage_sites/get_all/
    • Structure: Site → Scales → Devices
    • Transforms To: Location → Coop → Floor

12.2 Floor Details

  • Component: FloorDetails
  • Data Source: External API (CPSP)
    • API: Same as above
    • Displays: Device-level details

13. Vet Visit Page (/vet-visit)

Page Components

13.1 Vet Visit Stats

  • Component: VetVisitStats
  • Data Source: Mock Data (to be implemented)
    • Future API: Internal Backend endpoint needed

13.2 Upcoming Visits

  • Component: UpcomingVisits
  • Data Source: Mock Data (to be implemented)

13.3 Visit Log Table

  • Component: VisitLogTable
  • Data Source: Mock Data (to be implemented)

13.4 Visit Notes Modal

  • Component: VisitNotesModal
  • Data Source: Mock Data (to be implemented)

14. Behavior Analysis (/behavior-analysis)

Page Components

14.1 Behavior Summary

  • Component: BehaviorSummary
  • Data Source: Mock Data (to be implemented)
    • Future API: Computer vision API needed

14.2 Behavior Trend Chart

  • Component: BehaviorTrendChart
  • Data Source: Mock Data (to be implemented)

14.3 Live Behavior View

  • Component: LiveBehaviorView
  • Data Source: Mock Data (to be implemented)
    • Future: Real-time video stream analysis

14.4 Behavior Anomaly Log

  • Component: BehaviorAnomalyLog
  • Data Source: Mock Data (to be implemented)

15. Feed Scheduling (/feed-scheduling)

Page Components

15.1 Schedule Overview

  • Component: ScheduleOverview
  • Data Source: Mock Data (to be implemented)
    • Future API: Internal Backend scheduling service

15.2 Daily Schedule Timeline

  • Component: DailyScheduleTimeline
  • Data Source: Mock Data (to be implemented)

15.3 Consumption Pattern Chart

  • Component: ConsumptionPatternChart
  • Data Source: External API (Feed Sack) + Mock
    • Historical Data: GET https://dashboard.cpsp.id/api/counting/sacks/
    • Schedule Data: Mock (to be implemented)

15.4 Influencing Factors

  • Component: InfluencingFactors
  • Data Source: Multiple (Environment + Weight + Mock)
    • Environment: External API
    • Weight: External API
    • AI Factors: Mock

15.5 Daily Events List

  • Component: DailyEventsList
  • Data Source: Mock Data (to be implemented)

16. Feed Wastage (/feed-wastage)

Page Components

16.1 Wastage Stats

  • Component: WastageStats
  • Data Source: Calculated from Feed Sack API
    • Feed Data: External API - Feed Sack Counting
    • Calculation: Expected vs Actual usage

16.2 Live Wastage View

  • Component: LiveWastageView
  • Data Source: Mock Data (to be implemented)
    • Future: Computer vision API for wastage detection

16.3 Wastage Hotspot Map

  • Component: WastageHotspotMap
  • Data Source: Mock Data (to be implemented)

16.4 Wastage Alert Log

  • Component: WastageAlertLog
  • Data Source: Mock Data (to be implemented)

17. Alerts & Notifications (/alerts)

Page Components

17.1 Alert Feed

  • Component: AlertFeed
  • Data Source: Multiple sources aggregated
    • Weight Alerts: External API (Weight Distribution)
    • Environment Alerts: External API (IoT Sensors)
    • Mortality Alerts: Internal Backend
    • Feed Alerts: External API (Feed Sack)
    • System Alerts: External API (IoT Activity Logs)

17.2 Weight Alerts Log

  • Component: WeightAlertsLog
  • Data Source: External API (CPSP)
    • Based on: Weight distribution statistics
    • Triggers: Uniformity < 80%, Std Dev > threshold

18. IoT Device Management (/iot-devices)

Page Components

18.1 IoT Device Dashboard

  • Component: IotDeviceDashboard
  • Data Source: External API (CPSP)
    • API: GET https://dashboard.cpsp.id/api/cage_sites/get_all/
    • Displays: All IoT devices with status

18.2 IoT Device Stats

  • Component: IotDeviceStats
  • Data Source: External API (CPSP)
    • Metrics:
      • Total devices
      • Active devices
      • Offline devices
      • Last sync time

18.3 IoT Device Card

  • Component: IotDeviceCard
  • Data Source: External API (CPSP)
    • API: Same as above
    • Displays per device:
      • Device name
      • Status
      • Last reading
      • Battery level (if applicable)

19. Camera Management (/cameras)

Page Components

19.1 Camera Dashboard

  • Component: CameraDashboard
  • Data Source: External API (CPSP)
    • Feed Sack Cameras: GET https://dashboard.cpsp.id/api/counting/sacks/
    • Available Cameras: Extracted from API response

19.2 Camera Card

  • Component: CameraCard
  • Data Source: External API (CPSP)
    • Displays per camera:
      • Camera name
      • Location
      • Status
      • Last capture time
      • Latest count

20. Network Management (/network)

Page Components

20.1 Network Stats

  • Component: NetworkStats
  • Data Source: Mock Data (to be implemented)
    • Future API: Network monitoring service

20.2 Network Device Dashboard

  • Component: NetworkDeviceDashboard
  • Data Source: Mock Data (to be implemented)

20.3 Bandwidth Chart

  • Component: BandwidthChart
  • Data Source: Mock Data (to be implemented)

21. Batch Processing (/batch-process)

Page Components

21.1 Batch Stats

  • Component: BatchStats
  • Data Source: Mock Data (to be implemented)
    • Future API: Batch processing service

21.2 Service Monitor

  • Component: ServiceMonitor
  • Data Source: Mock Data (to be implemented)

22. OCR Processing (/ocr)

Page Components

22.1 OCR Stats

  • Component: OcrStats
  • Data Source: Mock Data (to be implemented)
    • Future API: OCR service

22.2 OCR Upload

  • Component: OcrUpload
  • Data Source: Mock Data (to be implemented)

22.3 OCR Documents Table

  • Component: OcrDocumentsTable
  • Data Source: Mock Data (to be implemented)

23. User Management (/users)

Page Components

23.1 User Tab

  • Component: UserTab
  • Data Source: Mock Data (to be implemented)
    • Future API: Internal Backend user management

23.2 Role Tab

  • Component: RoleTab
  • Data Source: Mock Data (to be implemented)

23.3 Permission Manager

  • Component: PermissionManager
  • Data Source: Mock Data (to be implemented)

24. Authentication Pages (/login, /forgot-password)

Page Components

24.1 Login Form

  • Component: LoginForm
  • Data Source: Mock Data (to be implemented)
    • Future API: Internal Backend auth service

24.2 Forgot Password Form

  • Component: ForgotPasswordForm
  • Data Source: Mock Data (to be implemented)

25. Audit Logs (Embedded)

Component

25.1 Audit Log Viewer

  • Data Source: Internal Backend
    • API: GET /api/audit-logs?table={table}&recordId={id}&startDate={start}&endDate={end}&limit={limit}&offset={offset}
    • Count API: GET /api/audit-logs/count?table={table}
    • Tracks: All database changes
    • Fields:
      • Table name
      • Record ID
      • Action (INSERT, UPDATE, DELETE)
      • Old values
      • New values
      • Timestamp
      • User (if applicable)

Summary Table

Category Internal Backend External API (CPSP) Mock/TBD
Chicken Counting ✓
Weight Monitoring ✓
Weight Distribution ✓ (with cache)
FCR Calculation ✓ (with cache)
Feed Sack Counting ✓ (manual entries) ✓ (camera counts)
IoT Sensors (Environment) ✓
IoT Devices/Scales ✓
Cycle Management ✓
Mortality Tracking ✓
Kandang Management ✓
Location/Cage Sites ✓
Manual Feed Sack ✓
Audit Logs ✓
Column Config ✓
Behavior Analysis ✓
Vet Visits ✓
Feed Scheduling ✓
Feed Wastage Partial Partial ✓
User Management ✓
Authentication ✓
Network Monitoring ✓
Batch Processing ✓
OCR Processing ✓

Caching Strategy

Weight Distribution Cache

  • Type: 1-hour cache
  • Storage: localStorage
  • Key Pattern: weight-dist-1hour-{groupNumber}
  • Grouping: 14-day periods aligned to cycle start
  • Clear Function: apiClient.clearWeightDistributionCache()

FCR Cache

  • Type: 24-hour cache
  • Storage: localStorage
  • Key Pattern: fcr-cache-{dow}-{population}-{day}
  • Purpose: Reduce API calls for standard reference data

API Mode Configuration

The application supports two modes:

  • LIVE Mode: Fetches from real APIs
  • DEMO Mode: Uses mock data

Mode is set in AppContext and passed to all apiClient functions.


Environment Variables

VITE_API_URL=http://localhost:5001/api  # Internal backend base URL
VITE_CHICKEN_COUNTING_API_KEY=<key>     # API key for chicken counting submission

Notes

  1. External API (CPSP) is hardcoded to https://dashboard.cpsp.id in apiService.ts
  2. Internal Backend uses VITE_API_URL environment variable with fallback to localhost:5001
  3. Caching is implemented for high-frequency endpoints (Weight Distribution, FCR)
  4. Manual overrides are stored in Internal Backend and merged with External API data (Feed Sack)
  5. Mock data is used for features under development (Behavior, Vet, Scheduling, etc.)
  6. Real-time updates use periodic polling, not WebSockets (yet)

Last Updated: 2026-05-14