How kasunnmsu/meat-app works
Beef Choice Study App collects responses for a three-session beef-choice experiment, ending with demographics and a combined survey record. Participants start a full survey or an individual session, rank options, read seal descriptions in Session 2, and rank priced options in Session 3. API routes validate and save submissions for session-wise and combined exports; the README also documents database persistence and fallback data sources. Edges use README statements or source-index references; unsampled implementation details are not assumed.
Main entry points: session-3/page.tsx Priced ranking · saveWithRetry.ts Save retry queue · app/page.tsx Survey entry · session-1/page.tsx Session 1 ranking
Components 19
Participant entry
- Survey entry
app/page.tsx - Consent
app/tcle/page.tsx
Study tasks
- Session 1 ranking
app/session-1/page.tsx - Seal descriptions
app/session-2/descriptions/page.tsx - Session 2 ranking
app/session-2/descriptions/page.tsx - Priced ranking
app/session-3/page.tsx - Demographics
components/DemographicsForm.tsx
Shared interface
- Ranking interaction
components/RankingScreen.tsx - Language and location
lib/i18n.tsx
Submission and results
- Save retry queue
lib/saveWithRetry.ts - Session save routes
app/api/session-1/save/route.ts - Full survey route
app/api/full-survey/save/route.ts - Top seals lookup
app/api/session-3/top-seals/route.ts - Payload validation
lib/payloadValidation.ts - Excel and JSON exports
lib/dataExports.ts - Workbook rows
lib/resultWorkbooks.ts - Study database
lib/studyDatabase.ts - Local result files
lib/dataPaths.ts
Other components
- Participant
Connections 31
- Participant → Survey entry: starts survey
README.md - Survey entry → Consent: continues to
- Survey entry → Session 1 ranking: starts session
README.md - Survey entry → Seal descriptions: starts session
README.md - Survey entry → Priced ranking: starts session
README.md - Seal descriptions → Session 2 ranking: unlocks ranking
README.md - Session 1 ranking → Ranking interaction: uses ranking
app/session-1/page.tsx - Seal descriptions → Ranking interaction: uses ranking
app/session-2/descriptions/page.tsx - Priced ranking → Ranking interaction: uses ranking
app/session-3/page.tsx - Session 1 ranking → Demographics: collects at end
README.md - Session 2 ranking → Demographics: collects at end
README.md - Priced ranking → Demographics: collects final
README.md - Priced ranking → Top seals lookup: requests top seals
app/session-3/page.tsx - Session 1 ranking → Save retry queue: saves with retry
app/session-1/page.tsx - Session 2 ranking → Save retry queue: saves with retry
app/session-2/descriptions/page.tsx - Priced ranking → Save retry queue: saves with retry
app/session-3/page.tsx - Demographics → Save retry queue: saves with retry
app/demographics/page.tsx - Save retry queue → Session save routes: posts submissions
- Save retry queue → Full survey route: posts combined data
- Session save routes → Payload validation: validates payload
app/api/session-1/save/route.ts - Full survey route → Payload validation: validates payload
app/api/full-survey/save/route.ts - Session save routes → Excel and JSON exports: writes exports
app/api/session-1/save/route.ts - Full survey route → Excel and JSON exports: writes exports
app/api/full-survey/save/route.ts - Excel and JSON exports → Workbook rows: builds workbooks
lib/resultWorkbooks.ts - Session save routes → Study database: saves submission
app/api/session-1/save/route.ts - Full survey route → Study database: saves submission
app/api/full-survey/save/route.ts - Excel and JSON exports → Local result files: writes local files
- Top seals lookup → Study database: reads saved sessions
app/api/session-3/top-seals/route.ts - Session 1 ranking → Language and location: uses translations
app/session-1/page.tsx - Session 2 ranking → Language and location: uses translations
app/session-2/descriptions/page.tsx - Priced ranking → Language and location: uses translations
app/session-3/page.tsx