52 lines
1.3 KiB
Plaintext
52 lines
1.3 KiB
Plaintext
include "dropins";
|
|
include "utils";
|
|
|
|
import "lib/stringLib" as stringLib;
|
|
|
|
import "journalLib" as journalLib;
|
|
|
|
def formatExperienceTitle:
|
|
. as $experience |
|
|
"\"\(.title)\": \(.creationDate / 1000 | strftime("%d-%m-%Y"))";
|
|
|
|
def formatIngestionDose($customUnits):
|
|
. as $ingestion |
|
|
. | journalLib::calculateIngestionDose($customUnits) as $dose |
|
|
. | journalLib::ingestionUnit($customUnits) as $unit |
|
|
$customUnits | map(select(.id == $ingestion.customUnitId))[0] as $customUnit |
|
|
if $ingestion.dose == null then
|
|
"Unknown"
|
|
elif $customUnit == null then
|
|
"\($dose) \($unit)"
|
|
else
|
|
"\($dose) \($unit) (\($ingestion.dose) \($unit) * \($customUnit.dose) \($customUnit.unit))"
|
|
end;
|
|
|
|
def formatIngestionTime:
|
|
. as $ingestion |
|
|
$ingestion.time / 1000 | strftime("%a %I:%M %p");
|
|
|
|
def formatIngestionROA($customUnits; $substitutions):
|
|
. as $ingestion |
|
|
$ingestion.administrationRoute as $roa |
|
|
|
|
(if
|
|
$substitutions | has($roa)
|
|
then
|
|
$substitutions | .[$roa]
|
|
else
|
|
$roa | stringLib::titleCase
|
|
end) as $roaText |
|
|
|
|
$ingestion.customUnitId as $customUnitId |
|
|
|
|
if
|
|
$customUnitId == null
|
|
then
|
|
$roaText
|
|
else
|
|
$customUnits | map(select(.id == $customUnitId))[0] as $customUnit |
|
|
"\($roaText) (\($customUnit.name))"
|
|
end;
|
|
|
|
def formatIngestionROA($customUnits): formatIngestionROA($customUnits; {}); |