Writing

From medical records to legal documents: what changed

In short: the engineering barely changed. What changed is where the truth lives. In medicine it lives in a private record you have to protect. In law it lives in public text that keeps changing, and…

published
read time
4 min
words
805
lang
en
filed under
Career

In short: the engineering barely changed. What changed is where the truth lives. In medicine it lives in a private record you have to protect. In law it lives in public text that keeps changing, and you have to quote it exactly.

I spent most of the last five years building machine learning for health. This month I am starting something new, as a founder. People keep asking whether that is a big jump. Technically, less than you would think. In how you have to think about the data, more than I expected.

Where I am coming from

Here is the short version of the path, by the kind of data each step was about.

YearsRoleWhat the data was
EarlierML engineer, hospital networkClinical and research data that could not leave each institution, so the models went to the data with federated learning
2023Full-stack and AI developer, hospital projectConversations with patients, through a conversational tool
2024 to 2025Lead ML engineer, mental health researchPatient data for precision medicine
2025AI engineer, health AI companyProduction clinical models, such as clinical audio models
2025 to 2026Founder and applied AI engineerA large document corpus, answered through retrieval with citations

The last row is where the switch really happened. Building retrieval and citations over a big pile of documents taught me most of what I know about text. Before that, my world was signals, scans and structured records.

What stayed the same

More than I expected:

  • Pipelines are most of the work. In a hospital it was getting data cleaned, secured and into one shape. In law it is getting text out of PDFs, Word files and web pages and into one shape. Same job, different mess.
  • Experts check your output. Clinicians then, lawyers now. Both are busy, both are right to be sceptical, and both will stop using a tool after one confident mistake.
  • You read outputs by hand. No metric replaced reading predictions in health, and none replaces reading answers in law.
  • Deployment is deployment. Containers, cloud services, logs, alerts. The domain does not care.

What changed

Side by side

Medical records

  • Private by default, protected by law
  • Scarce: you fight for every labelled example
  • Move the model to the data
  • A record grows over time
  • Being right means a correct prediction

Legal documents

  • Mostly public, published by courts and governments
  • Plentiful, but in dozens of formats
  • Move the data to the model, carefully
  • A law changes over time
  • Being right means the exact words, and where they came from

Privacy turns into provenance

In health, the first question about any dataset was who is allowed to see it. A lot of my work was about that question: federated learning so data could stay where it was, and securing models so sensitive data and access to it stayed protected. In law, most of the core text is public. The first question becomes: where exactly did this come from, and is it the official version? Provenance is the new privacy. Every chunk needs its source, its date and its jurisdiction attached, or it is useless.

Records grow, laws change

A patient record is mostly append-only. New visits get added. Old entries do not get rewritten. A law is different. A section can be amended, replaced or repealed, and the question "what did the law say" depends on the date you ask about.

a record grows new visit time a law changes time s. 12 v1 s. 12 v2 s. 12 v3
A record only gets longer. A section of a law is replaced, and which version applies depends on the date.

That one difference touches everything: how you store text, how you chunk it, what metadata every chunk carries, and what a correct answer even means.

Being right means quoting

A diagnostic model is judged on its predictions. A legal answer is judged on whether it points to the right passage, in the right version, and says what that passage says. A summary that is close is not good enough. This is why citations are not a feature in legal tech. They are the product.

If you are switching fields too

A few things that helped me, and would help anyone moving an ML skill set into a new domain:

  1. List what transfers before you list what you have to learn. For me it was pipelines, evaluation habits and deployment. That list is longer than you think.
  2. Find the one property of the new data that the old data did not have. For me it was versions. Design around that first.
  3. Sit with an expert while they use your output. You will see what they check first, and it is rarely the thing you were measuring.
  4. Keep your old instincts about harm. Health taught me to ask what happens when the model is confidently wrong. That question matters just as much when the answer is about someone's rights.

related

Keep reading