Skip to content

ibizaman/hledger-example-insurance-claim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insurance Claim Example Entries for Hledger

This repository is my attempt at keeping a tabs on insurance claims using heldger. To keep things concrete, let's say we're talking about medical bills.

Specifically, I want to abide by the following constraints:

  • Add an entry when the insurance claim comes in.
  • Add an entry when I pay the insurance company.

And be able to answer the following questions:

  • How much deductible and out-of-pocket are remaining?
  • How much did the insurance company pay?
  • How much did I pay?

Deductible? Out-of-pocket?

For those not familiar with this insurance system, this is how it works.

  1. I pay all the bills until I paid fully my deductible. In the example, it's 50. When I fully paid 50, go to 2.
  2. Then, the insurance kicks in and covers part of my bills. Whatever I pay then goes to my out-of-pocket cap. In the example it's 10. So when I fully paid 10, go to 3.
  3. The insurance covers now everything, I don't need to pay anything. In the example, I will pay at most 60 for the whole year.

hledger.journal

The hledger.journal file contains all transactions.

  • 2025/01/01: As opening balance for the new yeat, I get a salary of 100.

    2025-01-01 Opening balances
        assets:checking                                100
        income:salary:me
    

    Also, I add an entry to for Insurance caps since deductible and out-of-pocket amounts are reset on the new year.

    2025-01-01 Opening balances
        cap:insurance:medical:me:deductible:init       -50
        cap:insurance:medical:me:deductible:rem         50
        ;
        cap:insurance:medical:me:out-of-pocket:init    -10
        cap:insurance:medical:me:out-of-pocket:rem      10
    

    For a given cap, like cap:insurance:medical:me:deductible or cap:insurance:medical:me:out-of-pocket, there are 3 sub accounts:

    • :init is for the initial cap at the beginning of the year.
    • :rem is for what's left in the cap. When I pay the insurance bill, first the deductible:rem account will get reduced until 0, then the out-of-pocket:rem account will get reduced. When both gets to 0, the insurance covers everything.
    • :spent is the counterpart of :rem. Whenever we reduce :rem, we increase :spent.

    Only having :rem could be enough but we need the other two to keep the double accounting rule satisfied.

  • 2025/01/02: Next day, I get an insurance claim. Already?!

    2025-01-02 Insurance claim
        expenses:medical:me                             50
        liabilities:payable:insurance:medical:me       -50
        ;
        cap:insurance:medical:me:deductible:rem        -50
        cap:insurance:medical:me:deductible:spent       50
    

    I'm not paying the insurance claim right away, so I put it in liabilities:payable.

    Also, the deductible gets reduced. To keep things simple, the amount corresponds fully to what was in the deductiable cap, so now that amount is 0.

  • 2025/01/03: I pay the insurance company.

    This reduces the amount of money in my checking account. Sniff.

    2025-01-03 Insurance payment
        assets:checking                                -50
        liabilities:payable:insurance:medical:me        50
    
  • 2025/01/04: Another insurance claim comes in

    2025-01-04 Insurance claim
        expenses:medical:me                             50
        liabilities:payable:insurance:medical:me       -10
        income:insurance:medical:me                    -40
        ;
        cap:insurance:medical:me:out-of-pocket:rem     -10
        cap:insurance:medical:me:out-of-pocket:spent    10
    

    This time, the expense was also of 50 but since I paid fully my deductible, it covered part of the expense.

    The out-of-pocket gets reduced this time. To keep things simple, the amount corresponds fully to what was in the out-of-pocket cap, so now that amount is 0.

  • 2025/01/06: One more insurance claim comes in

    2025-01-06 Insurance claim
      expenses:medical:me                             50
      income:insurance:medical:me                    -50
    

    This time the insurance company covers everything since my deductible and out-of-pocket are fully paid.

Questions

How much deductible and out-of-pocket are remaining?

hledger -f hledger.journal bal -p "daily" --historical ":rem" --pretty
Ending balances (historical) in 2025-01-01..2025-01-06:

                                            ║ 2025-01-01  2025-01-02  2025-01-03  2025-01-04  2025-01-05  2025-01-06 
════════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════
 cap:insurance:medical:me:deductible:rem    ║         50           0           0           0           0           0 
 cap:insurance:medical:me:out-of-pocket:rem ║         10          10          10           0           0           0 
────────────────────────────────────────────╫────────────────────────────────────────────────────────────────────────
                                            ║         60          10          10           0           0           0

How much did the insurance company pay?

