Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form schema in data.frame format to pass into form schema functions #33

Open
Ryo-N7 opened this issue Nov 25, 2022 · 3 comments
Open

Form schema in data.frame format to pass into form schema functions #33

Ryo-N7 opened this issue Nov 25, 2022 · 3 comments
Assignees

Comments

@Ryo-N7
Copy link
Collaborator

Ryo-N7 commented Nov 25, 2022

Update form schema in data.frame format and pass into the updateFormSchema() to update it. Not as much a priority as previous points as people can just get better at manipulating list objects but could be a useful functionality for all users not just AV.

@Ryo-N7
Copy link
Collaborator Author

Ryo-N7 commented Mar 28, 2023

workflow:

  1. change form schema to df view
  2. which will let me use mutate() to modify field elements (change description, etc.)
  3. change back into list-format
  4. upload new form schema back into db with updateFormSchema()

@nickdickinson
Copy link
Collaborator

Even slightly neater but with a little more code (TBD) would be to have a custom class extending data.frame so that it is recognized as a form schema and could contain some additional metadata in attributes. This could be fed it directly to updateFormSchema() without an additional conversion step.

@nickdickinson
Copy link
Collaborator

@jamiewhths @akbertram Is this something we still want to do?
This will create the table.

tibble(element = fmSchema$elements) %>% unnest_wider(element)

To go back to the form, we'd loop through the table records and call formFieldSchema() with the given parameters. Most checks are built in so it may not be too much work and probably we can call the arguments dynamically from the column names. Then we'd need to add a test or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants