Skip to content

Diet: read gastric lavage columns and chart stomach contents (#40) - #109

Merged
Luen merged 2 commits into
mainfrom
diet
Nov 3, 2026
Merged

Luen merged 2 commits into
mainfrom
diet

Conversation

@Luen

@Luen Luen commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #40.

Importer

The shark logs already had lavage columns, but the importer matched and then ignored them. Three new capture columns:

Column 2016-17 2020-21 2013-14
lavage (0/1) Lavage (y/n) Gastic lavage Eversion/Lavage
stomach (full / traces / empty) Lavage (full/empty) Stomach content –
stomach_contents (free text) Lavage (contents) Stomach sample type State of Stomach

"no sample", "n/a", "no food" and "traces of food" are never treated as contents. A fullness cell that isn't a fullness word (e.g. "worm found") is kept as contents. New migration 0002, IMPORTER_VERSION → 6, so deployed caches rebuild.

/physiology, "Diet" section

  • What the lavage found: full / traces / empty share by season and species
  • Does the moon change foraging success? (cites Debaere et al. 2024, Coral Reefs, which analysed these same 2016-17 and 2020-21 lavages): no difference between phases (χ² p ≈ 0.7), in line with the paper
  • Do newborns eat?: food in the stomach by umbilical scar. Open-scar newborns had food less often, but the difference isn't significant at these sample sizes (p ≈ 0.17). The copy says so.
  • Fed before or after dark?: by capture time relative to sunset
  • Body condition, fed or empty: Fulton's K box plot with a Welch test
  • What was in the stomachs: food types named in the free-text notes (fish, crustaceans, plastic, unidentified)
  • Live finding lavage (the title flips if most pups turn out to have eaten)

Every statement in the notes is chosen by the test result in the load function; no numbers are hard-coded.

Also

  • chiSquare / chiSquareP in stats.ts (regularised incomplete gamma), tested against textbook critical values.
  • The synthetic fixture gets lavage columns on every other blacktip, filled deterministically so no other synthetic values shift. A new import test covers the parsing and diet(), and e2e/axe now render the section.
  • AGENTS.md: importer note and repo map.

Checks

pnpm lint, pnpm check, pnpm test (69), real-data import test, pnpm build, pnpm test:e2e (29). Real-data page checked in the browser.

Independent of #108; the two branches touch different files except findings.ts and AGENTS.md, where both only add new blocks.

🤖 Generated with Claude Code

The importer now reads the lavage columns it used to skip: lavage done
(2016-17 'Lavage (y/n)', 2020-21 'Gastic lavage'), stomach fullness
(full / traces / empty) and free-text contents, into new capture
columns. /physiology gains a stomach-contents section: fullness by
season and species, foraging success by moon phase (Debaere et al.
2024), by umbilical scar and by time after sunset with chi-square
tests, body condition of fed vs empty pups, and the kinds of food named
in the samples. A live finding summarises it.

Adds chiSquare / chiSquareP to stats, synthetic lavage columns to the
fixture, and bumps IMPORTER_VERSION to 6.

Closes #40

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both branches added blocks at the same spots in stats.ts (normalP vs
the chi-square helpers), findings.ts (catch-model vs lavage finding)
and AGENTS.md; kept both. Restores the normalP assertions in
stats.test.ts now that both helpers are on one branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Luen
Luen merged commit fd49a64 into main Nov 3, 2026
5 checks passed
@Luen
Luen deleted the diet branch November 3, 2026 07:17
Luen added a commit that referenced this pull request Nov 3, 2026
main's squash of #109 is identical to the diet head this branch already
contains, so every conflict resolves to this branch's side; the tree is
unchanged from 9c66764.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Luen Luen mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analysis: diet, lavage and prey

1 participant