rparrish / redcap_tbs

This REDCap plugin displays formatted reports for individual records using the Tiny But Strong PHP template engine.
MIT License
5 stars 2 forks source link

REDCap TBS

The REDCap TBS plugin generates formatted reports for individual REDCap records using the Tiny But Strong PHP template engine. Template files can be written as HTML/CSS for layout and formatting. Word (.docx) template files can also be used.

How it works: The template file includes placeholder tags for REDCap field names. The TBS template engine replaces these tags with the actual values from REDCap for the specific record.

How it's used: REDCap TBS can be used to generated form letters with dynamic content based on REDCap variables. It can also be used to print the content of REDCap data collection instruments in a more concise format than the default PDF feature.

Requirements

Installation

Download the .zip archive and extract the redcap_tbs folder into the REDCap plugins folder (redcap/plugins/redcap_tbs/)

Initial Testing

The .docx templates depend on the OpenTBS plugin for TinyButStrong. Confirm that the installation is configured correctly by opening https://YOUR_SERVER/redcap/plugins/redcap_tbs/demo/index.php. Follow the prompts and use the OpenTBS documentation/support forums for further troubleshooting if necessary.

1. Add the Template Files

The template subfolder contains the template files. Template files must contain valid HTML/CSS or be a valid .docx file. Additional subfolders can be used to organize templates by project.

REDCap variables are inserted into the template content with this tag format [onshow.data.foo] where 'foo' is a REDCap Project field name.

This example uses a REDCap checkbox field-type named 'checkboxes' with three options (as shown below) and a record where the first and third option have been selected.

1, Check #1
2, Check #2
A, Check A

Show Checkmarks - Displays a checked box character next to the selected option and an empty box next to unselected options.

This TBS code block in HTML

    [onload.data.checkboxes___1;if [val]='Checked';then '&#9745';else '&#9744'] Check #1<BR>
    [onload.data.checkboxes___2;if [val]='Checked';then '&#9745';else '&#9744'] Check #2<BR>
    [onload.data.checkboxes___a;if [val]='Checked';then '&#9745';else '&#9744'] Check A<BR>

Will show something like this:

☑ Check #1
☐ Check #2
☑ Check A

Show Values - Displays the values when options are selected. This TBS code block in HTML

    [onload.data.checkboxes___1;if [val]='Checked';then 'Check #1';else '']
    [onload.data.checkboxes___2;if [val]='Checked';then 'Check #2';else '']
    [onload.data.checkboxes___a;if [val]='Checked';then 'Check A';else ''] Check A<BR>

Will show something like this:

Check #1, Check A

Additional information can be found on the [http://tinybutstrong.com/examples.php](TinyButStrong Examples) page and in the TinyButStrong [http://tinybutstrong.com/manual.php](Documentaion Manual).

2. Add a new Project Bookmark.

Feedback

You are welcome to:

Authors/Contributors