Trait data API
#103 (closed) adds support for declaring crop traits. In this ticket we add API support for trait data associated with Inventories
. One CropTraitObservation
record contains the summary (aggregate) data of individual CropTraitObservationData
records.
CropTraitObservation
Add API endpoint to retrieve a FilteredPage
of CropTraitObservation
records. Sorting is based on cropTraitObservation.inventory
should use inventory.id
by default.
The CropTraitObservationFilter
:
-
cropTraitId
: set ofCropTrait.id
-- these must beOR
-ed, must not benull
or empty. -
inventory
:InventoryFilter
-
methodId
: set ofMethod.id
-- these must beOR
-ed -
numericValue
:NumberFilter
-
stringValue
:StringFilter
-
cropTraitCodeId
: set ofCropTraitCode.id
UI friendly response
We need to discuss a friendly JSON response that will allow for quickly rendering the results as a table:
Inventory | Accession | Trait 1 | Trait 2 |
---|---|---|---|
INV 1 | A1 | null |
33 |
INV 4 | A2 | null |
12 |
INV 3 ** | A2 | Testing | 12 |
There will be multiple CropTraitObservation
s for one inventory + one trait, with different Method
.
One idea is to use this json:
{
"methods": [ { ...method1, ...method2 } ],
"cropTraits": [ { ...translatedCropTrait1, ...translatedCropTrait2 } ],
"observations": [
{ "i": Inventory, "o": [ { ...cropTraitObservation1, ...cropTraitObs2, ... } ] },
{ "i": Inventory, "o": [ { ...cropTraitObservation1, ...cropTraitObs2, ... } ] },
{ "i": Inventory, "o": [ { ...cropTraitObservation1, ...cropTraitObs2, ... } ] },
{ "i": Inventory, "o": [ { ...cropTraitObservation1, ...cropTraitObs2, ... } ] },
{ "i": Inventory, "o": [ { ...cropTraitObservation1, ...cropTraitObs2, ... } ] },
],
"filter": { ...cropTraitObservationFilter }
}
CropTraitObservationData
The same as above, just that the filter also contains:
-
cropTraitObservationId
: set ofCropTraitObservation.id