DataTypes mapping discussion
Use case: As a BMS user I have some observation variables / traits of type Image/File and I want to automatically map them to variable type Image of Fieldbook when I load studies/traits using BrAPI.
BrAPI supported datatypes: https://github.com/plantbreeding/API/blob/V2.0/Specification/Components/Schemas/DataTypes.yaml
- Code
- Date
- Duration
- Nominal
- Numerical
- Ordinal
- Text
Field-book mapping: https://github.com/PhenoApps/Field-Book/blob/v5.0/app/src/main/java/com/fieldbook/tracker/brapi/service/BrAPIServiceV1.java
- Code -> text
- Nominal -> categorical
- Date -> date
- Numerical -> numeric
- Ordinal -> categorical
- Duration -> numeric
- Text -> text
The workaround right now is to load the traits as is and then manually change the type to image in the Fieldbook app.
Related:
- https://github.com/plantbreeding/API/issues/179
- https://github.com/plantbreeding/API/issues/283
I've discussed with a few people that there is a bit of a break between the data types that are being produced or collected and the collection layouts that are being used to facilitate that collection. There are a few things we could do to remedy this within Field Book but a server-side solution would be utilizing the additionalData field to add a preferredLayout parameter that the user or database administrator could set.
Just to make sure I understand, an example might be "preferredLayout":"NumberPad" and "dataType":"Text"
Something where the nature of input does not match the ontology variable type?
I would need more support from others in the BrAPI community before adding this kind of thing to the standard. From a technical perspective, its totally doable in the standard, it just seems highly specialized, and I want to make sure its useful for more than just you guys.
If I'm understanding everything correctly, it would pretty much just be a mutual custom augmentation of the current BrAPI spec with database people and field book people agreeing to the approach. Ignoring the additionalData: prferredLayout parameter could just result in current behavior.
Update on the ticket description: BMS no longer have traits of type image, we just associate images/files to observationunits and traits.
Also related: https://github.com/PhenoApps/Field-Book/issues/419: if implemented, the "mapping images" concern mentioned in this issue will no longer be relevant
Update from Oct 2022 Hackathon: per discussion on Slack, BrAPI needs to consider expanding the list of possible data types. OR do not provide a list of data types, allowing it to be an open string field. Either way, BrAPI data types and Field Book data types need to be aligned. Field Book has a more extensive list, BrAPI should consider adopting that list.