Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feed intake API #93

Closed
erwinspeybroeck opened this issue Apr 16, 2020 · 5 comments
Closed

feed intake API #93

erwinspeybroeck opened this issue Apr 16, 2020 · 5 comments
Labels
this-release Scheduled to be implemented for this release in development

Comments

@erwinspeybroeck
Copy link
Collaborator

erwinspeybroeck commented Apr 16, 2020

I'm talking with Lely about what information they have available in T4C about feed intake, and want to start with that to create a definition

previous work :

Feed intake event    
unique id of the event    
animalIdentifier = animal id + scheme  
location = location id + scheme  
eventDateTime   start date time of the feed intake
deviceId   the device where the measurement was done
visitDuration   how long did the feed intake take
sub resource consumed feed array of the individual feed types
feed type   the type of feed  - water is also considered to be a feed type
entitlement   the daily feed ration for this feed type + unit code
feed consumption   what the cow has eaten during this feed intake event + unit code
isConcentrate boolean  

Information from Lely - existing API structure

A. Lely has two types of feeding

  1. Feeding on fences distrubuted by vector device (mainly roughage but can also include concentrate/mineral in a ration)
  2. Feeding at astronaut device (concentrate/mineral)
    B. Corresponsing API Methods

There is the following method to get vector feeding info in API
HttpGet --> feedoverview
public class FeedOverviewParam
{
public int? LocationId;
public DateTime? Date;
public int? NrOfAnimals;
public int? KgMilk;
public int DryMatterTotal;
public int ProductTotal;
public int TotalFeedCost;
public List FeedTypes = new List(32);
}
public class VectorFeedTypeParam
{
public int FeedId;
public int TotalProduct;
public int TotalDryMatter;
public decimal FeedCost;
}
This method gives total intake (ProductTotal/gram) daily for the number of animals on a location.
It is also possible to get intake (TotalProduct/gram) feed based on a location.
2.
There is the following method to get astronaut feeding info in API
HttpGet --> feedvisits
public class FeedVisitParam
{
public int DeviceAddress;
public string LifeNumber;
public DateTime FeedDate;
public string FeedName;
public int? NumberOfFeedType;
public int? Credit;
public int? Intake;
}
This method gives total intake (Intake/gram) daily for an animal on a astronaut device for each feedtype.

@cookeac cookeac added the enhancement New feature or request label Aug 28, 2020
@erwinspeybroeck
Copy link
Collaborator Author

erwinspeybroeck commented Sep 24, 2020

Kor, Thomas and Erwin discussed the feeding API's. We planned a second meeting on 1/10.

We distinguish:

  • a feed resource
  • a ration resource (consisting of multiple feeds)
  • an individual feed intake event
  • a daily feed report on animal level
  • a daily feed report on group level (includes animal ids)
  • we plan a feed recommendation event

We created a proposal for:

GET feeds

id : uniquely defines the feed on the location
type: the type of the feed - we think of the following enum list (concentrate, minerals, fresh roughage, silaged roughage, other)
name: the name of the feed
percentage dry matter
property (array)

  • name : this depends on the local situation, e.g. in NL and BE we use VEM (voeder eenheid melk), DVE (darm verteerbaar eiwit), OEB (onbestendig eiwit balans), RE (ruw eiwitgehalte), ZET (zetmeel)
  • value
  • unit

GET ration

unique id for this ration
name of the ration given by the farmer
subresource contents (array)

  • feed id
  • percentage in the ration

GET feed intake

unique id of the event
animalIdentifier (id + scheme)
location (id + scheme)
eventDateTime = startDateTime of the feeding event
deviceId
visitDuration
OR
sub resource consumed feed

  • feed id
  • entitlement : the current feed ration for this feed + unit code
  • feed consumption : what the cow has eaten during this feed intake event + unit code

OR
ration id

  • entitlement : the current feed ration for this feed + unit code
  • feed consumption : what the cow has eaten during this feed intake event + unit code

