Skip to content

Latest commit

 

History

History
119 lines (92 loc) · 2.9 KB

README.md

File metadata and controls

119 lines (92 loc) · 2.9 KB

partdb

A tool for keeping track of where parts are stored. This tool is optimzed for use by hobbyists and is not intended as an inventory management system for businesses. For example, it does not even try to keep track of quantities.

Features

  • Keep track of parts and their locations
  • Simple data model. Parts and locations: more than one part can be at a location.
  • No extensive metadata. Parts have a description; locations have a name which must be unique.
  • Search for parts using either full text or semantic (vector) search by part description
  • Intelligent location suggestions when adding a part. Suggests location of similar items.

Requirements

  • An OpenAI API key for creating embeddings of part descriptions; environment variable OPENAI_API_KEY must be set and exported.
  • A PostgreSQL database server with the pgvector extension available; e.g.,pgvector docker image.
  • a ~/.pg_service.conf file with a partdb service and a partdb-superuser service configured and ~/.pgpass file if appropriate (not required if pg_hba.conf is configured to trust local users for example). An example ~/.pg_service.conf file is shown below. The user and dbname for the partdb service must be partdb. The user and dbname for the partdb-superuser service must be a postgresql user that has superuser rights.

Example ~/.pg_service.conf file:

[partdb]
host=127.0.0.1
port=5435
user=partdb
dbname=partdb

[partdb-superuser]
host=127.0.0.1
port=5435
user=postgres
dbname=postgres

Installation

pipx install .

or

pipx install --editable .

Initial Setup

After ensuring the requirements are met, run the following commands to set up the database:

partdb initdb

To load example data:

partdb loaddb --path  <path to example_data/>
partdb update_embeddings

To drop the database for a clean start:

partdb dropdb

Usage

To add a new location:

partdb add <location name>

To add a new part:

partdb add <location name> <part description>

To list all parts:

partdb list

To list all parts at a location:

partdb list <location name>

To list all locations:

partdb list --locations

To search for a part using semantic (vector) search (requires OpenAI API call):

partdb search <part description>

To search for a part using full text search:

partdb search --full-text <search phrase>

To delete a part:

partdb delete --id <part id>

To delete a location:

partdb delete --location <location name>

To update the description of a part:

partdb update <part id> <new description>

To move a part to a new location:

partdb move <part id> <new location name>