Skip to contents

Genetic-Health Trends Module - Server Function

Usage

modSnapshotTrendsServer(id, snapshotSource, fullPedigree = reactive(NULL))

Arguments

id

character vector of length 1. Module namespace identifier.

snapshotSource

reactive returning list(ped, geneticValue, guIter, guThresh) from the most recent Genetic Value Analysis run (see modGeneticValueServer's snapshotSource return element), or erroring (shiny req() semantics) before any run has happened.

fullPedigree

reactive returning the full quality-controlled pedigree (the Pedigree tab's processedPedigree, never the focal-trimmed analysisPedigree, which would shrink every past population), or erroring (shiny req() semantics) before a studbook is loaded. Feeds the "Build Earlier Snapshots" box. Defaults to reactive(NULL): no pedigree, so the box waits.

Value

A list with reactive components:

  • history - the current validated snapshot history (or NULL before any upload or generation).

  • deltas - the current delta comparison (see calcSnapshotDeltas), keyed off the sidebar's rule/from/ to selectors.

  • isReady - logical: TRUE once history is non-NULL (a history has been uploaded or generated).

  • backfillSupport - the table of what each date of the default earlier-snapshot series rests on (previewBackfillSupport of fullPedigree()), independent of the chosen start year; erroring (req()) until a pedigree is loaded.

The "Build Earlier Snapshots" button calls backfillColonySnapshots with the full pedigree, the guIter, guThresh and reportArgs of snapshotSource(), the chosen start year and the history already held, and adds nothing of its own to the numbers. It does nothing before an analysis has run. Warnings from the build are summarized in one notification; a failure is reported and leaves the history as it was.

The generated snapshot's membershipRule is auto-derived from snapshotSource()$ped$population (issue #167 Slice 4, S760 owner decision): "focalPopulation" when the analyzed pedigree's population column excludes any animal, "wholePedigree" otherwise – truthful by construction from what reportGV() actually analyzed, never a user-set dropdown that could contradict the data and hit createColonySnapshot's stop(). The delta comparison keeps a user-facing rule selector, populated from the uploaded/generated history's own membershipRule values.

A checkSnapshotHistory violation on a malformed history upload surfaces as a notification (module-contract rule 5: this is not the same seam as inter-module malleability – the specific violation is shown, not disguised as "no data yet") and leaves the current history unchanged.