looked on UNSPSC to see what feed types are mentioned there:
image
It looks like at UNSPSC there is not much to find - or am I looking at the wrong spot?

@cookeac cookeac added this-release Scheduled to be implemented for this release in development and removed enhancement New feature or request labels Sep 28, 2020
@thomasd-gea
Copy link
Contributor

thomasd-gea commented Oct 1, 2020

Additional ideas:

  • for feed intake event

    • remove ORs from the description
    • in general: can have mulitple feeds but only one ration referenced in event
  • for feeds

    • leave "properties" very open, but try to provide code list
  • daily feed report on animal level

    • same input as feed intake event (but no deviceId and multiple ration references)
    • eventDateTime references local time of location (but in UTC)
      • TBD: start of day or end of day? 01.06.2020 00:00:00.000Z VS 01.06.2020 23:59:59.999Z for a farm in GMT timezone
      • TBD: would result in e.g. 01.06.2020 02:00:00.000Z VS 02.06.2020 01:59:59.999Z for a farm in CEST
      • TBD: do we need Timezone info like "Europe/Berlin" or similar per location
  • feed report on group level (includes animal ids)

    • same as feed intake event (but list of animals instead of only one animal)
    • visitDuration could be optional but indicate how long the feed was available
  • daily feed recommendation resource- on animal level

    • unique id
    • location scheme/id
    • animal id/scheme/id
    • recommendationDateTime = date/time of creation of recommendation
    • startDateTime = date/time of the start of activate the recommendation
    • endDateTime (optional) = date/time of the end of the recommendation
    • list of feed with entitlement
    • list of rations with entitlements
    • TBD: The last recommendation wins? How to handle groups then? What if you want to combine recommendations? --> goes to a new issue bout group recommendations
      We now go for a recommendation on single animal level - group recommendations is provided by a number of single recommendations.

@thomasd-gea
Copy link
Contributor

From the discussion today:

  • FeedIntake is OK
  • Feed: we should use scheme/identifier for properties to be able to reference different standards
  • FeedReport
    • should be a resource, not an event
    • should define start/end date/time (preferably in UTC)
    • it might be helpful to have the timezone in the location (e.g. "Europe/Berlin") (see Add timezone to LocationResource #164)
  • FeedReport on group level is OK
  • FeedRecommendation
    • maybe have group recommendation for group feeding and individual recommendation for individual feeding?
    • most likely the amount should refer to the daily entitlement
    • we could also introduce a resource to model the amount of feed/ration that should be dispensed at a given date/time

@cookeac
Copy link
Collaborator

cookeac commented Oct 22, 2020

Finally listened to the recording and wrote up some minutes from the discussion that @thomasd-gea refers to.

@thomasd-gea
Copy link
Contributor

thomasd-gea commented Mar 11, 2021

I think we need to do some work on the following things, still. @erwinspeybroeck maybe we should finalize this in the near future?

  • one cannot define the time range for a feed report
    add reportStartDataTime and reportEndDateTime to the parameters

  • one cannot specifiy the animals that should be contained in a feed report (this might be something that will not easily fit in a URL param BTW)

/locations/{location-scheme}/{location-id}/feed-reports/animal/{scheme-id}/{animal-id}
or add parameters scheme+animal-id
and /locations/{location-scheme}/{location-id}/feed-reports/animal-set/{animal-set-id}

  • there is currently no endpoint to query the daily report. What parameters would it allow?
  • we still need to define what the daily report covers and maybe add additional fields (or remove e.g. "feedVisitDuration"?)

Remove the icarDailyFeedReport resource - if needed can be added later

Has been some time since we discussed this, but I think we should bring that to a state where it can be released... before the release, that is :) --> discussed it with Thomas, Kor and Erwin on 24/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
this-release Scheduled to be implemented for this release in development
Projects
None yet
Development

No branches or pull requests

3 participants