Inspiration
As a medical writer with a pharmacy background working in EU medical device regulatory documentation, I've seen firsthand how much time goes into manually reviewing clinical and promotional documents for compliance with EU medical advertising rules. A single consent form, product insert, or marketing piece can take an experienced reviewer significant time to check line by line — and mistakes can mean regulatory penalties or, worse, misleading patients. I wanted to see whether combining a document-intelligence API with a generative AI model could meaningfully speed up that first-pass review.
What it does
MedAd Nutrient Compliance Pipeline takes a clinical or regulatory PDF and automatically checks it against EU medical advertising compliance principles. It:
- Extracts clean, structured text from the PDF using the Nutrient DWS Data Extraction API
- Sends that text to Google Gemini with a compliance-review prompt grounded in EU medical advertising rules
- Returns a structured verdict — compliant or "needs revision" — along with the specific claims that were flagged and why
Instead of a reviewer reading a whole document cold, they get a fast, structured starting point: what to look at first, and what's likely to be a problem.
How we built it
The pipeline is a small Node.js project built and tested entirely in Google Cloud Shell. The extraction step (extract-test.js) calls the Nutrient DWS Data Extraction API on a sample PDF and returns clean text. The full pipeline (compliance-pipeline.js) chains that extraction step directly into a Gemini API call, using a prompt designed around EU medical advertising compliance principles — things like balanced risk/benefit presentation, no promotional framing of investigational efficacy data, and proper safety disclosures.
I tested it end-to-end with a fictional clinical consent form containing intentionally promotional-style language, to confirm the pipeline would actually catch real compliance issues rather than just rubber-stamping documents.
Challenges we ran into
Getting the Nutrient DWS API and Gemini API to work together cleanly in one pipeline took some iteration — particularly around correctly passing extracted text between the two API calls, and prompting Gemini precisely enough that it returns a consistent, structured JSON verdict rather than free-form commentary. I also had to clean up the repository before pushing to GitHub, since node_modules had accidentally been committed early on.
Accomplishments that we're proud of
The pipeline works end-to-end on a real (if fictional) clinical document, correctly identifying promotional-style efficacy claims and incomplete safety disclosures — exactly the kind of issue a human compliance reviewer would flag. As someone who comes from a non-technical medical writing background, building and deploying a working two-API pipeline myself, from Cloud Shell to a public GitHub repo, felt like a real milestone.
What we learned
Combining a specialized document-extraction API with a general-purpose LLM is a genuinely useful pattern for regulated-document review: the extraction API handles the messy parts of PDF structure reliably, while Gemini brings the domain reasoning. I also learned a lot about structuring prompts so the AI's output is consistent and usable programmatically, not just readable.
What's next for MedAd Nutrient Compliance Pipeline
Next steps include testing against a wider range of real-world document types (product inserts, promotional leaflets, multi-language consent forms), refining the compliance prompt with more EU MDR-specific rules, and building a simple web interface so non-technical reviewers could upload a PDF and get a verdict without touching the command line.
Built With
- api
- cloudshell
- dws
- gemini
- javascript
- node.js
- nutrient
Log in or sign up for Devpost to join the conversation.