Crates.io | plaixt-core |
lib.rs | plaixt-core |
version | 0.0.0 |
source | src |
created_at | 2024-10-26 09:47:28.703074 |
updated_at | 2024-10-26 09:47:28.703074 |
description | PLAIn teXT tools for your data |
homepage | |
repository | |
max_upload_size | |
id | 1423691 |
size | 28,707 |
Plaixt is a set of conventions and modules to interact with data stored in plain text. It is purpose geared towards storing and interacting with 'real things'. Aka, concrete actions and/or objects. It might not do well with abstract concepts like 'infinity' or mutually recursive events. As a rule of thumb, if it has a date, and possibly a duration. It will probably fit.
Plaixt is made to interact with plain text files. It's primary use case is to record data and then process it further.
This is purposefully kept vague, just like a Hammer is a hard heavy object to hit things with.
Some things that you can do with Plaixt:
Plaixt uses a plain text, humand readable and writeable format.
A plaixt repository consists of these parts:
A definitions folder
A records folder
To make sense of the records, plaixt needs to know how records look like. This is so that both tools and humans know what to expect and how to interact with it.
.pldef
may be appended to make recognition of these files easierA record is anything one would want to track. Every record must have an associated datetime. Every record may have an associated unique id. Beyond these requirements, each record must have a kind associated with it. The definition of this kind then describes the required data of the record.
This is still in flux, but the main idea is as following:
An example definition:
purchase.pldef
# This is a comment
// You can also use double slashes
/* Multi-line comments are ok too */
# Definitions may use modules to verify records
# They can for example check that records are valid between eachother across
# the whole database
@checkWith "purchase-check"
# Each new definition needs a date from which it is active
# A date suffices, which implies a starting time of 00:00
define 26-10-2024T11:00
store -> LinkTo[Store]
name -> string
warranty length -> duration? # A question mark, marks optional fields, a shorthand for Maybe[Field]
count -> integer
# I realized I forgot the price field
# Any records before this date won't have a price field
define 15-11-2024
store -> LinkTo[Store]
name -> string
warranty length -> duration?
count -> integer
price -> euros
An example record:
shopping.plrecs
purchase 30-10-2024
store <- FarmerBernard
name <- "Pumpkin"
count <- 5
# No price here, as the record at this time does not allow adding a price
# I can force plaixt to use the definition from this specific date
purchase@15-11-2024 5-11-2024
store <- DIYCo
name <- "Nails"
count <- 250
price <- 3.50 # I have to mention the price, as the definition
# from 15-11-2024 has it as an non-optional field
Once you've defined some records, and wrote down some records, you can now query your database.
For example, imagine we want to know what items we own that are no longer under warranty.
plaixt --query "SELECT * FROM purchase WHERE 'warranty length' NOT NULL AND date + 'warranty length' < now()"
Of course this is a rather crude way of interacting with the system, and instead one would use helpers:
plaixt purchases out-of-warranty
These helpers are modules that have access to your database and encode the utility of it all. This readme only has a simple example, but imagine a slightly more complete inventory tracking which has acquiring and removing of inventory. The question of 'what I do I have at this point in time' comes out of the data, but is not written into it.
Technically you can.
Plaixt is modular and does not require its input to come from text files on a drive. But let me convince you why plain text is the better format to use:
We do take that into account! While plaixt per-default does not have any special handling for binary files, it doesn't preclude you from integrating them into your database. For example, the example above could be adapted to require a receipt in pdf/image form for each purchase. This can take many forms. The simplest would be to only require a file path, relative to the datastore. But integration with other software is also possible. Imagine a module that knows how to speak to a paperless instance. One could simply enter the ID of the document there, and the module only checks for existence. The possibilities here are unbounded, and allow you to custom fit your interactions with your needs.
This project is currently incubating, and as such there is not much to contribute to. Nontheless, if you feel like this project speaks to you specifically, and you want to participate, you can always open an issue or talk to me on other platforms.
The plaixt code is licensed under the EUPL-1.2 or later. Any other documents, not covered by the EUPL-1.2 or later licenses, are licensed under CC-BY-SA 4.0.
To make it simple, do what you want privately, but if you share it with others, or allow them to use it, make sure that they know of their rights.
Plaixt by Marcel Müller is licensed under CC BY-SA 4.0