Observatory

What We've Built So Far

What we've built so far: code sets (code set catalog, Medication Explorer, ICD-10-CM Explorer), specification (cohortspec, cohort ontology), and extraction (AI-enabled Jigsaw, Medicare CCW in the GDM)

We are working on many things at once, but we haven’t taken the time to say much about them. This post is a quick summary of some key projects. Every tool here is designed for researchers to use with an AI assistant in some fashion. The philosophy behind them is to gather all of the necessary information in one place. Doing so helps both people and AI build and review a cohort specification.

Once ready, all of these tools will be openly available to everybody. We will write about each of these in more detail as they become available.

Code set catalog

This is a home for code sets and their supporting information. Each code set carries its version, its source, and the reasoning behind its codes (if available). Researchers can search, compare, and share them. A number of websites store code sets, but none provides all the tools a researcher needs to understand and select one. The catalog is our way to close that gap. It has its own MCP server, so AI can help a researcher find relevant code sets.

How the code set catalog works: code sets are collected from public sources, such as CMS and AHRQ, and from the published literature. Each one is stored in a common format and linked to where it came from. Every code is verified against its vocabulary. A code set is versioned, so a study can cite exactly the version it used. One of the useful tools we created traces individual ICD-9-CM and ICD-10-CM codes as they change over time, so researchers can make sure a code set fits each year of their data.

Medication Explorer

This application finds prescription medication codes by drug or ingredient name, by ATC or FDA drug class, or by disease or condition. We processed every prescription drug label, extracted the indication statements, and linked them to each drug’s NDC and HCPCS codes. It is designed for use with a typical AI chat application (e.g., ChatGPT or Claude). Its MCP server gives the AI detailed search tools to identify relevant medications and their codes.

How the Medication Explorer works:

  1. Interpret the request. The AI states what it understood and any assumptions it made.
  2. Search broadly. Drugs are found in three ways: by name, brand, or ingredient; by their indication or disease area; or by drug class. Classes come from both the WHO ATC system and the FDA’s own classification.
  3. Read the evidence. For each candidate drug, the AI reads its indications, classes, ingredients, and dates.
  4. Decide. Each drug is included or excluded, with a reason and the label evidence behind it.
  5. Save. The code set is checked and stored with its NDC and HCPCS codes, along with other information such as strengths and dose forms.

ICD-10-CM Explorer

This tool turns a plain-language description of a condition (for example, “heart failure”) into a list of ICD-10-CM diagnosis codes for research. Each potentially relevant code includes a reason for its inclusion or exclusion.

How the ICD-10-CM Explorer works:

  1. Expand the request. The AI lists the condition’s synonyms, subtypes, and closely related terms.
  2. Search a medical terminology. Those terms are searched in SNOMED CT, a large clinical vocabulary with mappings to ICD-10-CM codes. This casts a wide net.
  3. Trim the obvious misses. A fast AI model removes only codes that clearly don’t belong. When in doubt, it keeps the code.
  4. Expert review by consensus. A stronger AI model grades each remaining code three times, independently. Grades run from “Always” to “Never,” based on how likely it is that patients with that code will have the condition. Where the three passes disagree, a separate “judge” AI pass decides.
  5. Output. Each code is marked Include, Neutral (uncertain, for a person to decide), or Exclude, with reasons. An audit spreadsheet documents every step.

cohortspec

A cohort specification is the often unwritten document that connects the clinical protocol, the code sets, the programming code, and the statistical analysis plan. We created a web-based application to help people write the specification for cohort extraction. The specification is an organized template, not a programming language, so researchers, programmers, and AI can all read it or write it. A specification can be as brief as a list of named code sets organized by purpose, or as complete as a full programming plan.

How cohortspec works: a study is built around its index date, day 0. Each clinical construct is defined once, by its code set (or a placeholder), and then placed wherever the study needs it: as an inclusion or exclusion criterion, a baseline variable, an exposure, or an outcome. Each placement has its own window relative to day 0. The entry rule (first event or first qualifying event), the required observation period, and the events that end follow-up are explicit settings rather than buried details. The specification is checked as it is written. It exports both as a document a person can read and as one a program, or an AI, can implement.

Cohort ontology

To support cohortspec, we created an ontology, which is simply a language for expressing “what things are.” For cohort extraction, a specification describes which records to extract from the raw data in relation to points in time (e.g., an index date). The cohort ontology defines time in observational studies precisely enough for a computer to check, so that an AI writing a cohort extraction can guide and check its own work. A patient’s record carries several kinds of dates (when care happened, when it was recorded, when it became available), and each patient has their own day 0. The ontology gives each temporal term (index date, baseline, follow-up, observation period, window) one plain-language definition, built on established ontologies such as the Basic Formal Ontology (BFO) and the Ontology for Biomedical Investigations (OBI). It is written in OWL, the standard language for ontologies, so standard tools can read it and reason over it.

How the cohort ontology works: an AI, or a person, writes the study’s design in these terms before writing any code. Our cohortspec application (above) is one way to do this. Describing a cohort in precisely defined terms forces the decisions that protocols often leave unstated. When a detail is missing, the checker flags it, so the AI or person knows what to ask rather than guess. Automated checks, written in SHACL (the companion standard for checking data against rules), catch temporal errors in the design before any data are extracted. These errors include immortal time, baseline variables measured after day 0, and patients followed past their death. Each error comes with an explanation the AI can act on.

AI-enabled Jigsaw

This wasn’t on our radar screen initially. However, we added an MCP server to our Jigsaw software and found that AI was extremely efficient at creating cohorts, particularly when paired with applications for finding and building code sets and algorithms (i.e., code sets plus logic). Code sets and algorithms are written in ConceptQL, our language for defining research algorithms unambiguously, so the assistant’s work can be read and checked.

How AI-enabled Jigsaw works: the assistant takes the same steps a Jigsaw user would.

  1. Create a new cohort extraction, or find an existing one to use as a template and copy it.
  2. Find, adapt, or write the algorithms used in the study (e.g., “complicated diabetes”).
  3. Place them in the study as the index event, eligibility criteria, baseline measures, or follow-up measures.
  4. Generate the script for the full cohort extraction.
  5. Optionally, depending on privacy requirements, run the script against the data source, or have a person move it to the data platform and run it there.

The entire specification is reviewable in the Jigsaw user interface.

Medicare CCW in the Generalized Data Model

For researchers who use the CMS Virtual Research Data Center (VRDC), we developed the code to transform the Medicare Chronic Conditions Warehouse (CCW) data into the Generalized Data Model, our published, open-source data model. The model does not change the original data, so nothing is lost in translation. It reorganizes the data so they are easier to query. In this form, researchers can use AI-enabled Jigsaw to write their cohort extraction code.

← All writing