All Projects → fiatjaf → pf

fiatjaf / pf

Licence: other
a framework for turning written sentences into structured data with simple parsers.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pf

Money Tracker
💰 Personal finances tracking web app
Stars: ✭ 577 (+3105.56%)
Mutual labels:  pouchdb
Metadata.js
Library for building offline-first browser-based applications :: платформа автономных веб-приложений
Stars: ✭ 165 (+816.67%)
Mutual labels:  pouchdb
Rxdb
🔄 A client side, offline-first, reactive database for JavaScript Applications
Stars: ✭ 16,670 (+92511.11%)
Mutual labels:  pouchdb
Neuron
Neuron - Electron, ES6, React, PouchDB, Sass, Webpack
Stars: ✭ 988 (+5388.89%)
Mutual labels:  pouchdb
Vue Pouch Db
Vue Pouch DB is a VueJS Plugin that binds PouchDB with Vue and keeps a synchronised state with the database. Has support for Mango queries which are processed locally within the VuePouchDB state.
Stars: ✭ 127 (+605.56%)
Mutual labels:  pouchdb
Kivik
Kivik provides a common interface to CouchDB or CouchDB-like databases for Go and GopherJS.
Stars: ✭ 200 (+1011.11%)
Mutual labels:  pouchdb
Ionic-CouchDB-chat-app
Simple chat mobile app, like whatsApp lite version
Stars: ✭ 13 (-27.78%)
Mutual labels:  pouchdb
powerplant
Optimize and assist planning your garden
Stars: ✭ 75 (+316.67%)
Mutual labels:  pouchdb
Avancedb
An in-memory database based on the CouchDB REST API and containing the CouchDB Futon and Fauxton web sites
Stars: ✭ 161 (+794.44%)
Mutual labels:  pouchdb
Pouchdb
🐨 - PouchDB is a pocket-sized database.
Stars: ✭ 14,625 (+81150%)
Mutual labels:  pouchdb
Couchdb Net
EF Core-like CouchDB experience for .NET!
Stars: ✭ 50 (+177.78%)
Mutual labels:  pouchdb
Pouchdb Adapter React Native Sqlite
PouchDB adapter using ReactNative SQLite as its backing store
Stars: ✭ 98 (+444.44%)
Mutual labels:  pouchdb
Preserver
Preserver is desktop notes organiser built on electron, angular2, pouchDB
Stars: ✭ 207 (+1050%)
Mutual labels:  pouchdb
Thing Store
an app for storing and calculating with arbitrary structures of values.
Stars: ✭ 11 (-38.89%)
Mutual labels:  pouchdb
client-side-databases
An implementation of the exact same app in Firestore, AWS Datastore, PouchDB, RxDB and WatermelonDB
Stars: ✭ 787 (+4272.22%)
Mutual labels:  pouchdb
Cht Core
The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
Stars: ✭ 354 (+1866.67%)
Mutual labels:  pouchdb
Graphql Pouch
GraphQL runtime using PouchDB
Stars: ✭ 191 (+961.11%)
Mutual labels:  pouchdb
nadya
subscription management done right
Stars: ✭ 14 (-22.22%)
Mutual labels:  pouchdb
shopping-list-vuejs-pouchdb
Shopping List is an Offline First demo Progressive Web App built using Vue.js and PouchDB.
Stars: ✭ 81 (+350%)
Mutual labels:  pouchdb
React Native Sqlite 2
SQLite3 Native Plugin for React Native for iOS, Android, Windows and macOS.
Stars: ✭ 217 (+1105.56%)
Mutual labels:  pouchdb

pf

pf is a (for now) a command line tool that let's you turn sentences into structured data of any format you want by using a simple parser syntax.

Let's say you have a fabric store, a physical fabric store, and you want to keep track of all your finances and inventory. The only information you have are the raw facts that happened at your store, as they happen, and that's the only thing you need. So imagine that during the day you'll add facts like the following:

pf facts add 'sold 2m of cashmere for 104 bucks'
pf facts add 'sold 4m of wool for 150 bucks'
pf facts add 'got 100m of cashmere delivered'
pf facts add 'paid 200 to cashmere supplier'
pf facts add 'sold 6m of cashmere for 312 bucks'
pf facts add 'paid 250 to employee Maria'

After that (or before, it doesn't matter) you would define rules (by calling pf rules add or pf rules edit) to handle the 3 kinds of facts listed above with patterns somewhat like

'sold <quantity:number>m of <fabric:words> for <amount:money> bucks'
'got <quantity:number>m of <fabric:words> delivered'
'paid <amount:money> to <whom:words>'

When you call pf compute each fact is run, in order, through each available pattern and, if matched, the rule script is run. Each rule script receive the parameters captured in the fact parsing and the fact timestamp and can read and modify the current state (which begins as an empty JSON object {} by default). So for the "sold ..." rule you would perhaps

  • add the sale data to a big list of sales
  • add the value to your cash balances
  • subtract the sold items from your inventory

for the "got ..." rule you would

  • add the received items to the inventory

and for the "paid ..." rule you would

  • subtract the paid value from the cash balances
  • if the value was paid to an employee, keep track of your payments to that employee

Then you end up with a JSON object with all the data you need and you can use different tools, like jq, to crunch the data and produce reports, charts, prints and other useful stuff.

{
  "days": {
    "2018-02-30": {
      "sales": [
        {
          "item": "cashmere",
          "q": 2,
          "amount": 104
        },
        {
          "item": "wool",
          "q": 4,
          "amount": 150
        },
        {
          "item": "cashmere",
          "q": 6,
          "amount": 312
        }
      ],
      "payments": [
        {
          "target": "cashmere supplier",
          "amount": 200
        },
        {
          "target": "maria",
          "amount": 250
        }
      ],
      "balance": 116
    }
  },
  "inventory": {
    "cashmere": 177,
    "wool": 328
  },
  "employees": {
    "maria": {
      "monthly_payments": {
        "2018-02": [
          200,
          250 
        ] 
      },
      "outstanding_balance": 550
    } 
  }
}

If you decide later to start keeping track of things in a different way or to change your schema entirely, you just have to rewrite your rules, the facts will continue to be the same.

install

npm install -g pf-cli

This is an idea under development. The CLI program works, but much more functionality will be added yet, most notoriously:

  • incremental computing of facts
  • initial data loading and checkpoint saving
  • better logs and rule debugging helpers
  • PouchDB sync
  • a web client, at least for fact inputting, so normal people can use it on predefined schemas
  • fact input autosuggest based on the rule patterns structure
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].