{"id":19713360,"url":"https://github.com/ctsit/auto_populate_fields","last_synced_at":"2025-04-29T18:31:09.433Z","repository":{"id":49069796,"uuid":"101102388","full_name":"ctsit/auto_populate_fields","owner":"ctsit","description":"This REDCap Module provides rich control of default values for data entry fields via a set of action tags. These action tags allow fields to be populated based on values from an ordered list of fields and static values. The fields can be read from the current event or the previous event in longitudinal projects.","archived":false,"fork":false,"pushed_at":"2024-09-23T16:01:50.000Z","size":236,"stargazers_count":14,"open_issues_count":9,"forks_count":12,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-05T18:52:08.434Z","etag":null,"topics":["redcap","redcap-external-module","redcap-repo"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctsit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-22T20:01:10.000Z","updated_at":"2025-03-20T22:19:11.000Z","dependencies_parsed_at":"2024-09-17T01:27:31.054Z","dependency_job_id":"af7f7224-78f3-4e41-a963-c82644803393","html_url":"https://github.com/ctsit/auto_populate_fields","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctsit%2Fauto_populate_fields","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctsit%2Fauto_populate_fields/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctsit%2Fauto_populate_fields/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctsit%2Fauto_populate_fields/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctsit","download_url":"https://codeload.github.com/ctsit/auto_populate_fields/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251559842,"owners_count":21609085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["redcap","redcap-external-module","redcap-repo"],"created_at":"2024-11-11T22:21:14.295Z","updated_at":"2025-04-29T18:31:09.102Z","avatar_url":"https://github.com/ctsit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REDCap Auto-Populate Fields\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3561116.svg)](https://doi.org/10.5281/zenodo.3561116)\n\nThis REDCap module provides rich control of default values for data entry fields via a set of action tags. These action tags allow fields to be populated based on values from an ordered list of fields and static values. The fields can be read from the current event or the previous event in longitudinal projects.\n\n## Prerequisites\n- REDCap \u003e= 14.0.2\n- PHP \u003e= 7.4\n\n## Installation\n- Clone this repo into to `\u003credcap-root\u003e/modules/auto_populate_fields_v2.2`.\n- Go to **Control Center \u003e Manage External Modules** and enable Auto Populate Fields.\n- For each project you want to use this module, go to the project home page, click on **Manage External Modules** link, and then enable Auto Populate Fields for that project.\n\n## Features included\n\n### Default when visible\nBy default, when a field that is hidden by branching logic contains a `@DEFAULT` action tag, an annoying alert is displayed on page load.\n\u003e ERASE CURRENT VALUE OF FIELD \"\u003cfield_name\u003e\"?\n\nThis module changes the default branching logic behavior in order to avoid that. Now, when some non-empty field gets hidden by branching logic, no more warning messages are shown - instead, the hidden value persists available until form submission, when it is finally erased.\n\n### Choice key piping on @DEFAULT\nThis module changes the display of selection fields when they are referenced in `@DEFAULT` action tags - instead of the label, the key is returned. Example: let's say we have a dropdown field called `animals`, whose options are:\n```\n1,Lion\n2,Monkey\n```\nIf we define somewhere `@DEFAULT=\"[animals]\"`, the returned value will be `1` (instead of \"Lion\") or `2` (instead of \"Monkey\").\n\n\n### New action tags\nThis module provides 2 new [action tags](https://wiki.chpc.utah.edu/pages/viewpage.action?pageId=595001400):\n\n#### @DEFAULT_\\\u003cN\\\u003e\nProvides the possibility to define secondary, tertiary, etc default values. If `@DEFAULT` returns an empty value, the next tag available - let's say `@DEFAULT_1` - is checked. If `@DEFAULT_1` returns empty, the next tag available - let's say `@DEFAULT_2` - is checked, and so on. This is useful when a fallback value is needed for piping (e.g. `@DEFAULT=\"[first_name]\" @DEFAULT_1=\"Joe Doe\"`).\n\n#### @DEFAULT-FROM-PREVIOUS-EVENT\nSets a field's default value based on its own value in a previous event. To map the default value from another field, you may specify the source field name as a parameter to the action tag, e.g `@DEFAULT-FROM-PREVIOUS-EVENT=\"source_field\"`. Analogously to `@DEFAULT_\u003cN\u003e`, `@DEFAULT-FROM-PREVIOUS-EVENT_\u003cN\u003e` is also provided.\n\nIf your events are not necessarily arranged in a chronological order, you can enable an option to auto-detect the last chronological event. To do that, go to your project page, then access External Modules (at the left sidebar), and then click on Auto Populate Fields configuration button:\n\n![Default from previous event configuration](img/default_from_previous_event_config.png)\n\n### Mixing @DEFAULT_\\\u003cN\\\u003e and @DEFAULT-FROM-PREVIOUS-EVENT_\\\u003cN\\\u003e\n\nWhen using `@DEFAULT_\u003cN\u003e` and `@DEFAULT-FROM-PREVIOUS-EVENT_\u003cN\u003e` together, using unique numbers on each action tag to ensure the desired precedence. E.g.\n\n    @DEFAULT-FROM-PREVIOUS-EVENT_1='initial_dose'\n    @DEFAULT-FROM-PREVIOUS-EVENT_2=intermediate_dose\n    @DEFAULT-FROM-PREVIOUS-EVENT_3=\"final_dose\"\n    @DEFAULT_4=\"7\"\n\nIn the above example `initial_dose` from the previous event will be used. Lacking that, `intermediate_dose` will be used. If none of `initial_dose`, `intermediate_dose`, and `final_dose` have been set, the value of 7 will be used.\n\nNote that `@DEFAULT` is synonymous with `@DEFAULT_0`.  Similarly `@DEFAULT-FROM-PREVIOUS-EVENT` is synonymous with `@DEFAULT-FROM-PREVIOUS-EVENT_0`.\n\nNote that the square brackets, `[]` common to REDCap piping are neither required nor supported in `@DEFAULT-FROM-PREVIOUS-EVENT` and `@DEFAULT-FROM-PREVIOUS-EVENT_\u003cN\u003e`. They _are_ required in `@DEFAULT_\u003cN\u003e` just like `@DEFAULT`.\n\n## Considerations\n\nPlease note that when using **Enable chronological previous event detection**, deleting data from a form might change the expected behavior of auto-population. \n\nThough the data is erased, the null value written to the record is still a legitimate value that could be copied to next event filled in. This will only occur in new data entry if the last event in the sequence was deleted. Note that \"sequence\" here refers to chronological order.\n\nFor example, if data is keyed into the _wrong_ event and deleted, the data will not auto-populate when the correct event is opened. That said, if you open the correct event _before_ deleting the data from the wrong event, the data keyed into the wrong event will auto-populate into the correct event. \n\n## Example\n\nAn example project that demonstrates some of the features of this module is available in the [examples](examples/) folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctsit%2Fauto_populate_fields","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctsit%2Fauto_populate_fields","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctsit%2Fauto_populate_fields/lists"}