How farahnaqwi/agrifarm works
AgriFarm is an offline-first PWA that turns a farmer’s consented account, plot, and photos into a tagged evidence report she can review and choose to share. Its main path runs from capture through on-device speech extraction and farmer confirmation, then report generation and sealing; a lender can retrieve the shared report, check its hash, review evidence, and request a site visit. The README documents satellite/weather checks and cooperative attestation as report capabilities. Some of those data-production paths are outside the supplied tree, so their implementation links are not inferred.
Main entry points: Flow.tsx Capture flow · index.ts Report engine · reports.ts Report sharing · Verify.tsx Lender verification
Components 22
Farmer capture
- Capture flow
app/src/capture/Flow.tsx - Speech extraction
app/src/ai/extract.ts - On-device ASR
app/src/ai/asr.ts - Plot capture
app/src/capture/Plot.tsx - Photo capture
app/src/capture/Photos.tsx - Capture record
app/src/capture/capture.ts
Evidence and report
- Evidence cards
app/src/data/cards.ts - Report engine
backend/engine/index.ts - Canonicalization
backend/engine/canonical.ts - Report narration
backend/engine/speech.ts - Farmer review
app/src/capture/Review.tsx
Sharing and storage
- Phone sealing
app/src/engine.ts - Report sharing
app/src/data/reports.ts - Offline store
app/src/offline/store.ts
Lender review
- Lender verification
app/src/lender/Verify.tsx - Evidence charts
app/src/lender/charts.tsx
Shared contracts
- Report contracts
app/src/types/report.ts
Other components
- Farmer
- Supabase
- Loan officer
- Satellite and weather records
- Cooperative attestation
Connections 23
- Farmer → Capture flow: provides input
README.md - Capture flow → Speech extraction: routes speech
app/src/capture/Flow.tsx - Speech extraction → On-device ASR: transcribes audio
app/src/ai/extract.ts - Capture flow → Plot capture: routes plot capture
app/src/capture/Flow.tsx - Capture flow → Photo capture: routes photo capture
app/src/capture/Flow.tsx - Capture flow → Capture record: assembles capture
app/src/capture/Flow.tsx - Capture flow → Evidence cards: loads cards
app/src/capture/Flow.tsx - Capture flow → Report engine: builds report
- Report engine → Canonicalization: canonicalizes
backend/engine/index.ts - Report engine → Report narration: composes narration
backend/engine/index.ts - Report engine → Satellite and weather records: checks evidence
README.md - Report engine → Cooperative attestation: uses attestations
README.md - Capture flow → Farmer review: routes report review
app/src/capture/Flow.tsx - Capture flow → Phone sealing: seals approved report
app/src/capture/Flow.tsx - Phone sealing → Report sharing: uploads report
app/src/capture/Share.tsx - Report sharing → Offline store: queues offline
app/src/data/reports.ts - Report sharing → Supabase: sends and fetches
app/src/data/reports.ts - Loan officer → Lender verification: opens QR report
README.md - Lender verification → Report sharing: fetches report
app/src/lender/Verify.tsx - Lender verification → Evidence charts: renders evidence
app/src/lender/Verify.tsx - Loan officer → Lender verification: requests site visit
app/src/lender/Verify.tsx - Capture record → Report contracts: uses report types
- Report engine → Report contracts: uses report types
backend/engine/index.ts