Best Practices for Entities Management

Creating more than one entity with a single form definition is something we hope to work on this fall or winter.

For now, you have three options that I can think of:

  1. Split your forms so that you have a farmer registration form and a plot registration form. If you're online, you'll be able to register the farmer, submit the form, update your forms, open the plot registration form, and select the farmer you just created. In a few months, you'll be able to do all of this offline so that all you have to do is register the farmer and then open the plot registration form. An alternative for now would be to copy or re-enter a value from the farmer registration in the plot registration form. For example, if phone numbers are unique and stable in your context, you could use those as a "natural id" for your farmers. You could use that to connect plots and farmers and later look them up. I wrote more about this in Entity Search with Multiple Geopoints - #2 by LN
  2. Capture redundant farmer information for each plot. For example, if all you need to know about a farmer is their phone number and a point for the farm entrance, you could have a single plots entity list and include the farmer information as properties on those. You'll capture duplicate information but if it's a small amount of data it likely won't matter. The downside here is that currently there isn't a good way to get a list of unique farmers from a structure like that.
  3. Flatten the sub-entity list into the parent entity. If you know the maximum number of plots that farmers are likely to have, you can flatten both the repeat in your form and the farm plots in the farmers entity list. For example, if you need to capture plot geometry and name for each plot, you can have properties named plot_geom1, plot_name1, plot_geom2, plot_name2, etc. This makes follow-up forms that need to do something with a single plot a little harder to author but it should be possible.

I would generally try to go with the first option if at all possible. It will make most kinds of follow-up forms easier to author and should encourage greater data integrity.

Big picture context

We don't expect users to need to know anything formal about data modeling or databases to be able to use Entities. For those who do know a little bit about those subjects, you'll recognize that this question relates to normalization and denormalization of data models. There are tradeoffs between the two!

1 Like