Health::BladderDiary::GenTable - Create bladder diary table from entries
This document describes version 0.002 of Health::BladderDiary::GenTable (from Perl distribution Health-BladderDiary-GenTable), released on 2020-11-12.
Your bladder entries e.g. in `bd-entry1.txt` (I usually write in Org document):
0730 drink: 300ml type=water 0718 urinate: 250ml 0758 urinate: 100ml 0915 drink 300ml 1230 drink: 600ml, note=thirsty 1245 urinate: 200ml
From the command-line (I usually run the script from inside Emacs):
% gen-bladder-diary-table-from-entries < bd-entry1.txt | time | intake type | itime | ivol (ml) | ivol cum | icomment | urination time | uvol (ml) | uvol cum | urgency (0-3) | ucolor (0-3) | ucomment | |----------+-------------+-------+-----------+----------+----------+----------------+-----------+----------+---------------+--------------+----------+ | 07-08.00 | water | 07.30 | 300 | 300 | | 07.18 | 250 | 250 | | | | | | | | | | | 07.58 | 100 | 350 | | | | | 08-09.00 | | | | | | | | | | | | | 09-10.00 | water | 09.15 | 300 | 600 | | | | | | | | | 10-11.00 | | | | | | | | | | | | | 12-13.00 | water | 12.30 | 600 | 1200 | thirsty | 12.45 | 200 | | | | | | | | | | | | | | | | | | | total | | | 1200 | | | | 550 | | | | | | freq | | | 3 | | | | 3 | | | | | | avg | | | 400 | | | | 183 | | | | |
Produce CSV instead:
% gen-bladder-diary-table-from-entries --format csv < bd-entry1.txt > bd-entry1.csv
This module can be used to visualize bladder diary entries (which is more comfortable to type in) into table form (which is more comfortable to look at).
The input to the module is bladder diary entries in the form of text. The entries should be written in paragraphs, chronologically, each separated by a blank line. If there is no blank line, then entries are assumed to be written in single lines.
The format of an entry is:
<TIME> ("-" <TIME2>)? WS EVENT (":")? WS EXTRA
It is designed to be easy to write. Time can be written as hh:mm or just hhmm in 24h format.
hh:mm
hhmm
Event can be one of drink (or d for short), eat, urinate (or u or urin for short), poop, or comment (or c for short).
drink
d
eat
urinate
u
urin
poop
comment
c
Extra is a free-form text, but you can use word=text syntax to write key-value pairs. Some recognized keys are: vol, comment, type, urgency, color.
word
text
vol
type
urgency
color
Some other information are scraped for writing convenience:
/\b(\d+)ml\b/ for volume /\bu([0-9]|10)\b/ for urgency (1-10) /\bc([0-6])\b/ for clear to dark orange color (0=clear, 1=light yellow, 2=yellow, 3=dark yellow, 4=amber, 5=brown, 6=red)
Example drink entry (all are equivalent):
07:30 drink: vol=300ml 0730 drink 300ml 0730 d 300ml
Example urinate entry (all are equivalent):
07:45 urinate: vol=200ml urgency=4 color=light yellow comment=at home 0745 urin 200ml urgency=4 color=light yellow comment=at home 0745 u 200ml u4 c1 comment=at home
A urination entry is an entry with event urination (can be written as just u or urin). At least volume is required, can be written in ml unit e.g. 300ml or using vol key, e.g. vol=300. Example:
urination
300ml
vol=300
1230 u 200ml
You can also enter color, using color=NAME or c0..c6 for short. These colors from 7-color-in-test-tube urine color chart is recommended: https://www.dreamstime.com/urine-color-chart-test-tubes-medical-vector-illustration-image163017644 or https://stock.adobe.com/images/urine-color-chart-urine-in-test-tubes-medical-vector/299230365:
color=NAME
c0
c6
0 - clear 1 - light yellow 2 - yellow 3 - dark yellow 4 - amber 5 - brown 6 - red
Example:
1230 u 200ml c2
You can also enter urgency information using urgency=NUMBER or u0..u10, which is a number from 0 (not urgent at all) to 10 (most urgent).
urgency=NUMBER
u0
u10
1230 u 200ml c2 u4
A drink (fluid intake) entry is an entry with event drink (can be written as just d). At least volume is required, can be written in ml unit e.g. 300ml or using vol key, e.g. vol=300.
1300 d 300ml
You can also input the kind of drink using type=NAME. If type is not specified, water is assumed. Example:
type=NAME
water
1300 d 300ml type=coffee
voiding diary, bladder diary
Usage:
gen_bladder_diary_table_from_entries(%args) -> [status, msg, payload, meta]
Create bladder diary table from bladder diary entries.
This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
entries* => str
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
Please visit the project's homepage at https://metacpan.org/release/Health-BladderDiary-GenTable.
Source repository is at https://github.com/perlancar/perl-Health-BladderDiary-GenTable.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Health-BladderDiary-GenTable
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2020 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Health::BladderDiary::GenTable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Health::BladderDiary::GenTable
CPAN shell
perl -MCPAN -e shell install Health::BladderDiary::GenTable
For more information on module installation, please visit the detailed CPAN module installation guide.