Objective: Merging CRF Data Into a Custom Document/Report
TrialKit has the ability to define document templates for data review, memos, letters, or other purposes. Those documents can merge with form data intelligently based on where the report is merged from.
Where data can be merged
From the document editor - described below
From any Subject form - This automatically merges data for the current subject.
When a user has a form open and doing data entry or review, they can execute any pre-defined reports that have been made available to their role (read more about report configuration in the next section).
On Mobile App form toolbar:
On Web browser form toolbar:
If there is only one report available, it will automatically open as a PDF. If multiple reports are available to the current user, a list of reports will display to choose from.
Configuring Documents For Access To Users
Prerequisite
User has access to the Report Builder
Data Merge Documents can be configured on the web browser.
Tap “Edit” to open up an existing template, or “Create New” at the top to start a new one.
Define which role(s) should get access to the report from forms as described above.
Build the report document in the Rich text editor or via HTML. Use the data variables described below to declare which data to merge into the document for the selected subject
After saving, test it by selecting a site and subject from the panel on the right side.
Merge the report to create a document for the selected subject.
Variables to merge
The document editor displays a key of reporting codes that can be used to dynamically get specified data from the place where the report is executed from.
(Red text indicates user defined variables)
Use Constant - Display the subject ID
[!{'constant': {'name' : 'sub_profile_id'}}!]
Change Form - To declare which form to pull data from. Any variables placed after this must be from that form. See example above.
[!{'current form' : {'name' : 'ENTER FORM NAME HERE' , 'visit' : '-1'}}!]
Note: -1 in the string above means unscheduled visit. Scheduled Visit IDs can be found in the scheduled visits configuration.
Text Field - Any field from the form (field type does not matter)
[!{'field': {'name' : 'FIELD NAME'}}!]
Image Field - Any field on the form that contains a file. If the file is a PDF, it will be appended to the document.
[! {'image_field': {'field_name':'FieldName', 'width':'500', 'height':'300'}}!]
Table from One to Many Form (Repeating form) with interval included in table as column - This will list out all records, whether they are collected across visits or as log forms, with columns (fields) in the order defined
[!{'table': {'form_name' : 'FORMNAME', 'fields' : {'1' : 'FN_DATE', '2' : 'FN_REASON', '3' : 'PAINLEVEL', '4' : 'COMMENTS', '5' : 'interval_name'}}}!]
Table from a normalized table in a given form/visit
[!{'field': {'name' : 'NameofTable', 'fields' : {'1' : 'MHCAT', '2' : 'MHTERM', '3' : 'MHSTDT', '4' : 'MHENDT'}}}!]
Specialized Use cases for data merge
Sometimes it might be necessary to merge data from specific areas of the system. This section covers the supported scenarios.
When a field on one of the dependent forms contains an uploaded PDF file
If a form/field in the report is an upload field where users upload a PDF file. That file will be appended to the report PDF.
When the user runs the document merge from a form:
The system can determine if the current record being viewed has any direct relationships (form links) to other forms for the current subject, and then get the data from the current form’s Parent record. For example if a protocol deviation is logged from a follow up visit, the data merge for a document can get the related follow up visit data intelligently if the user is currently viewing the protocol deviation.
An application for this could be when a form is being adjudicated, the parent form of the adjudicated form can be quickly referenced from a report, alongside any other data necessary for the current subject.
To define it, use visit ID “-99” as follows by first declaring what the parent form name is:
[!{'current form' : {'name' : 'parentform' , 'visit' : '-99'}}!]
Followed by any field data necessary from that parent record. If the form where this script is run from does not have a parent, no data will get displayed. Based on that, this function should only be used for linked forms.