This repo has all the files to build the individual student score reports for the Oregon Extended Assessment. The score reports are built using R with the pagedown package; the plot within the score report is made with ggplot2. The pagedown report is parameterized, with a shell script used to change the report parameters. The whole thing is packaged into a docker container, which then is (will be) incorporated into the production code.
If you'd like to get a full picture of how this all works, feel free to clone the repo and build the docker image locally. To do this, first make sure you have docker installed. Then do the following
- Launch Docker (make sure it's running)
- Open terminal on your local machine (
/Applications/Utilities/Terminal.app
if on a mac) - Type
cd
and then drag the folder to terminal. Make sure there is a space betweencd
and the path. Hit enter. You should see the terminal prompt change to show that you are now in that folder. - Type
docker build -t orext-score-report .
into the terminal and hit enter. This will build the docker image and may take a few minutes the first time (it's fast thereafter because of caching). - Open the
params.txt
file. This is all the parameters for the score report. Edit them however you'd like.
There are two shell scripts in the image, one for rendering the score report (to html) and one for converting the html to PDF. To create one HTML report, with the parameters in params.txt
, run the following in terminal
cat params.txt | docker run -i orext-score-report render.sh > new.html
The first part of this (before |
) reads in the params.txt
file. This then gets passed to the docker image. We are asking to run the orext-score-report
image interactively -i
, and pass the contents of params.txt
to render.sh
. This script then renders the HTML, and the result will be saved in new.html
(or whatever you want to call it.)
After rendering to HTML, we might also want to have a PDF copy. We can do this by running
cat new.html | docker run -i orext-score-report convert-pdf.sh > new.pdf
This time we're passing the new.html
file that we rendered from the previous run to the convert-pdf
script, which will then be saved in new.pdf
(or whatever you want to call it).
This is all meant to be done programmatically. Initially, I had built this image with a plumber API, but I think this is better because it can work directly with the database. In other words, we shouldn't have to host the web API through AWS or some similar service. Instead, we just programmatically create the params.txt
files from the database and pass them to the docker image, as above.
If you do happen to play with it and you identify any problems, please file an issue describing the problem in as much detail as possible.