[% sites = hmrn_data.imaging; # PROCESS dumper.tt dump = sites %] [% imaging_opts = hmrn_data.maps.imaging_options; # PROCESS dumper.tt dump = imaging_opts %] [% BLOCK build_checkbox; # PROCESS dumper.tt dump = dataset; # 'dataset' defined locally in calling block IF cols; # have left & right nodal sites: IdL = imaging_opts.description.item(field _ '_left'); # table id for left-hand site IdR = imaging_opts.description.item(field _ '_right'); # table id for right-hand site ELSE; # single site: IdX = imaging_opts.description.item(field); END; site_opts = dataset.site_opts; # PROCESS dumper.tt dump = site_opts; # if data entry show all rows, otherwise just 'positive' rows: IF data_entry OR ( site_opts.item(IdL) OR site_opts.item(IdR) OR site_opts.item(IdX) ) %] [% IF NOT label; field | ucfirst; ELSE; label; END %]: [% IF cols %] [% IF data_entry %] [% ELSE; # just show checkbox images: imgL = site_opts.item(IdL) ? 'checked' : 'checkbox'; imgR = site_opts.item(IdR) ? 'checked' : 'checkbox'; %] [% END %] [% ELSE %] [% IF data_entry %] [% ELSE; img = site_opts.item(IdX) ? 'checked' : 'checkbox' %] [% END %] [% END %] [% END %] [% END %] [% BLOCK build_scan_form; # scan = ct or pet array_size = sites.${scan}.size || 0; %]

[% scan | upper %] scan [[% array_size %]]: [% div_name = "${scan}-scan"; INCLUDE site/snippets/toggleview.tt %]

[% IF array_size; # has previous data, display in read-only mode: FOREACH event IN sites.$scan; # PROCESS dumper.tt dump = d; INCLUDE hmrn/data/imaging_form.tt; END; END; # add form for new dataset: INCLUDE hmrn/data/imaging_form.tt scan_type = scan data_entry = 1 # triggers data entry fields ndatasets = array_size; # sets initial/followup options %]
[% END %]

Imaging data:

[% INCLUDE build_scan_form FOREACH scan IN ['ct' 'pet'] %]