Skip to content

carwin/medication.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Medication.el

medication.el is an Emacs package for quickly capturing and logging ingested medications to an Org Mode file by supplying a capture template and some completing-read functions.

When a capture is begun, the user is presented with a list of medications followed by a list of common amounts in milligrams. Both lists can be customized.

While the package is intended for logging medication, there are no explicit guard rails in place to keep users from using it to log and keep track of whatever they want. Some alternative uses for this /package might include logging food or keeping track of nicotine intake.

Installation

Installation with use-package

Since this version of the package isn’t available on MELPA or any other package archive, users will need to point use package to the medication.el file after cloning it.

(use-package medication
  :load-path "path/to/files/medication.el"
  :config
  (require 'json))

Installation with straight.el

Installation with straight.el is a breeze, but requires a custom recipe until this package makes its way into a package archive like MELPA.

(straight-use-package
 '(medication
   :type git
   :host github
   :repo "carwin/medication.el"))

When using both straight.el and use-package, the configuration looks like this:

(use-package medication
  :straight (medication :type git :host github :repo "carwin/medication.el")
  :config
  (require 'json))

Usage

Usage is pretty straightforward, but it is important that the path to the log file (at least) is defined through the variable medication-log-file.

Customizing the list of medications

The package provides a default list of some over-the-counter drugs to choose from, this list can easily be customized by setting the medication-drug-log-drugs variable:

(setq medication-drug-log-drugs '("Panobinostat"
                                  "Solriamfetol"
                                  "Chicken Noodle Soup"
                                  "Lipitor"
                                  "Benadryl"))

Similarly, the common amounts list can be customized setting the variable medication-drug-log-amounts-mg:

(setq medication-drug-log-amounts-mg '("10mg"
                                       "20mg"
                                       "50mg"
                                       "100mg"
                                       "200mg"
                                       "1000mg"))

The medication log file will be populated with simple top-level Org Mode headlines, with new entries coming in on top. Each entry captures three properties: :WHAT:, :WHEN:, and :AMOUNT:.

* [2021-03-01 Mon 11:30] - Ibuprofin
:PROPERTIES:
:WHAT: Ibuprofin
:WHEN: [2021-03-01 Mon 11:30]
:AMOUNT: 200mg
:END:

From here, users can do whatever they’d like with the information. I like to use org-columns to create a table in my file like this:

#+title: Medication Logbook
#+startup: overview
#+columns: %when(Time) %what(Title) %amount(Amount)

#+BEGIN: columnview :hlines 1 :id global :skip-empty-rows t :indent t
| Time                   | Title         | Amount |
|------------------------+---------------+--------|
| [2022-05-16 Mon 01:51] | Ibuprofin     | 200mg  |
|------------------------+---------------+--------|
| [2022-05-15 Sun 17:42] | Melatonin     | 50mg   |
|------------------------+---------------+--------|
| [2022-05-12 Thu 10:09] | Multivitamin  | 100mg  |
|------------------------+---------------+--------|
#+END

From here you could do something interesting like make fancy graphs with gnuplot:

#+PLOT: ind:1 deps:(1) timefmt:"%Y-%m-%d" with:histograms set:"style fill solid 1 border lt -1" set:"style histogram cluster" set:"yrange [0:1000]"

About

Quickly log medication usage with Emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published