Skip to main content

HSA Reimbursement CLI is a command-line tool designed to help users manage healthcare receipts of Health Savings Account.

Project description

HSA Reimbursement CLI

HSA Reimbursement CLI is a command-line tool designed to help users manage healthcare receipts of Health Savings Account. The app enables tracking reimbursements efficiently. It allows users to analyze receipts, request reimbursements, back up data, restore from backups, and generate reports, all through an intuitive command-line interface.

All transactions are stored in a local SQLite database.


Features

  • Receipt Management:
    • Scan directories for healthcare receipts with automatic parsing of file metadata.
    • Validate receipt file naming conventions.
  • Reimbursement Tracking:
    • Request optimal reimbursement amounts based on available receipts.
    • Track reimbursed and remaining amounts.
  • Backup and Restore:
    • Backup reimbursement data to JSON files.
    • Restore data from backups.
  • Reporting:
    • Generate detailed reimbursement reports.
    • Export reports to CSV or JSON formats.
  • User-Friendly Commands:
    • Easy-to-use commands with a consistent interface.
    • Version tracking for updates and compatibility.

Table of Contents


Installation

  1. Clone the repository:

    git clone https://github.com/radian21/hsa_reimburse.git
    cd hsa_reimburse
    
  2. Install the package locally:

    pip install .
    
  3. Verify installation:

    hsa --version
    

Assumptions

This app assumes that the user is already saving their medical expense receipts. The app supports receipt files with any file extension because the app only parses the file names, not the file contents.

Filenames are assumed to meet the following condition:

YYYYMMDD_#.##_anyDescription

  • YYYYMMDD is the date the receipt occurred on.
  • #.## is a decimal number representing the value of the receipt in a currency.
  • anyDescription is an optional string that can be included as desired.

Each of these parts are expected to be delimited by the _ (underscore) character. By using the metadata from this format, the app can track reimbursement amounts and correlate files to those amounts.


Usage

Run the hsa command with a subcommand:

hsa <command> [options]

Example:

  • Scan receipts in a directory:

    hsa init ~/path/to/receipts
    

    The default path to the receipts will be used if no path is provided. The default path is: ~/Documents/hsa-reimburse/receipts

  • Request a reimbursement:

    hsa request 1000
    
  • Generate a summary:

    hsa summary
    

Commands

init

Scan a directory for receipts and add them to the database.

hsa init <path>
  • Options:
    • <path>: Path to the directory containing receipt files.

request

Request a reimbursement for a specific amount. The tool will select optimal receipts that sum up to or just below the requested amount.

hsa request <amount>
  • Options:
    • <amount>: The reimbursement amount requested.

reset

Reset all reimbursement transactions after creating a backup.

hsa reset
  • Prompts for confirmation before proceeding.
  • Saves a JSON backup of all reimbursement transactions before resetting the database. This backup is stored in ~/Documents/hsa-reimburse/backups and can be used to restore the database as desired.

restore

Restore reimbursement data from a backup file.

hsa restore <backup_file>
  • Options:
    • <backup_file>: Path to the JSON backup file.

The default backup location is ~/Documents/hsa-reimburse/backups


summary

Show a summary of total reimbursed and available amounts.

hsa summary

report

Generate a detailed report of all reimbursements.

hsa report [--export <format>]
  • Options:
    • --export <format>: Export report to csv or json.

Exported report files are saved to: ~/Documents/hsa-reimburse/exports

check-invalid

Check for receipt files that do not match the expected naming convention.

hsa check-invalid [--path <path>]
  • Options:
    • --path <path>: Directory to check. Defaults to the receipts directory.

File Naming Convention

Receipt files must follow this format:

YYYYMMDD_DollarAmount_OptionalNote.extension
  • YYYYMMDD: Date of the receipt.
  • DollarAmount: Reimbursable amount in decimal format.
  • OptionalNote: Additional details (optional).
  • Supported Extensions: Any. It doesn't matter. These are your file and this app only reads data from the file names.

Example:

  • 20240101_150.00_PrescriptionReceipt.pdf
  • 20240215_200.50.png

Development Notes

Global Variables

  • Database File: hsa_reimburse.db
  • Backup Directory: ~/Documents/.hsa_reimburse/backups
  • Export Directory: ~/Documents/.hsa_reimburse/exports
  • Receipts Directory: Configurable via RECEIPTS_DIR.

Key Python Libraries

  • sqlite3: Database for storing receipt and reimbursement data.
  • argparse: Command-line argument parsing.
  • json: Data serialization for backups and exports.
  • csv: Exporting data to CSV format.
  • os: File and path handling.

Code Structure

  • Commands are implemented as separate functions for modularity.
  • SQL queries are used for database operations.
  • Errors are handled gracefully with informative messages.

License

This project is licensed under the MIT License.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hsa_reimburse-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hsa_reimburse-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file hsa_reimburse-0.1.0.tar.gz.

File metadata

  • Download URL: hsa_reimburse-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for hsa_reimburse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9af3546fd55148e86298edd0f7b970a296745d83a3580f2f9b9ccf9edcdd5a54
MD5 f9870d55560c701ad0f32d60c1e9cb92
BLAKE2b-256 21e8c9fcacf35100c634a4a01763badac641b4d6ef510708ec7f1651c81f19d4

See more details on using hashes here.

File details

Details for the file hsa_reimburse-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hsa_reimburse-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for hsa_reimburse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c02ed3ab57f81e056d6a5ce9c30dc766af295f5b1e042054c94d89795c8f7507
MD5 71efc389d2e8500bd3a4bdec3944f72d
BLAKE2b-256 a24d69251120f3a1ee03d015d7700941dc01226caf89dcfb26939da599c5f7dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page