API Reference Memorex v0.2.2



Memorex is a Phoenix LiveView application for drilling/reviewing flashcards via a spaced-repetition system.

Functions for interacting with Memorex.Domain.CardLogs.

Functions for interacting with Memorex.Domain.Cards.

A struct which contains various counts for a Memorex.Domain.Deck.

Functions for interacting with Memorex.Domain.Decks.

A Memorex.Domain.Card is the entity in Memorex which is reviewed/drilled by MemorexWeb.ReviewLive. A Memorex.Domain.Card belongs to a Memorex.Domain.Note. The Memorex.Domain.Card contains only drilling-related info; the actual flashcard content is contained in the Memorex.Domain.Note.

A Memorex.Domain.Card has one or more Memorex.Domain.CardLogs; every time you answer a card when reviewing/drilling (via MemorexWeb.ReviewLive) a Memorex.Domain.CardLog entry is created.

A Memorex.Domain.Deck contains Memorex.Domain.Notes (which in turn can have one or two Memorex.Domain.Cards associated with them). A Memorex.Domain.Deck can be read in from a single Markdown file (in which case the deck name is the name of the Markdown file, minus the .md extension) or from a directory which contains multiple Markdown files (in which case the deck name is the name of the directory containing the Markdown files), or from a deck directory which contains image file/text file pairs (see Memorex.Domain.Note for more detail).

There are two types of Memorex.Domain.Notes in Memorex. The first type (called "text notes") consists of a single line in a Memorex.Domain.Deck Markdown file which contains either the bidirectional or unidirectional delimitter (which are by default "⮂" and "→", respectively). The primary key of a text note is a UUID which is a hash of the note content (together with the note category, which is the name of the Markdown file if this deck is a directory which contains multple Markdown files). Notes are flagged when the Memorex.Deck parsing starts (via mix memorex.read_notes), and any Memorex.Domain.Note which does not show up in the current parsing of the Memorex.Domain.Deck is purged (so if the Memorex.Domain.Note has been edited in the Markdown file, it will be deleted and re-created on the next reading/parsing of the Memorex.Domain.Deck).

An Ecto repo which is used to store the drilling information (e.g., when a card is due, its interval, etc.) and a COPY of the Memorex.Domain.Note content (which is refreshed/re-created when the Memorex.Domain.Deck Markdown files are re-read from the filesystem via the Mix task Mix.Tasks.Memorex.ReadNotes).

This schema enables the Ecto primary keys to be UUIDs by default.

An Ecto type which lets Timex.Duration be stored in Postgres as an integer (representing number of seconds). The Timex.Duration is converted to seconds when it is written to the database, and is converted back to a Timex.Duration when it is read from the database.

Functions for interacting with Memorex.Domain.Notess.

Parses Memorex Markdown Memorex.Domain.Deck files. The Memorex.Parser is invoked from the mix task memorex.read_notes. This mix task invokes read_note_dirs/1 which is the main entry point to Memorex.Parser; the rest of the funtions are implementation details (which are public simply so they can be tested in isolation).

Memorex.Scheduler.CardReviewer is used by the MemorexWeb.ReviewLive Live View to review cards. Meorex.Domain.Cards are answered, and in the process Memorex.Domain.CardLogs are created.

This is the heart of the Anki SM-2 algorithm. Note that this file consists of pure functions; Memorex.Domain.Card structs come into the answer_card/4 function, and a map containing changes are returned. There is no database interaction in this file. Time is deterministic (i.e., there are no Timex.now() calls within this module), and the specific value of the current time is fed into each function. Memorex.Scheduler.CardStateMachine is not truly a state machine per se (as it actually maintains no state), but is really a set of transforms on Memorex.Domain.Cards.

The configuration for the Anki SM-2 algorithm.

Some convenience functions for interacting with date/times.

The entrypoint for defining your web interface, such as controllers, views, channels and so on.

A Phoenix LiveView which shows a list of all decks. This is the main UI entry point to the application.

Conveniences for translating and building error messages.

A module providing Internationalization with a gettext-based API.

The main LiveView for drilling/reviewing Memorex.Domain.Cards

Module with named helpers generated from MemorexWeb.Router.

Helper functions used by various LiveViews.


Mix Tasks

Reads the notes from the notes dirs