adewg / ICAR

Standard messages and specifications for animal data exchange in livestock.
https://icar.org/
Apache License 2.0
49 stars 27 forks source link

Milk recording information on herd level #184

Closed erwinspeybroeck closed 2 years ago

erwinspeybroeck commented 3 years ago

Do we need this? One could calculate aggregated data based upon the animal data. But what we see : a number of herd management systems like to get the aggregated data from the MRO's because they don't want to explain (small) differences between MRO's overviews and HMS overviews.

MRO's sometimes also calculate herd KPI's that are not easy to calculate on animal data solely.

Data in scope: location-id and scheme date of milk recording number of animals (total, dry, sampled, ...) date of analysis of the samples average 24 hour kg milk, fat, protein, urea, lactosis, cellcount
average calving age average 305 productions (milk, fat, protein, lactosis) average lactation value - herd level KPI that CRV provides BSK (herd standard cow) - herd level KPI that CRV provides NO (net earnings) - herd level KPI that CRV provides ...

erwinspeybroeck commented 3 years ago

I'm thinking of 1 to 4 API's:

milk-recording-statistics {
location { id, scheme }, milk recording date, analysis date, counts [ name --> enum [MILK,SAMPLE,DRY] count ], averages [ ] groups [ ]

milk-recording-kpis {
location { id, scheme }, milk recording date, kpis[
indicator { id, scheme } name --> string value], calculationType and resolution ???

erwinspeybroeck commented 3 years ago

image

AndreasSchultzGEA commented 3 years ago

Erwin, does your proposal also cope the statistic-values for single animals? We are thinking of milking-averages calculated per day per animal.

cookeac commented 3 years ago

I had wondered about an alternative approach for herd/group statistics.

icarStatistic {
metric: string, // or enumeration, or scheme/id? count: integer, mean: number }

icarGroupStatistics { id : string, //UUID of course location: icarLocationIdentifier, recordingDate: icarDateTime, // or with a duration? A test day is a single date, but other things might be a period? groupType: icarStatisticGroupType, // enumeration - lactationNumber, daysInMilk, animalSet ... groupSpecifier { lactationNumber: integer, daysInMilkRangeMin : integer, daysInMilkRangeMax: integer, animalSet : icarAnimalSetResourceReference } statistics[] : icarStatistic // array of statistics; server decides what it provides }

GET /locations///test-day-statistics?group-type=... etc

erwinspeybroeck commented 3 years ago

Erwin, does your proposal also cope the statistic-values for single animals? We are thinking of milking-averages calculated per day per animal.

This proposal is really about herd level data. The proposal will contain an average of the day-production of all animals (in herd or group) on the test day. You would need an API like GET​/locations​/{location-scheme}​/{location-id}​/day-productions which would give you the day-productions of an animal or all animals in the location (herd).

cookeac commented 3 years ago

@erwinspeybroeck to review the above and suggest a draft PR for release 1.3.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

erwinspeybroeck commented 3 years ago

I will need to pick this up, but lack of time for the moment ...

erwinspeybroeck commented 3 years ago

I'd rather think of a test-day-statistics which gives statistics of the test day observations. This could include a statistics resource which migth be usable for other events that need statistics, and which may go over a period.

test-day-statistics { id : string, //UUID of course location: icarLocationIdentifier, recordingDate: icarDateTime groupId: refers to a group --> seperate API to define the groups? statistics = array of icarStatistics { metric: string, // or enumeration, or scheme/id? count: integer, mean: number } }

groups { id groupType: icarStatisticsGroupType, // enumeration - herd, lactationNumber, daysInMilk, animalSet ... groupSpecifier { lactationNumber: integer, daysInMilkRangeMin : integer, daysInMilkRangeMax: integer, animalSet : icarAnimalSetResourceReference} }

test-day-statistics?group-type= ... or test-day-statistics/group-type/type-id or test-day-statistics?animal-set= ...

erwinspeybroeck commented 2 years ago

A try to make it more generic

icarStatistics { id : unique identifier of this statistics record description : string to describe the contenct of these statistics - could be also an enum ( test day statistics, reproduction statistics, feeding statistics, ...) statisticsStartDate : Date (inclusive) for which the statistics are acalculated statisticsEndDate : Date (inclusive) for which the statistics are calculated Group array { groupType : string (or enum : herd, lactationNumber, daysInMilk, animalSet, ...) groupSpecifier { --to be filled according to groupType lactationNumberRangeMin: integer, lactationNumberRangeMax: integer, daysInMilkRangeMin : integer, daysInMilkRangeMax: integer, animalSet : icarAnimalSetResourceReference} } statistics array { description : string or enum (kg milk, scc, %fat, %protein, ...) metric : enum (average, sum, stdev, min, max, count) value : double } } }

erwinspeybroeck commented 2 years ago

Next iteration after working group meeting

icarStatistics { id : unique identifier of this statistics record location description or purpose: enum ( test day statistics, reproduction statistics, feeding statistics, ...) startDate : Date (inclusive) for which the statistics are calculated endDate : Date (inclusive) for which the statistics are calculated Group array { groupType : string (or enum : herd, lactationNumber, daysInMilk, animalSet, ...) denombinator : number of animal in the group groupSpecifier { --to be filled according to groupType lactationNumberRangeMin: integer, lactationNumberRangeMax: integer, daysInMilkRangeMin : integer, daysInMilkRangeMax: integer, animalSet : icarAnimalSetResourceReference} } statistics array { kpi or measure or metric: enum (animals, milk, scc, %fat, %protein, ...) unit : enum (KG, LT,…) aggregation : enum (average, sum, stdev, min, max, count) value : double } } }

erwinspeybroeck commented 2 years ago

can be viewed and evaluated in https://editor.swagger.io/?url=https://raw.githubusercontent.com/adewg/ICAR/erwinspeybroeck/url-schemes/managementURLScheme.json

cookeac commented 2 years ago

Resolved by #298

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.