Browse Source

update readme

Daniel Sheffield 8 months ago
parent
commit
8bf02781bf
1 changed files with 17 additions and 19 deletions
  1. 17 19
      readme.md

+ 17 - 19
readme.md

@@ -1,12 +1,12 @@
 # Grocery Manager
 This a database driven app - meaning it's all about the data and nothing but the data.
 
-The database is assumed to be postgresql, but any modern database should work with some tweaks.
+The database is assumed to be postgresql, but any modern relational database should work with some tweaks.
 
 The following apps make the data useful:
 * ``grocery_transactions.py`` - facilitate data entry with a TUI
 * ``price_check.py`` - show price history graph per product (TUI)
-* ``rest`` - basic website to view price trends
+* ``SQLPage`` - basic website to view price trends
 
 
 ## Workflow
@@ -40,13 +40,15 @@ This is another ``python`` + ``urwid`` TUI to look up products to see their pric
 
 It's designed to be usable on mobile (I use termux and have a shortcut to ssh into a jumphost)
 
-### rest
+### SQLPage
 
-A small ``python`` + ``bottle`` website for things that are better viewed on the web:
+[SQLPage](https://sql.ophir.dev/) is a lightweight webserver written in Rust and generates web pages from SQL.
 
-* trending price data over all products (can be filtered) rendered with ``seaborn``
-* product listings (direct from database via xml + xsl)
-* tag listings and usage
+Features the SQLPage grocery website provides:
+
+* trending price data over all products (can be filtered) rendered with [appexcharts.js](https://apexcharts.com/)
+* product listings
+* tag listings and usage counts
 
 # Technology stack
 ## postgresql
@@ -70,22 +72,18 @@ Some window functions are used it the TUI apps but only because it was convienie
 
 Some client side data transforms are done with ``pandas``.
 
-## HTML + XSLT
-``postgreql``'s ``query_to_xml_and_xmlschema`` feature is used with an XSLT style sheet to generate the HTML pages.
-
-### bottle
-Thes web inerface uses ``bottle`` as a web server.
-
-``psycopg`` is used to get the XML data for the web page from the database.
+## SQLPage
 
-An HTML form is built client side and added to the page using ``bottle``'s templating feature.
+SQLPage provides web components out-of-the-box to generate beautiful web pages.
 
-The form is submitted using URL params so filters can be written by hand and bookmarked.
+I make heavy use of the table, form and chart components.
 
-Only CSS + HTML is used. No javascript.
+The filter options are internally stored as JSON format and stored in a cookie to preserve the filter on page changes.
 
-This is for portability reasons.
+* I took this approach because it was not very elegant to use buttons that post forms for navigation
+* The cookie only stores the user selections, so while there can be a lot of filter options (300+ products), only the selected options are stored in the cookie.
 
+I'll revisit this later with aim to avoid using cookies entirely.
 
 # Get Started
 ## Install Requirements
@@ -115,4 +113,4 @@ Check prices (TUI)
 python3 price_check.py
 ```
 
-Check the web inerface: https://shandan.one/grocery/trend?category=&group=Fish%2C+Meat%2C+Eggs&product=&tag=&unit=kg
+Check the web inerface: https://shandan.one/grocery/internal/apply.sql?title=Trend&apply=Apply&groups[]=Fish%2C+Meat%2C+Eggs