diff --git a/data-entry-steps.txt b/data-entry-steps.txt new file mode 100644 index 0000000..e37383f --- /dev/null +++ b/data-entry-steps.txt @@ -0,0 +1,118 @@ +# AnimalTrack Data Entry Steps +# Based on data.txt historical records +# Petre's duck and goose flock + +## Prerequisites +- Ensure you have at least one location set up in AnimalTrack + +## Step 1: Initial Duck Flock (13.02.2025) +Action: Create Cohort +- Species: duck +- Life stage: adult +- Origin: purchased (or unknown) +- Sex: female, Count: 35 +Repeat for males: +- Sex: male, Count: 6 +Notes: "Initial flock - 41 ducks total, 1 noted as adult drake" + +## Step 2: Initial Chinese Geese (13.02.2025) +Action: Create Cohort +- Species: goose +- Life stage: adult +- Origin: unknown +- Sex: unknown, Count: 3 +Notes: "Chinese geese - existed before tracking started" + +## Step 3: Gift - 2 Female Ducks (27.04.2025) +Action: Record Outcome +- Filter: species:duck sex:female status:alive +- Select: 2 animals +- Outcome: sold +Notes: "gift" + +## Step 4: Harvest - 4 Male Ducks (12.05.2025) +Action: Record Outcome +- Filter: species:duck sex:male status:alive +- Select: 4 animals +- Outcome: harvest + +## Step 5: Hatch - 13 Ducklings (15.06.2025) +Action: Record Hatch +- Species: duck +- Hatched live: 13 +- Location: [your duck area] + +## Step 6: Put Down - 1 Weak Female Duck (27.06.2025) +Action: Record Outcome +- Filter: species:duck sex:female status:alive +- Select: 1 animal +- Outcome: death +Notes: "weak, put down" + +## Checkpoint 27.06.2025 +Expected state: 34 adult ducks (32 female, 2 male) + 13 ducklings + +## Step 7: Found Dead - 1 Female Duck (22.07.2025) +Action: Record Outcome +- Filter: species:duck sex:female status:alive life_stage:adult +- Select: 1 animal +- Outcome: death +Notes: "found dead" + +## Step 8: Harvest - 8 Female Ducks (25.07.2025) +Action: Record Outcome +- Filter: species:duck sex:female status:alive life_stage:adult +- Select: 8 animals +- Outcome: harvest + +## Step 9: Harvest - 10 Female Ducks (06.08.2025) +Action: Record Outcome +- Filter: species:duck sex:female status:alive life_stage:adult +- Select: 10 animals +- Outcome: harvest +Notes: "After this: 14 female + 2 male adults + 13 ducklings" + +## Step 10: Purchase - 4 Toulouse Goslings (04.08.2025) +Action: Create Cohort +- Species: goose +- Life stage: hatchling +- Origin: purchased +- Sex: unknown, Count: 4 +Notes: "Toulouse goslings from OLX (Oia)" + +## Step 11: Harvest - 3 Chinese Geese (08.10.2025) +Action: Record Outcome +- Filter: species:goose status:alive +- Select: 3 animals (the Chinese geese) +- Outcome: harvest +Notes: "All Chinese geese harvested, 4 Toulouse remain" + +## Step 12: Predator Loss - 2 Geese (19.10.2025) +Action: Record Outcome +- Filter: species:goose status:alive +- Select: 2 animals +- Outcome: predator_loss + +## Step 13: Predator Loss - 1 Female Duck (19.12.2025) +Action: Record Outcome +- Filter: species:duck sex:female status:alive +- Select: 1 animal +- Outcome: predator_loss + +## Step 14: Predator Loss - 2 Ducks (25.12.2025) +Action: Record Outcome +- Filter: species:duck status:alive +- Select: 2 animals (1 female, 1 male) +- Outcome: predator_loss + +## Final State (25.12.2025) +- 27 ducks (mix of original adults + grown June hatchlings) +- 2 Toulouse geese + +## Note on Ducklings Sex +The 13 ducklings from June need their sex updated once you know. +After they mature, use: +Action: Update Attributes +- Filter: species:duck life_stage:hatchling status:alive +- Update life_stage to: adult +- For known females/males, update sex accordingly diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..9a5eeb9 --- /dev/null +++ b/data.txt @@ -0,0 +1,14 @@ +41 ducks, 1 adult drake 13.02.2025 +-2 female ducks 27.04.2025 gift +-4 male ducks 12.05.2025 harvest ++13 ducklings 15.06.2025 +-1 weak female duck 27.06.2025 put it down +34 adult ducks of which 2 drakes, 27.06.2025 +-1 female duck, found dead, 22.07.2025 +-8 female ducks, 25.07.2025 harvest +-10 female ducks 6.08.2025 harvest; 15 adults (14 female 2 male) + 13 ducklings left ++4 goslings 4.08.2025 bought from OLX (Oiã) +-3 Chinese geese 08.10.2025 harvest (0 chinese and 4 toulouse goslings left) +-2 geese predator 19.10.2025 +-1 female duck predator 19.12.2025 +-2 ducks (1 female and 1 male) predator 25.12.2025 diff --git a/nits b/nits new file mode 100644 index 0000000..3dcd1b8 --- /dev/null +++ b/nits @@ -0,0 +1,5 @@ +Animal detail slider, event timeline, I want to be able to click on events and go to a detail view about them. + +Create animal cohort form, click button, succeeds, comes back to the same form when successful. There should be a notification that it worked and link to detail view of the event created. Audit all other forms for this. + +If I want to sell 2 ducks matching "species:duck sex:female status:alive", how do I do it? The record outcome form says 35 animals selected if I use that filter. diff --git a/src/animaltrack/web/routes/events.py b/src/animaltrack/web/routes/events.py index 436eaa6..aafa355 100644 --- a/src/animaltrack/web/routes/events.py +++ b/src/animaltrack/web/routes/events.py @@ -121,12 +121,12 @@ def get_event_animals(db: Any, event_id: str) -> list[dict[str, Any]]: """ rows = db.execute( """ - SELECT ar.id, ar.nickname, s.name as species_name + SELECT ar.animal_id, ar.nickname, s.name as species_name FROM event_animals ea - JOIN animal_registry ar ON ar.id = ea.animal_id + JOIN animal_registry ar ON ar.animal_id = ea.animal_id JOIN species s ON s.code = ar.species_code WHERE ea.event_id = ? - ORDER BY ar.nickname NULLS LAST, ar.id + ORDER BY ar.nickname NULLS LAST, ar.animal_id """, (event_id,), ).fetchall()