NAME
Health::BladderDiary::GenChart - Create bladder diary table from entries
VERSION
This document describes version 0.001 of Health::BladderDiary::GenChart
(from Perl distribution Health-BladderDiary-GenChart), released on
2020-12-11.
SYNOPSIS
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
DESCRIPTION
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).
Diary entries
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.
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).
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".
Some other information are scraped for writing convenience:
/\b(\d+)ml\b/ for volume
/\bv(\d+)\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
Urination entries
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 "vNUMBER" e.g. "v300", or using "vol" key,
e.g. "vol=300". Example:
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-me
dical-vector/299230365>:
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). Example:
1230 u 200ml c2 u4
Drink (fluid intake) entries
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 "vNUMBER" e.g. "v300", or using "vol" key,
e.g. "vol=300". Example:
1300 d 300ml
You can also input the kind of drink using "type=NAME". If type is not
specified, "water" is assumed. Example:
1300 d 300ml type=coffee
Eat (food intake) entries
The diary can also contain food intake entries. Currently volume or
weight of food (or volume of fluid, by percentage of food volume) is not
measured or displayed. You can put comments here for more detailed
information. The table generator will create a row for each food intake,
but will just display the time, type ("food"), and comment columns.
KEYWORDS
voiding diary, bladder diary
FUNCTIONS
gen_bladder_diary_chart_from_entries
Usage:
gen_bladder_diary_chart_from_entries(%args) -> [status, msg, payload, meta]
Create bladder chart from bladder diary entries.
This function is not exported.
Arguments ('*' denotes required arguments):
* date* => *date*
* entries* => *str*
* yesterday_last_urination_entry => *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)
HOMEPAGE
Please visit the project's homepage at
<
https://metacpan.org/release/Health-BladderDiary-GenChart>.
SOURCE
Source repository is at
<
https://github.com/perlancar/perl-Health-BladderDiary-GenChart>.
BUGS
Please report any bugs or feature requests on the bugtracker website
<
https://github.com/perlancar/perl-Health-BladderDiary-GenChart/issues>
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.
SEE ALSO
AUTHOR
perlancar <
[email protected]>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by
[email protected].
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.