Tangerine-Community / Tangerine

Digitize your offline data collection. Create your Forms online with Tangerine Editor, conduct them offline with the Tangerine Android App. All results you collect can be exported as a CSV file, easy for processing in a spreadsheet. Tangerine has been used in over 1 million assessments and surveys in over 60 countries and in 100 languages.
http://www.tangerinecentral.org/
GNU General Public License v3.0
50 stars 29 forks source link

Input Widget for Dynamic Addition to a List #3729

Open esurface opened 2 months ago

esurface commented 2 months ago

The Location List widget is useful in scenarios for selecting from a static hierarchy. In many cases, a dynamic list is preferable. We will create a new input widget called "Dynamic List" which can be used to dynamically updating an existing "List". One of the big changes will be renaming "location-list" to "list" or "list-item".

The (eventual) process for creating a dynamic list will be:

  1. The "List" must be defined first on the server UI, including set up of levels and metadata.
  2. Optionally add items to the list in the server UI
  3. The list creator chooses whether the list is dynamic (or not)
  4. The form editor adds the List to a form and configures it to be dynamic (or not)
  5. During the form response entry:
    • The list appears with the levels available for selection
    • The lowest-level is searchable
    • The lowest-level can take entry of a "new" item, with metadata
  6. Items created on a tablet will sync up to the server
  7. The Editor shows warning if the same list-item appears in the same hierarchy on the lowest-level

Database Updates

There is a significant change required to the way lists are stored to make this possible. Lists are currently stored as a static json doc. This needs to change to be stored as couchdb docs.

Requirements:

  1. Keep the "levels" and "metadata" definitions in the json doc and rename them from "location-list.json" to "list-xyz.json"
  2. Move the "locations" definitions from the json doc into couchdb -- each "location" will be renamed to "list-item"
  3. Use smart doc IDs for the the list docs -- for example: "_id": "list-xzy-<item-id>"
    • The best solution will not require any indexes in couchdb
    • Each list item will have a unique id
    • The list-item label should be in the _id, sanitized and searchable
    • Sanitized metadata could possibly be searchable as well

Caveats

  1. The default List will be the "location-list.json" and it will not change (for now)
  2. This feature is only for v4+
esurface commented 2 months ago

@evansdianga

  1. Helps with versioning (based on revs) to allow list-items to be more flexible
  2. Reconciliation (like google docs)