AgriPrice is a comprehensive agricultural commodity price data collection system developed for the National Agricultural Extension and Research Liaison Services (NAERLS).
Description
AgriPrice is a comprehensive agricultural commodity price data collection system developed for the National Agricultural Extension and Research Liaison Services (NAERLS). The project delivers an end-to-end platform for capturing, validating, and analyzing market price data from field officers across Nigeria, combining a production-grade web administration panel with an offline-first Android mobile application. The primary goal was to replace fragmented, paper-based field reporting with a structured, verifiable digital pipeline that produces reliable price intelligence for agricultural planning.
Key Features
Offline-First Mobile Data Collection: Engineered an Android application that allows field officers to capture market visits — commodity prices, quantities, photographs, and GPS coordinates — entirely without network connectivity, persisting all data locally and synchronizing automatically when signal returns.
Dynamic Field Engine: Built a configurable data capture system where administrators define, reorder, and extend collection fields from the web panel without touching the mobile codebase; new fields appear on the officer's form and their values flow through the entire stack automatically.
Multi-Level Review Workflow: Implemented a structured approval pipeline where submissions sync as pending, are reviewed by supervisors, and can be approved, rejected, flagged, or returned for revision — with full audit trails, version history, and rejection reasons captured per submission.
Comprehensive Web Administration Panel: Developed a complete management console covering geography hierarchies (states, LGAs, markets), commodity catalogues with hierarchical categories and units of measure, officer lifecycle and market assignments, role-based user management with granular permissions, and a dynamic field manager — all with bulk-upload support and exports.
Analytical Reporting: Built dedicated SQL-backed analytics views delivering price trends, regional comparisons, market coverage analysis, officer performance leaderboards, and top-mover detection — surfaced through interactive charts and Excel/CSV export pipelines.
Location Verification: Integrated GPS capture with accuracy tracking and market-coordinate verification to detect submissions made far from the reporting location, flagging potential data-quality issues for reviewer attention.
Photo Evidence Pipeline: Implemented a camera-to-cloud photo pipeline that compresses captures, stores them locally for offline viewing, and uploads them asynchronously after submission sync — with per-photo retry semantics that isolate failures without blocking other data.
Bulk Data Ingestion: Delivered Excel-based bulk upload for geography, commodities, officers, and submissions — with dynamic custom-field columns, deterministic UUID generation for idempotent re-upload, per-row error reporting, and row-level deduplication.
Secure Authentication and Authorization: Implemented JWT-based authentication with encrypted token storage, refresh-token rotation, Argon2 password hashing, and role-based access control enforced across 89 API endpoints.
Reference Data Caching: Built a resilient cache-first architecture where markets, commodities, units, geography, and custom-field schemas are pulled from the server and cached locally on the device — enabling the officer's application to function indefinitely without connectivity.
Technologies Used
Back-End: FastAPI (Python 3.12) for the asynchronous REST API, built around a repository-pattern data-access layer, business-logic service layer, and Pydantic v2 validation schemas for strict request/response contracts.
Database: PostgreSQL 16 with a 32-table schema spanning role-based user management, hierarchical geography, commodity catalogues, dynamic custom fields, submissions with line items, photo metadata, and audit logging — managed through Alembic migrations and enriched with eight SQL analytical views.
Caching and Rate Limiting: Redis for distributed rate limiting and future background-task queuing via Celery.
Web Admin Panel: Server-rendered Jinja2 templates styled with Tailwind CSS, made dynamic through Alpine.js for stateful interactions and HTMX for targeted DOM updates — using a custom design system built on semantic color tokens, Inter and JetBrains Mono typography, and native HTML dialogs.
Mobile Application: Native Android app built with Kotlin and Jetpack Compose using Material 3 design language, following clean architecture with a Hilt dependency-injection graph, a Room local database for offline persistence, Retrofit with Kotlinx Serialization for networking, and WorkManager for resilient background synchronization.
Mobile Capabilities: CameraX/System Camera intent for photo capture, Google Play Services Location for GPS, EncryptedSharedPreferences for secure token storage, and Coil for image loading — all wrapped in a modern, animated interface with dark-mode support.
Authentication and Security: Argon2id password hashing, JWT access and refresh tokens, role-based permission enforcement, per-endpoint rate limiting, request-ID tracing across all logs, and encrypted-at-rest storage for mobile credentials.
Data Engineering: openpyxl for Excel template generation and bulk-import parsing, deterministic UUID v5 generation for idempotent bulk submissions, database-level uniqueness constraints for offline-sync deduplication, and structured JSON logging through Loguru.
Design Highlights
Unified Design Language: Built a semantic design system shared conceptually across the web and mobile clients — deep teal accent color, warm neutral surfaces, Inter for interface text, and JetBrains Mono for all numeric and identifier content — ensuring a single brand identity whether the admin is at a desktop or the officer is in a market.
Offline-First User Experience: Every mobile screen renders from local storage first, so the officer never sees a loading spinner or error screen when the network is unavailable; sync state is always visible through status pills and a dedicated sync center.
Field-Optimized Mobile Interface: Optimized the mobile layout for one-handed field use with large tap targets, thumb-reachable primary actions, numeric keypads for price entry, and high-contrast text for outdoor sunlight viewing.
Professional Administration Interface: Designed the web panel to feel like a mature internal tool — dense information tables, hover-reveal row actions, contextual dialogs, native browser confirmations for destructive operations, and clear visual hierarchy through badge systems, status pills, and semantic spacing.
Analytical Clarity: Focused the analytics views on decision-useful outputs — trend lines over time, regional price spreads, and biggest movers — rather than dense dashboards, ensuring the data drives action rather than overwhelming the viewer.
Accessible and Responsive: Ensured the entire web panel works from a small laptop screen through to a large desktop, with consistent keyboard navigation, focus visibility, and screen-reader-friendly semantics throughout.
Your email address will not be published. Required fields are marked *