creating a pdf version of a complicated form, populated with data from a database

Steve Litt slitt at troubleshooters.com
Fri Apr 5 09:57:37 CEST 2024


Christopher W. Ryan via texhax said on Wed, 3 Apr 2024 12:24:00 -0400

>I dream of using R, Rmarkdown, knittr, and pdflatex to pull individual
>records from a database and generate a form like page 1 here:
>
>https://www.cigna.com/static/www-cigna-com/docs/form-cms1500.pdf

I'm not sure R, Rmarkdown, and knitter are the right tools. More
later...


>one pdf form per database record, with the form fields populated. Then
>I could print them, and mail the bills to patients' insurers.
>
>The contents of many of the fields will be static: all records in the
>database pertain to the same lab test, all are ordered by the same
>physician (me), and all tests are conducted in the same place.
>
>The R coding seems straightforward, but using pdflatex to reproduce
>this complex layout strikes me as daunting--even before trying!
>Opinions: is this a fool's errand? Should I not even try?

I was doing this formatting in the 1980's. The trick is to use a
monospace font so you can treat the page as a 2 dimensional array.

It's amazing how little those forms have changed since I created
software to fill them in in almost 40 years ago. I see nothing on that
form requiring statistics. Assuming all necessary data is already in a
database, you can simply use any old language to read the database,
employ a few business rules, fill in a 66x80 2 dimensional array, create
a text file from the array, then run enscript or whatever to turn it
into a postscript or PDF with the proper monospace font.

This sounds easy to me. The only difficulties I expect are making sure
all necessary data is available for reading, and all laws and rules are
turned into business rules which are then turned into code. I've done
it: It's not hard.

SteveT

Steve Litt 

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21


More information about the texhax mailing list.