<!-- BEGIN outreach/data_summary.tt -->
[% # manipulate some immunology params:
immunology = outreach.immunology;
IF immunology.electrophoresis.result.match('Isotype undetermined');
immunology.electrophoresis.result = '';
END;
FOREACH param IN ['IgG' 'IgA' 'IgM'];
IF immunology.item(param).result;
IF immunology.item(param).result * 100 == immunology.item(param).default * 100;
immunology.item(param).result = '';
END;
END;
END;
IF immunology.paraprotein.result;
IF immunology.paraprotein.result * 100 == immunology.paraprotein.default * 100;
IF immunology.electrophoresis.result.match('Ig');
immunology.paraprotein.result = 'Unquantifiable';
ELSIF immunology.electrophoresis.result.match('No paraprotein');
immunology.paraprotein.result = '';
ELSE;
immunology.paraprotein.result = 'N/K';
END;
END;
END;
IF outreach.flow_cytometry.cd19_neg_pc.result;
IF outreach.flow_cytometry.cd19_neg_pc.result < 0.001;
outreach.flow_cytometry.cd19_neg_pc.result = '< 0.001';
ELSE;
outreach.flow_cytometry.cd19_neg_pc.result =
sig_figs(outreach.flow_cytometry.cd19_neg_pc.result);
END;
END;
IF outreach.calculated.abnormal_b_cells.result;
IF outreach.calculated.abnormal_b_cells.result < 0.01;
outreach.calculated.abnormal_b_cells.result = '< 0.01';
ELSE;
outreach.calculated.abnormal_b_cells.result =
sig_figs(outreach.calculated.abnormal_b_cells.result);
END;
END;
# abnormal B cells calculated so doesn't get value from default_and_ranges table:
outreach.calculated.abnormal_b_cells.units = outreach.haematology.wbc.units;
%]
[% BLOCK rows;
DEFAULT class = 'normal';
IF is_numerical(value.result); # no maths funcs unless numerical:
IF value.lower_flag && value.result < value.lower_flag; class = 'highlight';
ELSIF value.upper_flag && value.result > value.upper_flag; class = 'highlight';
END;
END;
%]
<td class="[% class %]" align="center">[% value.result %]</td>
<td align="center">
[% IF value.lower_limit; 10 * value.lower_limit / 10; END %] -
[% IF value.upper_limit; 10 * value.upper_limit / 10; END %]
</td>
<td>[% value.units.replace('10/9', '10<sup>9</sup>') %]</td>
[% END %]
<h5>Data summary:</h5>
<table class="indent borderless">
<tr>
<td valign="top">
<table class="outreachResults">
<tr>
<th scope="col">Param</th>
<th scope="col">Result</th>
<th scope="col">Range</th>
<th scope="col">Units</th>
</tr>
<tr>
<td class="label">Hb:</td>
[% INCLUDE rows value = outreach.haematology.hb %]
</tr>
<tr>
<td class="label">WBC:</td>
[% INCLUDE rows value = outreach.haematology.wbc %]
</tr>
<tr>
<td class="label">Plts:</td>
[% INCLUDE rows value = outreach.haematology.plts %]
</tr>
<tr>
<td class="label">Lymphs:</td>
[% INCLUDE rows value = outreach.haematology.lymphs %]
</tr>
<tr>
<td class="label">Total B:</td>
[% INCLUDE rows value = outreach.flow_cytometry.total_b_cells %]
</tr>
<tr>
<td class="label">Abnormal B:</td>
[% INCLUDE rows value = outreach.calculated.abnormal_b_cells %]
</tr>
<tr>
<td class="label">CD19<sup>-</sup> PC:</td>
[% INCLUDE rows value = outreach.flow_cytometry.cd19_neg_pc %]
</tr>
</table>
</td>
<td width="10"></td>
<td valign="top">
<table class="outreachResults">
<tr>
<th scope="col">Param</th>
<th scope="col">Result</th>
<th scope="col">Range</th>
<th scope="col">Units</th>
</tr>
<tr>
<td class="label">Creatinine:</td>
[% INCLUDE rows value = outreach.biochemistry.creatinine %]
</tr>
<tr>
<td class="label">Calcium:</td>
[% INCLUDE rows value = outreach.biochemistry.calcium %]
</tr>
<tr>
<td class="label">IgG:</td>
[% INCLUDE rows value = outreach.immunology.IgG %]
</tr>
<tr>
<td class="label">IgA:</td>
[% INCLUDE rows value = outreach.immunology.IgA %]
</tr>
<tr>
<td class="label">IgM:</td>
[% INCLUDE rows value = outreach.immunology.IgM %]
</tr>
<tr>
<td class="label">Electrophoresis:</td>
[% INCLUDE rows value = outreach.immunology.electrophoresis %]
</tr>
<tr>
<td class="label">Paraprotein:</td>
[% INCLUDE rows value = outreach.immunology.paraprotein %]
</tr>
</table>
</td>
</tr>
[% IF foo %]
<td class="header">[% field.replace('_', ' ') FILTER ucfirst %]:</td>
[% # field = field | lower # now lowercase field to match vals hashref %]
[% FOREACH entry IN vals.datasets %]
[% SET result = entry.$field ; SET default = ranges.$field.default %]
[% IF field.match('electrophoresis') && result.match('Isotype undetermined'); result = ''; END %]
[% IF result && default != '' && ( 10 * result ) == ( 10 * default) # if default value %]
[% IF field.match('Ig'); result = '' %]
[% ELSIF field.match('paraprotein') %]
[% IF entry.electrophoresis.match('Ig'); result = 'Unquantifiable' %]
[% ELSIF entry.electrophoresis.match('No paraprotein'); result = '' %]
[% ELSE; result = 'N/K'; END %]
[% ELSE; result = 'N/K'; END # 9.9 != 9.90, etc %]
[% END %]
[% # IF result.match('<') OR result.match('N/K') OR ! result; class = 'center' %]
[% SET class = 'center' # reset to default %]
[% IF is_num(result) # no maths funcs unless numerical: %]
[% IF ranges.item(field).flag_lower && result < ranges.item(field).flag_lower;
class = 'highlight' %]
[% ELSIF ranges.item(field).flag_higher && result > ranges.item(field).flag_higher;
class = 'highlight' %]
[% END %]
[% END %]
<td class="$class">[% # remove_me_to_test field ':' %]
[% result | html %]
</td>
[% END %]
[% IF ranges.$field.units %]
<td align="center">[% ranges.$field.lower_range %] - [% ranges.$field.upper_range %]</td>
<td>[% ranges.$field.units.replace('10/9', '10<sup>9</sup>') %]</td>
[% ELSE %]
<td colspan="2"> </td>
[% END %]
</tr>
[% END %]
</table>
<h5>Report table:</h5>
<!-- END outreach/data_summary.tt -->