How Aetion is using generative AI and Amazon Bedrock to translate scientific intent to results

Javier Beltrán, Ornela Xhelili, Prasidh Chhabri, Mikhail Vaynshteyn6 Feb 2025

Problem

Aetion sells software for real-world evidence. Scientists build patient cohorts and outcomes from claims and lab data using "Measures", logical building blocks that can be chained. Complex variables involve event sequences, occurrences and non-occurrences, and numeric rules, so users often need support staff or specialised training to express them. The article says this takes days.

Example from the article: a user wants "patients with a diagnosis of diabetes and a subsequent metformin fill" as a Measure, or wants to drop negative cost values from claims data before a cost-effectiveness analysis.

Solution in brief

Measures Assistant is a microservice that takes the user's question and chat history, builds a prompt and calls Claude 3 Haiku on Amazon Bedrock. The prompt holds task rules, platform documentation and a few solved question and answer pairs picked by embedding similarity from a small expert-curated pool. Expert-written guardrails keep the instructions valid on the platform.

Questions this case answers
  • How to turn a free-text analytical question into a valid structured definition in a platform with a fixed set of building blocks, when a general LLM makes logical mistakes about them
  • How to let analysts without data science skills define complex patient variables in natural language?
  • How to make an LLM assistant over an analytics platform return only valid instructions for the platform?
  • How to improve an LLM assistant's answers using previously solved questions?

Tools and methods

  • Claude 3 Haiku on Amazon Bedrock — generates the instructions; chosen as faster and cheaper than the alternatives tried
  • Sentence Transformers (mxbai-embed-large-v1, fine-tuned) — embeds questions and the pool, cosine similarity picks examples
  • RAG over a local pool — in-process retrieval of solved examples
  • Guardrails — expert knowledge about Measures inserted to keep answers valid
  • Human in the loop — experts test the assistant and add question and answer pairs
  • Kubernetes — hosts the service
Continue reading — it's free

Google or a one-time email code. No password.