tsparse-0.4.0.0: Parses U.S. federal Thrift Savings Plan PDF quarterly statements

Safe HaskellNone

TsParse

Contents

Description

Parses U.S. federal Thrift Savings Plan (TSP) statements.

This module works with PDF TSP statements downloaded from the TSP web site. It works with the statement format used as of July 2013. The format recently changed to allow for Roth contributions. This works on civilian, FERS statements; maybe it works on others, but I cannot test these (if you test these and find bugs, send me patches and I will merge them.)

You need to have the pdftotext program installed and available on your PATH. This program is part of the poppler project. On Debian GNU/Linux systems, it is part of the poppler-utils package.

Synopsis

Data types

Basic types

type Dollars = DecimalSource

Any data type that is Dollars on the TSP statement.

type Shares = DecimalSource

Any data type that is a number of shares on the TSP statement.

type TxnType = [String]Source

A list of words that indicates the transaction type. Each string in this list will not have any spaces in it.

Transaction Detail By Source

data BySource Source

Represents the entire YOUR TRANSACTION DETAIL BY SOURCE section.

data BySourceSummary Source

The TSP statement has several lines in the YOUR TRANSACTION DETAIL BY SOURCE section that contain summary data: Beginning Balance, Gain or Loss This Quarter, and Ending Balance. Since the columns in these lines are all the same they are all represented by this single type. Type synonyms BySourceBeginningBal, BySourceGainLoss, and BySourceEndingBal are used as appropriate.

type BySourceBeginningBal = BySourceSummarySource

YOUR TRANSACTION DETAIL BY SOURCE Beginning Balance.

type BySourceGainLoss = BySourceSummarySource

YOUR TRANSACTION DETAIL BY SOURCE Gain or Loss This Quarter.

type BySourceEndingBal = BySourceSummarySource

YOUR TRANSACTION DETAIL BY SOURCE Ending Balance.

Transaction Detail By Fund

type FundName = [String]Source

The name of a fund, eg C Fund. This is a list of words; each word will not contain any spaces.

data ByFund Source

A single fund in the YOUR TRANSACTION DETAIL BY FUND section (e.g. the G Fund, L 2040 Fund, etc.)

data ByFundBeginningBal Source

The beginning balance in a YOUR TRANSACTION DETAIL BY FUND section.

data ByFundGainLoss Source

Gain or Loss This Quarter in the YOUR TRANSACTION DETAIL BY FUND section.

Constructors

ByFundGainLoss 

data ByFundEndingBal Source

Ending balance in the YOUR TRANSACTION DETAIL BY FUND section.

data ByFundPosting Source

A single posting in the YOUR TRANSACTION DETAIL BY FUND section.

TSP statement

data TspStatement Source

All data that is parsed from the TSP statement is in this type. The parser does not attempt to parse any of the data that is on Page 1 of the PDF; most of this data all appears elsewhere on the statement and can be calculated using the data that is in this type (and besides, the data on Page 1 is in a multi-column format that would be difficult to parse; since the data is all elsewhere, it's not worth the effort.) One exception is the investment allocation for future contributions, which does not appear elsewhere.

In addition, the statement contains a quarterly account summary. This also is not parsed because it can be derived from all the data that is elsewhere on the statement.

Parsing a TSP statement

parseTsp :: Parser TspStatementSource

Parses a plain text TSP statement. The input must be generated by the pdftotext program. This library was tested against pdftotext version 0.18.4, which came with Debian Wheezy.

parseTspFromFileSource

Arguments

:: String

Filename

-> IO TspStatement 

Parses a TSP statement from a file. This function relies upon the pdftotext program. This program must exist somewhere in your PATH. This library was tested against pdftotext version 0.18.4, which came with Debian Wheezy.

Pretty printing