Repeatable PDF Build Pipeline for a Web-Markup Drug-Interaction Summary
A repeatable PDF can be generated by maintaining the interaction summary in a plain-text web markup file (Markdown) and compiling it with a deterministic converter (commonly Pandoc) into a versioned PDF. The build is made repeatable by freezing tool versions, using a single template, and enforcing a consistent document structure.
Markup Source Structure (Markdown)
Create a single Markdown document per “interaction summary” build (e.g., drug-interactions-zonisamide-guselkumab-brexpiprazole-fluoxetine.md) with a consistent layout.
Recommended document sections
- Title block (drug list and build metadata)
- Scope and assumptions (brief, fixed)
- Drug-by-drug interaction matrix
- Summary tables (mechanism class, evidence category, clinical actions)
- “At-a-glance” cautions
- References (bibliographic placeholders)
Example Markdown skeleton
- YAML header (optional, used by some converters)
- Headings using
## - Bulleted lists for each drug interaction pair
- A final “Build info” line (date, tool versions)
Interaction Content Compilation Workflow (Before PDF Conversion)
Maintain interaction facts as structured bullets so the PDF rendering stays stable.
Suggested content rule-set
- Each interaction entry should include:
- Interacting agent(s) and affected drug
- Interaction type (pharmacokinetic vs pharmacodynamic)
- Clinical effect (brief)
- Suggested clinical actions (brief)
- Source citation (free-text placeholder in Markdown)
Suggested citation placeholder format
- Use a consistent inline label such as
[SourceID: A]. - Store source mappings in a separate file (e.g.,
references.bib) if BibTeX is used by Pandoc.
PDF Conversion Toolchain Selection
Use a toolchain that produces consistent output across runs.
Common options
- Pandoc (Markdown → PDF via LaTeX or HTML-to-PDF)
- MkDocs + a PDF plugin (Markdown-first, site-like workflow)
- Quarto (Markdown → PDF with embedded templates)
Most repeatable default
- Pandoc + a locked LaTeX engine (e.g., TeX Live) or Pandoc’s HTML-to-PDF backend with a fixed stylesheet.
Step-by-Step: Local Build (Deterministic Pandoc Example)
- Install the toolchain
- Install Pandoc.
- Install a LaTeX distribution if using Pandoc → PDF via LaTeX.
-
Confirm the converter versions can be queried from the command line.
-
Create the input Markdown file
- Save the markup document to a fixed path (e.g.,
docs/interaction-summary.md). -
Ensure headings and tables use stable Markdown syntax.
-
Create (or reuse) a PDF template
- Prefer a single PDF template used by all builds.
-
Maintain a consistent page style (margins, fonts, header/footer).
-
Run the conversion command
- Compile the Markdown to PDF with Pandoc.
-
Point Pandoc at:
- the Markdown source
- the template (if used)
- any style files (CSS or LaTeX template)
-
Verify the build output
-
Confirm:
- the table of contents (if included) renders correctly
- all headings appear in the expected order
- tables do not overflow
- special characters render correctly
-
Record build metadata
-
Add build metadata to the Markdown (or a footer) such as:
- source filename
- build date
- Pandoc version
-
This makes the PDF traceable to the input.
Step-by-Step: Automated Build (Single Command Repeatability)
- Add a build script
-
Create a script (e.g.,
build.shorbuild.bat) that runs:- a preflight check (input file exists)
- the conversion command
- output to a versioned filename
-
Version the output
-
Store PDFs in an output folder with a predictable name pattern:
output/interaction-summary-<YYYY-MM-DD>.pdf
-
Alternatively, use a content hash:
interaction-summary-<hash>.pdf
-
Lock tool versions
-
Document exact versions in:
- a
READMEbuild section - or a locked dependency file (e.g., container, script header)
- a
-
Run the same command in CI
- Use a CI job (GitHub Actions, GitLab CI, etc.) that:
- installs the same toolchain
- runs the build script
- uploads the generated PDF as an artifact
Output Quality Controls (So the PDF Stays “Repeatable”)
Rendering controls
- Use the same Markdown tables approach each time (consistent alignment and column counts).
- Avoid HTML fragments that depend on rendering differences unless the renderer is pinned.
- Keep page layout governed by template files, not editor defaults.
Content controls
- Ensure interaction entries follow the same bullet ordering.
- Keep headings stable so PDF section numbering or TOC does not drift.
Scaling to Multiple Drug Sets
Create one Markdown file per drug set or one Markdown file per drug with a generator.
Option A: One file per set
- Easiest for short, fixed sets.
- Best when only these four drugs are needed.
Option B: One file per drug, composed into the set
- A shared template pulls in per-drug interaction matrices.
- Best when many drug combinations are required.
Common Failure Points to Avoid
- Non-deterministic builds caused by tool auto-updates.
- PDF drift caused by template changes or missing template references.
- Unstable table rendering due to mixed Markdown table syntax.
- Missing or broken citations if reference files are not included in the build step.
Minimal “Make It Work” Implementation Checklist
- [ ] A single Markdown source file with fixed headings and stable table structure.
- [ ] A single conversion command that always targets the same converter version.
- [ ] A fixed PDF template or fixed stylesheet path.
- [ ] A build script that saves output to a predictable filename.
- [ ] A verification step that checks the produced PDF visually (layout) and structurally (TOC/sections).