Skip to content

LevyDecisionNeuroLab/image-valuation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Valuation — Quick start & handoff

Short, copy-paste steps to get a new developer running and able to export data.

What this is

  • A web experiment that shows food images (Phase 1) and asks memory/payment/confidence questions (Phase 2).
  • Backend: server.js (Express + MongoDB). Frontend: public/index.htmlpublic/js/main.jspublic/js/experiment/*.

Quick start (local)

  1. Install deps
npm install
  1. Create .env (at repo root)
MONGODB_URI="mongodb+srv://<user>:<pass>@cluster.example.mongodb.net/image_valuation"
PORT=3000
  1. Start server
npm start
# or for dev with reload
npm run start:dev

Open http://localhost:3000

Developer helper scripts

  • npm run test-api — posts a small JSON to /api/save (smoke test).
  • npm run debug-test — local CSV/parse debug utility.
  • npm run crop-images — crop images in public/images/new-imagesnew-images-final-cropped (uses sharp).

Quick test examples

  • POST a phase1 JSON (saves to DB):
curl -X POST http://localhost:3000/api/save \
   -H 'Content-Type: application/json' \
   -d '{"collection":"phase1","format":"json","data":[{"participant_id":"test1","phase":1,"image_id":1,"filename":"img.jpg","image_size":"large","response_time":1.2}] }'
  • Download exported CSV (direct or with password):
curl "http://localhost:3000/download/phase1?password=admin123" -o phase1.csv

(Note: admin123 appears in code as a default fallback — rotate/remove in production.)

Where to look (fast)

  • Change DB/CSV names or headers: public/config.json (serverConfig section).
  • Client-side trial logic, timing, and stimuli: public/js/experiment/ (main files: Experiment.js, TrialManager.js, DataCollector.js, Pages.js).
  • Image lists: public/js/shared-image-lists.js and public/images/....
  • Save/export logic: server.js (/api/save, /download/*, serveCsvResults).

Data & exports

  • Collections: phase1, phase2, final_questionnaire, attention_checks (see public/config.json).
  • CSV filenames: ${filename_prefix}_<collection>_YYYY-MM-DD.csv.
  • CSV headers and field filtering are defined in public/config.json and enforced in server.js.

Deploy notes

  • Start: node server.js (configured in render.yaml).
  • Add MONGODB_URI to Render/Vercel project secrets. Use the provider UI to view logs and redeploy.

Suggested small additions

  • Add .env.example and DEPLOYMENT.md with project links and exact env var names.

Owner / contact

  • Owner: Christopher Dunlock

Want me to: (pick one)

  • Fill the GitHub URL & latest commit SHA into this README.
  • Add .env.example and DEPLOYMENT.md now.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •