Skip to content

Experimental project with simple prompt engineering using Sketch and Pandas with FastAPI munging invoked by AWS Lambda.

Notifications You must be signed in to change notification settings

jonwhittlestone/bean-counter

Repository files navigation

bean-counter

This experimental project aims to answer simple financial questions from the household budget.

  • Munge the Google Budget spreadsheets to a single CSV
  • Use Sketch to generate Python code to run analysis and plots

Usage

Run the development server:

uvicorn src.bean_counter.main:app --port 7998 --reload

Run

To ingest all costs from the Family Google Sheets, run with httpie:

http POST http://127.0.0.1:7998/run

Google Sheet API access

  1. Enable the Google Drive API and Google Sheets API for the Google Project

  2. Add a service account to the Google Project

Resources

AWS Lambda

If you have the credentials, run mine:

After installation/credentials set up AWS CLI v2:

  • aws lambda list-functions

To manually create and run Lambda in Management Console

Already created the Lambda and need to update it?

bash make update-lambda

  1. Get Python 3.10 packages (see ./aws/3.10-requirements.txt)

  2. Create zip file lambda_function.zip:

    pip install -t lib -r 3.10-requirements.txt
    
    (cd lib; zip ../lambda_function.zip -r .)
    
    (cd src/bean_counter; zip ../../lambda_function.zip -u main.py; zip ../../lambda_function.zip -u .env; cd -)
    
    zip lambda_function.zip -r config
    
  3. Upload it to S3 with:

    aws s3 cp lambda_function.zip s3://projects-bean-counter/lambda_function.zip
  4. Create the Lambda function:

  5. Upload by giving it S3 address

    aws lambda update-function-code --function-name bean-counter --s3-bucket projects-bean-counter --s3-key lambda_function.zip
  6. Tweak Configuration (Memory, Timeout)

  7. Deactivate/Reactivate (Optional)

    Deactivate:

    aws lambda put-function-concurrency --function-name bean-counter --reserved-concurrent-executions 0

    Reactivate:

    aws lambda put-function-concurrency --function-name bean-counter --reserved-concurrent-executions 10
    

Sample summary gsheet

Generated from https://jakebathman.github.io/Markdown-Table-Generator/

Direction Name Category Date GBP
Outgoing Petrol 05/23 400
Incoming Salary 03/23 3,500
Incoming Carry over from Joint 12/22 400

About

Experimental project with simple prompt engineering using Sketch and Pandas with FastAPI munging invoked by AWS Lambda.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published