ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨
Why is this the best possible solution? Were any other approaches considered?
I'd initially wanted to implement this by just executing a dynamically built XPath expression, but this proved tricky as JavaRosa currently doesn't attach secondary instances that aren't referenced by an instance expression. This would mean that a form that contained only a pulldata referencing an entity list wouldn't work (as the external instance would never be parsed and attached to the main instance). We'll look to move to the originally intended implementation in the next release as part of https://github.com/getodk/collect/issues/6454.
Instead, I've ended up using the LocalEntityInstanceAdapter in a similar way to LocalEntityFilterStrategy with modifications so that it now supports querying any child of an entity item (like label for example). This new support doesn't add anything significant in the way of optimisation however: queries for children like label work by just loading every entity in the list from the DB and then performing an in-mem filter. This limits the amount of work we do to just support pulldata.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
The big risks here will be to all pulldata forms (including ones that use with entities obviously) and to entity filters in forms in general.
One thing to note: I've not extended the instance "normalising" that pulldata does to entity lists. For normal secondary instances, pulldata would let you use the wrong case for the name or add .csv to the end. We'll discuss if we want to maintain this (currently undocumented) behaviour separately.
Before submitting this PR, please make sure you have:
[x] added or modified tests for any new or changed behavior
[x] run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
[x] added a comment above any new strings describing it for translators
[x] added any new strings with date formatting to DateFormatsTest
[x] verified that any code or assets from external sources are properly credited in comments and/or in the about file.
Closes #6443
Blocked by https://github.com/getodk/javarosa/pull/802Why is this the best possible solution? Were any other approaches considered?
I'd initially wanted to implement this by just executing a dynamically built XPath expression, but this proved tricky as JavaRosa currently doesn't attach secondary instances that aren't referenced by an
instance
expression. This would mean that a form that contained only apulldata
referencing an entity list wouldn't work (as the external instance would never be parsed and attached to the main instance). We'll look to move to the originally intended implementation in the next release as part of https://github.com/getodk/collect/issues/6454.Instead, I've ended up using the
LocalEntityInstanceAdapter
in a similar way toLocalEntityFilterStrategy
with modifications so that it now supports querying any child of an entity item (likelabel
for example). This new support doesn't add anything significant in the way of optimisation however: queries for children likelabel
work by just loading every entity in the list from the DB and then performing an in-mem filter. This limits the amount of work we do to just supportpulldata
.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
The big risks here will be to all
pulldata
forms (including ones that use with entities obviously) and to entity filters in forms in general.One thing to note: I've not extended the instance "normalising" that
pulldata
does to entity lists. For normal secondary instances,pulldata
would let you use the wrong case for the name or add.csv
to the end. We'll discuss if we want to maintain this (currently undocumented) behaviour separately.Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still passDateFormatsTest