BrAPI icon indicating copy to clipboard operation
BrAPI copied to clipboard

DataTypes mapping discussion

Open nahuel-soldevilla opened this issue 4 years ago • 5 comments

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

nahuel-soldevilla avatar Jun 30 '21 18:06 nahuel-soldevilla

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.

trife avatar Jul 26 '21 22:07 trife

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.

BrapiCoordinatorSelby avatar Jul 27 '21 17:07 BrapiCoordinatorSelby

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.

trife avatar Jul 27 '21 20:07 trife

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

nahuel-soldevilla avatar Apr 28 '22 17:04 nahuel-soldevilla

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.

BrapiCoordinatorSelby avatar Oct 26 '22 14:10 BrapiCoordinatorSelby