hledger -f hledger.journal bal -p "daily" --historical "income:insurance" --pretty --invert
Ending balances (historical) in 2025-01-01..2025-01-06:

                             ║ 2025-01-01  2025-01-02  2025-01-03  2025-01-04  2025-01-05  2025-01-06 
═════════════════════════════╬════════════════════════════════════════════════════════════════════════
 income:insurance:medical:me ║          0           0           0          40          40          90 
─────────────────────────────╫────────────────────────────────────────────────────────────────────────
                             ║          0           0           0          40          40          90

How much did I pay?

$ hledger -f hledger.journal bal -p "daily" --historical ":spent" --pretty
Ending balances (historical) in 2025-01-01..2025-01-06:

                                              ║ 2025-01-01  2025-01-02  2025-01-03  2025-01-04  2025-01-05  2025-01-06 
══════════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════
 cap:insurance:medical:me:deductible:spent    ║          0          50          50          50          50          50 
 cap:insurance:medical:me:out-of-pocket:spent ║          0           0           0          10          10          10 
──────────────────────────────────────────────╫────────────────────────────────────────────────────────────────────────
                                              ║          0          50          50          60          60          60

How much was the full medical bill?

hledger -f hledger.journal bal -p "daily" --historical "expenses:medical" --pretty
Ending balances (historical) in 2025-01-01..2025-01-06:

                     ║ 2025-01-01  2025-01-02  2025-01-03  2025-01-04  2025-01-05  2025-01-06 
═════════════════════╬════════════════════════════════════════════════════════════════════════
 expenses:medical:me ║          0          50          50         100         100         150 
─────────────────────╫────────────────────────────────────────────────────────────────────────
                     ║          0          50          50         100         100         150 

What does the income statement look like?

hledger -f hledger.journal is -p "daily" --historical --pretty
Income Statement 2025-01-01..2025-01-06 (Historical Ending Balances)

                             ║ 2025-01-01  2025-01-02  2025-01-03  2025-01-04  2025-01-05  2025-01-06 
═════════════════════════════╬════════════════════════════════════════════════════════════════════════
 Revenues                    ║                                                                        
─────────────────────────────╫────────────────────────────────────────────────────────────────────────
 income:insurance:medical:me ║          0           0           0          40          40          90 
 income:salary:me            ║        100         100         100         100         100         100 
─────────────────────────────╫────────────────────────────────────────────────────────────────────────
                             ║        100         100         100         140         140         190 
═════════════════════════════╬════════════════════════════════════════════════════════════════════════
 Expenses                    ║                                                                        
─────────────────────────────╫────────────────────────────────────────────────────────────────────────
 expenses:medical:me         ║          0          50          50         100         100         150 
─────────────────────────────╫────────────────────────────────────────────────────────────────────────
                             ║          0          50          50         100         100         150 
═════════════════════════════╬════════════════════════════════════════════════════════════════════════
 Net:                        ║        100          50          50          40          40          40

From the reports above we know I paid 60 in total, so having 40 remaining makes sense.

What does the balance sheet look like?

hledger -f hledger.journal bs -p "daily" --historical --pretty
Balance Sheet 2025-01-01..2025-01-06 (Historical Ending Balances)

                                          ║ 2025-01-01  2025-01-02  2025-01-03  2025-01-04  2025-01-05  2025-01-06 
══════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════
 Assets                                   ║                                                                        
──────────────────────────────────────────╫────────────────────────────────────────────────────────────────────────
 assets:checking                          ║        100         100          50          50          40          40 
──────────────────────────────────────────╫────────────────────────────────────────────────────────────────────────
                                          ║        100         100          50          50          40          40 
══════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════
 Liabilities                              ║                                                                        
──────────────────────────────────────────╫────────────────────────────────────────────────────────────────────────
 liabilities:payable:insurance:medical:me ║          0          50           0          10           0           0 
──────────────────────────────────────────╫────────────────────────────────────────────────────────────────────────
                                          ║          0          50           0          10           0           0 
══════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════
 Net:                                     ║        100          50          50          40          40          40 

Same here. Since I paid the insurance company, I've got no liabilities at the end but my assets got reduced to 40.

What about some details on the transactions?

hledger -f hledger.journal reg ":rem" --width 80
2025-01-01 Insurance caps       ca:in:me:me:de:rem              50            50
                                ca:in:me:me:ou:rem              10            60
2025-01-02 Insurance claim      ca:in:me:me:de:rem             -50            10
2025-01-04 Insurance claim      ca:in:me:me:ou:rem             -10             0

About

Example on how to handle insurance claims with hledger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published