Data Requirements

Owner: Backend
Reviewers: Product, Architecture, QA
Status: Draft — migrated from legacy SRS
Version: 0.1
Last Updated: 2026-09-16
Review Cycle: Per schema migration

These are logical data requirements from the legacy SRS. Physical database design remains governed by ../../04-architecture/database-design.md and ../../../backend/prisma/schema.prisma.

Core Entities

Code Entity Key Attributes Main Relationships Current Status
DATA-01 User id, name, email, phone, role, status, assigned farm/pond scope, timestamps User has role and operational scope. PARTIAL
DATA-02 Farm id, name, owner_user_id, address, region, status Farm has many ponds. PARTIAL
DATA-03 Pond id, farm_id, code, area, farming_type, stocking_date, shrimp_quantity, density, shrimp_size, status Pond belongs to farm and has crops. PARTIAL
DATA-04 Crop id, pond_id, start_date, end_date, total_feed, production, pcr_fcr, status, notes Crop belongs to pond; one active crop per pond. PARTIAL
DATA-05 Sensor id, pond_id, metric_type, frequency, threshold_config, connection_status Sensor creates water quality records. PARTIAL
DATA-06 Water Quality Record id, farm_id, pond_id, sensor_id, metric_type, value, unit, measured_at, source, quality_status Input to dashboard, alerting and AI. PARTIAL
DATA-07 Device id, pond_id, name, type, status, mode, connection_status Device has command logs and alerts. PARTIAL
DATA-08 Device Command Log id, device_id, command, requested_by, requested_at, execution_status, executed_at, response_payload Audit trail for device control. PARTIAL
DATA-09 Feeding Record id, pond_id, crop_id, feed_type, amount, feeding_time, entered_by, reaction_note, ai_suggestion_snapshot Per-session feeding history. PARTIAL
DATA-10 Mineral Record id, pond_id, crop_id, date, mineral_type, amount, unit, applied_at, entered_by Mineral operation data. PARTIAL
DATA-11 Siphon Record id, pond_id, crop_id, date, morning_amount, afternoon_amount, total_amount, unit, bottom_condition_note Siphon operation data. PARTIAL
DATA-12 Productivity Record id, pond_id, crop_id, date, production_amount, unit, method, entered_by, notes Productivity and harvest analysis. PARTIAL
DATA-13 Alert id, pond_id, type, severity, source, status, assignee_id, created_at, acknowledged_at, closed_at Alert from sensor/device/user event. PARTIAL
DATA-14 Ticket id, pond_id, device_id, created_by, description, severity, status, assignee_id, sla_due_at, closed_at Technical incident/support request. PARTIAL
DATA-15 Ticket Attachment id, ticket_id, file_url, file_type, uploaded_by, uploaded_at Photo/video attachments. PARTIAL
DATA-16 Handbook Article id, title, category, farming_stage, related_metric, status, version, content, approved_by Handbook source for chatbot. PARTIAL
DATA-17 Chatbot Conversation id, user_id, pond_id, question_text, image_url, answer_text, references, confidence_score, feedback, created_at AI conversation history. PLANNED
DATA-18 Notification id, user_id, event_type, channel, title, body, read_status, target_url, created_at In-app/push/email notifications. PARTIAL
DATA-19 Configuration id, config_type, scope, key, value, effective_from, updated_by Thresholds, SLA, catalog, email, automation and AI policy. PARTIAL

Retention Requirements

Data Type Minimum Retention Status
Sensor data 1 year; must support extension by customer need. TBD
Device history and command logs 1 year. TBD
Feeding, manual environment, mineral and siphon data Full crop history across multiple crops. PARTIAL
Alerts, tickets and audit logs At least 1 year. TBD
Handbook content Permanent by version; no hard delete after chatbot reference. PARTIAL
Chatbot conversations and images At least crop lifecycle; privacy and delete/hide policy TBD. PLANNED

Data Design Gaps

  • Confirm physical ERD and indexes from current Prisma schema.
  • Confirm telemetry retention, aggregation and archival.
  • Confirm file retention policy for ticket/chatbot uploads.
  • Confirm conflict handling for offline mobile writes.