Skip to content

Add a Pregnant field to the animal snapshot panels - #34

Merged
labkey-martyp merged 4 commits into
release26.7-SNAPSHOTfrom
26.7_fb_pregnant_field
Sep 4, 2026
Merged

Add a Pregnant field to the animal snapshot panels#34
labkey-martyp merged 4 commits into
release26.7-SNAPSHOTfrom
26.7_fb_pregnant_field

Conversation

@labkey-martyp

Copy link
Copy Markdown
Contributor

Rationale

Adds a Pregnant field to the animal snapshot so staff can see at a glance whether a female is carrying an open conception, without opening the conception records to check.

A conception is open until a birth or a pregnancy outcome claims it, which no existing column expressed, so the field is backed by a new derived flag on the conception record. That flag is also useful on its own and is surfaced on the conceptions-by-dam report.

Related Pull Requests

None.

Changes

  • Conception records carry a derived active flag marking the ones no birth or pregnancy outcome has claimed, and it appears on the conceptions-by-dam report alongside the outcome.
  • The snapshot and Animal Details panels show a Pregnant field listing each open conception as a link to its record, or "No" when there are none.
  • The dam's cached demographics are refreshed whenever a conception is entered, re-pointed or removed, and whenever a birth closes or reopens one. Previously only a pregnancy outcome refreshed her, so the field could show a stale value indefinitely.
  • The outcome report no longer counts birth or pregnancy records whose status is explicitly non-public.
  • Removed the Prev Id field from the snapshot panel.
  • Test coverage for the field and the flag across the birth, conception and pregnancy flows.

Pregnant lists an animal's active conceptions, each linking to its conception record, and reads No when there are none. A conception is active until a public birth or pregnancy outcome record claims its conception Id, now exposed as isActive on nbri_ehr.Conception and reused by ConceptionsByDam.

Also drops the Prev Id field, which nothing ever populated.
Query XML cannot position a customizer-added column, since the customizer runs after the column reorder, so isActive places itself from the customizer instead.

NBRI_EHRTest now asserts isActive and the dam's Pregnant field across all three states, including the birth that closes a conception and clears the dam.
Conception has no Id column and a birth row announces the newborn, so the dam's cached Pregnant value was never recomputed.
A pregnancy outcome announces only its own Id, which is the dam just when the record was entered against her, so re-pointing, clearing or deleting one left the affected dam holding a stale cached Pregnant value. Also skips dam resolution on validation passes in the conception trigger, and guards isActive against a missing QCState column.
@labkey-martyp
labkey-martyp merged commit 1f1e76e into release26.7-SNAPSHOT Sep 4, 2026
1 check failed
@labkey-martyp
labkey-martyp deleted the 26.7_fb_pregnant_field branch September 4, 2026 21:02
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.

2 participants