Skip to content

Commit

Permalink
Merge branch 'release/2.6.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbchase committed Sep 16, 2024
2 parents ae03b67 + 2b7bb45 commit edb3254
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 22 deletions.
36 changes: 36 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"title": "Auto-populate Fields",
"upload_type": "software",
"creators": [{
"name": "Chase, Philip B",
"affiliation": "University of Florida",
"orcid": "0000-0002-5318-9420"
},
{
"name": "Chesney, Kyle",
"affiliation": "University of Florida",
"orcid": "0000-0002-0479-7251"
},
{
"name": "Sai Pavan, Kamma",
"affiliation": "University of Florida",
"orcid": "0009-0004-4619-0409"
},
{
"name": "Bentz, Michael",
"affiliation": "University of Florida",
"orcid": "0000-0002-5790-4268"
}
],
"description": "Auto Populate Fields is a REDCap module that 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.",
"access_right": "open",
"license": "Apache-2.0",
"references": [
"PA Harris, R Taylor, BL Minor, V Elliott, M Fernandez, L O'Neal, L McLeod, G Delacqua, F Delacqua, J Kirby, SN Duda, REDCap Consortium, The REDCap consortium: Building an international community of software partners, J Biomed Inform. 2019 May 9 [doi: 10.1016/j.jbi.2019.103208]"
],
"keywords": [
"redcap",
"redcap external module",
"php"
]
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# auto_populate_fields 2.6.3 (released 2024-09-16)
- Add zenodo.json and update the authors block in config (@saipavan10-git, #67, #68)
- Fix #66 (@saipavan10-git, #66, #68)

# auto_populate_fields 2.6.2 (released 2024-09-03)
- Set a minimum PHP version of 7.4 (@saipavan10-git, #64, #65)
- Remove eval() from the module (@saipavan10-git, #64, #65)
Expand Down
12 changes: 8 additions & 4 deletions ExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function redcap_survey_page_top($project_id) {
global $elements;
// set the action_tag_class as it would be in the DataEntry context
foreach( $elements as &$element) {
$element['name'] ??=[];
$this->survey_APF_fields ??=[];
$i = array_search($element['name'], $this->survey_APF_fields);
if ( $i !== false ) {
// append to preserve existing tags. This can result in duplicate @DEFAULT action tags but there appear to be no affects from this
Expand Down Expand Up @@ -80,14 +82,15 @@ function setDefaultValues() {
// Temporarily overriding project metadata.
foreach ($Proj->metadata as $field_name => $field_info) {
// Overriding choice selection fields - checkboxes, radios and dropdowns.
if (!in_array($field_info['element_type'], array('checkbox', 'radio', 'select'))) {
$field_info['element_type'] ??= '';
if (!in_array($field_info['element_type'], ['checkbox', 'radio', 'select'])) {
continue;
}

if (!$options = parseEnum($Proj->metadata[$field_name]['element_enum'])) {
continue;
}

$options ??= [];
foreach (array_keys($options) as $key) {
// Replacing selection choices labels with keys.
$options[$key] = $key . ',' . $key;
Expand All @@ -96,7 +99,7 @@ function setDefaultValues() {
$Proj->metadata[$field_name]['element_enum'] = implode('\\n', $options);
}

$action_tags_to_look = array('@DEFAULT');
$action_tags_to_look = ['@DEFAULT'];

// Getting current record data, if exists.
if ($data = REDCap::getData($Proj->project['project_id'], 'array', $_GET['id'])) {
Expand Down Expand Up @@ -131,13 +134,14 @@ function setDefaultValues() {
}
else {
$arm = $Proj->eventInfo[$_GET['event_id']]['arm_num'];
$Proj->events[$arm]['events'] ??= [];
$events = array_keys($Proj->events[$arm]['events']);
}
}

$fields = empty($_GET['page']) ? $Proj->metadata : $Proj->forms[$_GET['page']]['fields'];
$entry_num = ($double_data_entry && $user_rights['double_data'] != 0) ? '--' . $user_rights['double_data'] : '';

$fields ??= [];
foreach (array_keys($fields) as $field_name) {
$field_info = $Proj->metadata[$field_name];
$misc = $field_info['misc'];
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.2
2.6.3
19 changes: 2 additions & 17 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,8 @@
},
"authors": [
{
"name": "Philip Chase",
"email": "pbc@ufl.edu",
"institution": "University of Florida - CTSI"
},
{
"name": "Taryn Stoffs",
"email": "tls@ufl.edu",
"institution": "University of Florida - CTSI"
},
{
"name": "Kyle Chesney",
"email": "kyle.chesney@ufl.edu",
"institution": "University of Florida - CTSI"
},
{
"name": "Sai Pavan Kamma",
"email": "saipavankamma@ufl.edu",
"name": "University of Florida CTS-IT",
"email": "CTSIT-REDCAP-MODULE-SUPPO@LISTS.UFL.EDU",
"institution": "University of Florida - CTSI"
}
],
Expand Down

0 comments on commit edb3254

Please sign in to comment.