UBC · 临床文档的提取与分析 · 模块一第一课 / NLP009

医疗 NLP 能用在哪里?临床文档、患者的声音与癌症就医历程

医疗系统里有海量的非结构化文本,可是医疗领域的机器学习大多仍在用结构化数据,比如电子健康档案(EHR)和保险数据。UBC 课程“临床文档的提取与分析”(Extraction and Analysis of Clinical Documents)第一课讲的就是:为什么值得在医疗中用自然语言处理(NLP)——文本从哪里来、哪些 NLP 任务重要、其他语言和语音怎么办,以及一位癌症患者的报告在计算机眼里是什么样子。这篇笔记是我对这节概览课的整理。

Where Can NLP Help in Health Care? Clinical Documents, Patient Voices and the Cancer Journey

Health care produces huge amounts of unstructured text, yet most machine learning in health still works with structured data such as electronic health records (EHRs) and insurance claims. The first lesson of UBC's Extraction and Analysis of Clinical Documents explains why natural language processing (NLP) is worth the effort: where the text comes from, which NLP tasks matter, what about other languages and speech, and what a cancer patient's reports look like to a computer. This note is my summary of that overview.

  • 章节 / section
  • 关键概念 / key term
  • 阅读提示 / reading note
ELLE · 阅读向导 / READING COMPANION

把概念连起来,再往下读 / Take a moment to connect the ideas

和 Elle 一起理清基础概念 / A few foundations, with Elle

点开概念理清区别,再试三道小题;选错后可以重新选择。 / Tap a concept to explore it, then try three short questions. You can change any answer.

临床文档与 UGC / Clinical documents vs UGC

临床文档(病理、影像、手术报告)由医护人员撰写:正式、密集、满是术语。用户生成内容(博客、短信、论坛帖子)由患者和家属撰写:写法多样、往往主观,满是他们的经历和需求。 / Clinical documents (pathology, imaging, operative reports) are written by health care professionals: formal, dense, full of jargon. User-generated content (blogs, messages, forum posts) is written by patients and families: diverse, often subjective, and full of their experiences and needs.

关注字段 / Fields of interest

一项任务需要从报告里拿到的信息,比如有没有癌、类型、分级、大小和位置。NLP 自动把它们抽取出来,填进结构化表格或 EHR。 / The pieces of information a task needs from a report, such as whether there is cancer, its type, grade, size and location. NLP extracts them automatically and puts them into a structured table or the EHR.

否定 / Negation

报告提到一个表现,可能是为了排除它:“无淋巴血管侵犯”。“无”可能紧挨在词前,也可能在几句之后(“没有证据表明”),所以找到这个词不等于患者有这个表现。 / A report can name a finding in order to rule it out: "no lymphovascular invasion". The "no" may sit right before the term or several sentences later ("there is no evidence"), so finding a term is not the same as the patient having it.

孤立的文档 / Siloed documents

每份报告都是为下一步的局部决策而写,很少和其他报告按时间串起来,所以患者跨越多年的完整病史从来没有被拼起来。 / Each report is written for a local decision about the next step and is rarely linked to the others over time, so a patient's full history across years is never assembled.

1 / 3 · 一份病理报告里出现了“淋巴血管侵犯”几个字。患者有淋巴血管侵犯吗? / A pathology report contains the words "lymphovascular invasion". Does the patient have lymphovascular invasion?

2 / 3 · 患者在论坛上发的帖子很主观。这是否说明它们对照护患者没用? / Posts by patients on a forum are subjective. Does that make them useless for patient care?

3 / 3 · 一家医院的临床笔记是法语写的。可以先翻译成英文,再用英文 NLP 工具处理吗? / A hospital has clinical notes in French. Can it translate them into English and then use English NLP tools?

全景图:NLP 能拿医疗文本做什么

从左上角的 NLP 任务四大类开始,再往下看多语言问题:大多数工具是用英文文本做出来的,处理其他语言有两条路。左下是一段癌症就医历程:诊断、治疗、缓解后随访,疑似复发时由弯箭头回到诊断,每一步都会产生报告。右边红色部分是问题所在:这些文档各自孤立、满是术语、要等稀缺的专家来读;下面的绿色一行是 NLP 能提供的帮助。底部的红色长句是我在实际工作中的观察,右下角是我的重点。

手写风格的医疗 NLP 全景图:NLP 任务四大类(句法、语义、对话、其他任务);多语言问题及两种处理方式;癌症就医历程从诊断、治疗到缓解后随访,疑似复发时回到诊断;文档孤立、术语多、资源不足导致延误;NLP 把关注字段抽取进结构化表格;一个否定表达的例子

根据我的手写笔记整理,修正了几处表述,并补充了简短的例子。

The big picture: what NLP can do with health care text

Start at the top left with the four groups of NLP tasks, then the multilingual issue below it: most tools were built on English text, so there are two ways to handle other languages. At the bottom left is a cancer journey, from diagnosis to treatment to monitoring after remission, with the curved arrow back to diagnosis when a relapse is suspected; every step produces a report. On the right, in red, is the problem: these documents stay siloed, are full of jargon, and wait for scarce experts to read them. The green line beneath it is what NLP offers. The red line along the bottom is something I have noticed in practice, and my takeaway is in the bottom-right corner.

Handwritten-style overview of NLP in health care: four groups of NLP tasks (syntax, semantics, dialogue, other tasks); the multilingual issue and two ways to handle it; the cancer journey from diagnosis through treatment to post-remission monitoring, with a loop back when relapse is suspected; siloed documents, jargon and scarce resources leading to delays; NLP extracting fields of interest into a structured table; a negation example

Tidied up from my handwritten page, with a few corrections and short examples added.

看视频这一段 / Watch this part

医疗文本的两种来源

课程把医疗中的非结构化文本分成两种来源,微证书项目各用一门课来讲:

临床文档 用户生成内容(UGC)
谁写的 医护人员 患者、家属等
例子 病理报告、影像报告、放射报告、手术报告 博客、论坛帖子、短信、邮件、聊天
特点 正式、密集、满是医学术语,很少有主观评论 作者背景多样、写法各异,常常不合语法,往往很主观
告诉我们什么 诊断、检查发现和治疗 看法、经历、需求、感受和情绪
在项目里 这门课(第二门) 第三门课

主观不等于没有信息。课上的例子:到一个陌生城市旅行、想订餐厅时,大多数人会看网上的评价。我们都知道评价很主观,但一家 4.8 分、一家 3 分,还是能帮我们做选择。同样,患者怎样描述自己的经历,对照护患者也是有用的信息。

信息图:NLP 解锁医疗文本数据的潜力。左边是医疗非结构化文本的两大来源:专家撰写的官方临床文档,和来自患者及家属、主观而蕴含需求的用户生成内容;右边是 NLP 的应用:把孤立的报告整合成跨越多年的健康档案,以及准确处理“无脉管浸润”这样的否定表达
信息图信息图:NLP 解锁医疗文本数据的潜力。左边是医疗非结构化文本的两大来源:专家撰写的官方临床文档,和来自患者及家属、主观而蕴含需求的用户生成内容;右边是 NLP 的应用:把孤立的报告整合成跨越多年的健康档案,以及准确处理“无脉管浸润”这样的否定表达点击查看大图

读图提示:图中把语音放在了 UGC 下面,但课上语音是单独讨论的,也包括给医生用的 AI 病历书写助手;另外,能识别否定只是做风险分层的前提之一,并不等于“实现精准风险分层”。

Two sources of health care text

The course separates unstructured health text into two sources, and the micro-certificate gives each its own course:

Clinical documents User-generated content (UGC)
Who writes it Health care professionals Patients, their families and others
Examples Pathology, imaging and radiology reports; operative reports Blogs, forum posts, text messages, emails, chats
What it is like Formal, dense, full of medical terms; rarely subjective Diverse writers and styles; often ungrammatical; often subjective
What it tells us Diagnoses, findings and treatments Opinions, experiences, needs, feelings and moods
In the program This course (course two) Course three

Subjective does not mean uninformative. The lecture's example: when choosing a restaurant in a new city, most of us read online reviews. We know they are subjective, but a place rated 4.8 out of 5 still tells us something compared with one rated 3. In the same way, how patients describe their experience is useful information for patient care.

Infographic: unlocking health care insights with NLP. Left: the two primary sources of unstructured health data, official clinical documents written by health care professionals and patient user-generated content such as blogs and messages. Right: automated field extraction into structured data, contextual negation processing, and speech acoustic cues such as volume, pace and silence
InfographicInfographic: unlocking health care insights with NLP. Left: the two primary sources of unstructured health data, official clinical documents written by health care professionals and patient user-generated content such as blogs and messages. Right: automated field extraction into structured data, contextual negation processing, and speech acoustic cues such as volume, pace and silenceClick to open full size

A reading note: the sentence under negation in this picture came out garbled; the lecture's example is "no lymphovascular invasion" in a pathology report (below). Also, speech volume, pace and silence are linked to emotion and mood; they do not "directly reveal" a patient's state.

看视频这一段 / Watch this part

NLP 任务的四大类

NLP 里的“处理”(processing)包含很多事情。课上把任务分成四列:

类别 关注什么 例子
句法 Syntax 与语法相关:怎样组成词、短语和句子 分词、词形还原与词干提取、词性标注、句法分析、词语切分、断句
语义 Semantics 与语法无关:作者想表达什么意思、有什么意图 自然语言理解与生成、问答、机器翻译、命名实体识别(NER)、情感分析、话题切分、词义消歧
对话 Dialogue 对话,以及写的人想要什么 开放领域对话与任务型对话、意图识别、分类
其他任务 Other tasks 建立在前三类之上的更大任务 语言模型、摘要、信息检索与信息抽取、情绪识别、指代消解、语音

课上的两个例子。词义消歧:bank 可以是存钱的银行,也可以是河岸,要靠上下文判断。意图识别:患者发来一条消息,是在找信息,还是在表达害怕或沮丧?

这门课的重点任务是自然语言理解、问答、信息抽取和摘要;第三门课还会讲情感分析、话题切分、意图识别和情绪识别。句法类的几项任务在第一门课已经学过,见基础文本处理和分词、句子切分与贴标签。

Four groups of NLP tasks

"Processing" in NLP covers many things. The lecture sorts the tasks into four columns:

Group What it is about Examples
Syntax Tied to grammar: forming words, phrases and sentences Tokenization, lemmatization and stemming, part-of-speech tagging, parsing, word segmentation, sentence breaking
Semantics Not tied to grammar: what the writer means and intends Natural language understanding and generation, question answering, machine translation, named entity recognition (NER), sentiment analysis, topic segmentation, word sense disambiguation
Dialogue Conversations and what the writer wants Open-domain and task-oriented dialogue, intent detection, classification
Other tasks Larger tasks built on the first three Language models, summarization, information retrieval and extraction, emotion recognition, coreference resolution, speech

Two examples from the lecture. Word sense disambiguation: "bank" can be the place that holds your money or the edge of a river, and the context decides which. Intent detection: when a patient writes a message, are they asking for information, or expressing fear or frustration?

For this course the key tasks are natural language understanding, question answering, information extraction and summarization. Course three adds sentiment analysis, topic segmentation, intent detection and emotion recognition. Several of the syntax tasks were covered in the first course: see basic text processing and tokens, sentences and labels.

看视频这一段 / Watch this part

其他语言和语音

NLP 大多以英文为主。 大部分 NLP 研究依靠的是英文文档集(语料库),而且主要是美式英语,很多由开发大语言模型的科技巨头挑选。但即使在加拿大,医疗系统里也有法语。处理另一种语言有两条路:

  1. 先翻译,再建模:机器翻译已经很好,可以把法语文档翻译成英文,再用现有的英文工具处理。
  2. 直接用这种语言建模:直接在法语文档上建模型。今天的大语言模型处理法语已经不成问题。

对法语、西班牙语、德语这样的主要西方语言,这个问题基本解决了;但对很多非洲、亚洲和中东的语言,多语言依然是难题。

语音是越来越多的数据来源:Siri、Alexa 这样的语音助手,以及现在给医生用的 AI 病历书写助手(AI scribe,这门课后面会讲)。最简单的做法是先把语音转写成文字,再用 NLP 分析。但语音里有文字丢掉的特征:音量和语速与情绪、心境有关——兴奋时说得快,累了说得慢,抑郁时可能变得很安静,连沉默本身都在传递信息。直接分析这些特征,能比只看转写稿了解得更深。不过这门课和第三门课处理的都是英文文本。

Other languages and speech

Most NLP is English. Most NLP research is driven by collections of documents (corpora) in English, mostly American English, largely chosen by the big technology companies that built the large language models. But even in Canada, health care also runs in French. There are two ways to handle another language:

  1. Translate, then model: machine translation is now good, so French documents can be translated into English and processed with existing English tools.
  2. Model the language directly: build models on the French documents themselves. Today's large language models handle French well.

For major Western languages such as French, Spanish and German, this is largely solved. For many languages of Africa, Asia and the Middle East, it is still a challenge.

Speech is a growing source of data: voice assistants, and now AI scribes that listen to clinical visits (covered later in this course). The simple route is to transcribe speech into text and apply NLP. But speech carries features that text loses. Volume and pace are linked to emotion and mood: people tend to speak faster when excited, slower when tired, and very quietly when depressed. Even silence carries meaning. Analyzing those features directly gives a deeper picture than the transcript alone. This course and course three, however, work with English text.

看视频这一段 / Watch this part

一段癌症就医历程:报告很多,连接很少

临床文档伴随患者走过整个就医过程。以癌症为例:

  1. 诊断阶段:出现症状后做各种检查,可能是活检,也可能是手术。每一项操作都会产生报告,比如手术报告、病理报告。
  2. 治疗阶段:几轮化疗、手术或放疗,每一轮都有报告。
  3. 缓解后随访:定期复查,比如看家庭医生,每次又产生报告。
  4. 如果疑似复发,又回到诊断阶段。

5 年、10 年、50 年下来,这些文档本可以拼出患者完整的健康史。

A cancer journey: many reports, few connections

Clinical documents follow a patient through care. Take a cancer journey:

  1. Diagnosis: symptoms lead to tests, perhaps a biopsy or surgery. Each procedure produces a report, such as an operative report or a pathology report.
  2. Treatment: rounds of chemotherapy, surgery or radiation, each with its own report.
  3. Monitoring after remission: regular visits, for example to the family doctor, each generating more reports.
  4. If a relapse is suspected, the journey goes back to diagnosis.

Over 5, 10 or 50 years, these documents could form a full history of the patient's health.

看视频这一段 / Watch this part

各自孤立、满是术语、专家不够

实际上,一段癌症就医历程里的文档很少能拼成这样的健康史:

  • 各自孤立:每份报告只是为了做眼前下一步的局部决策,很少按时间串联起来。
  • 满是术语:只有专家才能解读。
  • 专家不够:医疗资源有限,等专家一份份读报告,可能耽误对时间敏感的治疗。

课程给出的方向是 NLP 辅助技术:用 NLP 和机器学习自动从临床文档中抽取关注字段(fields of interest)。这些字段能支持一系列下游任务:发现癌症、判断诊断分组(乳腺癌、结肠癌、白血病等)、根据既往病史预测治疗反应,以及做风险分层,让高风险病例优先、尽快得到治疗。

Siloed, full of jargon, short of experts

In practice, the documents of a cancer journey rarely form that history:

  • Siloed: each report is written to make a local decision about the next step, and reports are rarely linked over time.
  • Full of jargon: only human experts can interpret them.
  • Short of experts: with limited health care resources, waiting for an expert to read each document can delay time-sensitive care.

The course's answer is NLP-enabled assistive technology: use NLP and machine learning to extract fields of interest from clinical documents automatically. These fields support many downstream tasks: detecting cancer, assigning a diagnostic group (breast, colon, leukemia and so on), predicting response to treatment from prior history, and stratifying risk so that high-risk cases can be triaged for faster treatment.

看视频这一段 / Watch this part

一份报告,三个难点:字段、专家与否定

课上的例子是一份乳腺癌手术病理报告。报告不长,但信息很密,有好几个部分,病理医生在最终诊断里列了好几条。计算机应该找到的关注字段包括:

问题 报告里怎么写
有没有癌? 浸润性导管癌
有多严重? Nottingham 评分 9 分中的 8 分,即 3 级
多大,在哪里? 肿瘤大小,以及位于标本的上半部分
有没有侵入血管? 无淋巴血管侵犯

这份报告同时展示了三个难点:

  1. 字段分散。 每个字段出现在哪里,取决于写报告的医生怎么写。
  2. 解读要靠专家。 NLP 可以自动回答这些问题,这就是自然语言理解和问答。
  3. 否定。 淋巴血管侵犯是癌症严重程度的标志性表现,而这份报告明确写的是没有。关键词搜索能找到这个词,意思却正好弄反。这里的“无”就在词的前面,但否定的写法可以有很多种:报告可能先说检查了淋巴血管侵犯,五句话之后才写“没有证据表明”。把这句话和前面的词联系起来(指代消解),也是理解文本的一部分。

抽取出来的字段会被填进结构化的表格,比如 Excel 表或 EHR,用来支持上面那些下游分析。下一课会讲这些抽取出来的字段怎样帮助改善患者照护。

One report, three challenges: fields, experts and negation

The lecture's example is a breast cancer surgical pathology report. It is not long, but it is dense, with several sections and the pathologist's points in the final diagnosis. Fields of interest a computer should find include:

Question What the report says
Is there cancer? Invasive ductal carcinoma
How serious? Nottingham score 8 out of 9, which is grade 3
How large, and where? Its size, and its location in the upper half of the specimen
Has it spread into vessels? No lymphovascular invasion

The report shows three challenges at once:

  1. Fields are scattered. Where each field appears depends on how that clinician wrote the report.
  2. Interpretation needs experts. NLP can answer these questions automatically, as natural language understanding and question answering.
  3. Negation. Lymphovascular invasion is a hallmark of severity, and this report explicitly says there is none. A keyword search would find the term and get the meaning backwards. Here "no" sits right before the term, but negation can take many forms: a report might say it looked for lymphovascular invasion and, five sentences later, that "there is no evidence" of it. Linking that phrase back to the term (coreference) is part of understanding the text.

Once extracted, the fields go into a structured form, such as a spreadsheet or the EHR, where they support the downstream analyses above. The next lesson shows how such extracted fields can improve patient care.

看视频这一段 / Watch this part

我的思考

其实这一期,也是我为什么会开始对 NLP 在医疗中的实际应用很感兴趣的原因。作为一个多年在学术研究环境里工作的人,我经常会想:这些研究真正的意义是什么?怎样才能真的帮助到大众?我不觉得大众会看发表的论文,这不是大众获取信息的传统渠道;这些论文更多是“圈子里”的人的语言。而在工作中我慢慢发现,在真实世界里,研究也可以和大众联系在一起。比如我们的临床试验会问参与者:如果有了研究成果,是否愿意让我们跟进告知。这让我对“学术研究”本身有了进一步的认识。

参与了各种各样的研究后,我也发现临床里记录信息的方法有很多种。EHR 里典型的记录是结构化数据,就像选择题;而临床笔记由各种医护人员(医生、护士、社工)记录,基本都是开放式的自由文本,在实际操作中会记录很多“原因”(reason)方面的信息。以前分析这些信息比较难,但随着 NLP 的发展,这类信息开始可以被利用起来了。

My thoughts

This lesson is also why I became interested in practical applications of NLP in health care. After years of working in academic research, I often ask myself what research really means and how it can actually help the public. I don't think the public reads published papers; that is not where most people get their information, and papers are written in the language of people "inside the circle." But over time my work has shown me that in the real world, research can connect with the public. For example, our clinical trials ask participants whether they would like us to follow up and tell them the results. That has deepened how I understand academic research itself.

Through many different studies, I have also seen how many ways information is recorded in the clinic. The typical EHR records structured data, which is like a multiple-choice question. Clinical notes, written by health care providers such as physicians, nurses and social workers, are mostly open-box free text, and in practice they record a lot of information about reasons. This information used to be hard to analyze, but with the development of NLP it is starting to become usable.

看视频这一段 / Watch this part

原始手写笔记

手写的概览笔记:NLP 任务分为句法、语义、对话和其他任务;多语言问题,包括英文语料、先翻译成英文再建模、直接在其他语言上建模;诊断、治疗、缓解后三个阶段及回到诊断的箭头;文档孤立、医疗资源不足导致时间延误;底部一行中文写着实际操作中会记录很多 reason 信息

整理后的版本改了这些地方:NLP 任务四大类各补了几项具体任务,语义一类补了 bank 的例子;多语言问题补上“语料以英文为主(大多是美式英语)”,“translate to E, then model”写成“先翻译成英文,再用英文模型”,“build models on other language”补充说明 LLM 已能处理法语等主要语言、很多非洲和亚洲语言仍是难题;“Post-remission phase”写成“缓解后随访”,回到诊断的箭头标上“疑似复发”,并注明每一步都写报告;“Document siloed”补充为“只服务眼前的局部决策,很少按时间串起来”,并在“资源不足 → 时间延误”前加上“满是医学术语,要专家来读”;新增一行绿色的 NLP 辅助(抽取关注字段、填进结构化表格)和一个否定表达的例子;底部一句写成“临床笔记会记录很多‘为什么’(reason)的信息”;加上了我的重点。

Original handwritten notes

Handwritten overview notes: NLP tasks branching into syntax, semantics, dialogue and other tasks; the multilingual issue with English corpora, translating to English and building models on other languages; the diagnosis, treatment and post-remission phases with an arrow back to diagnosis; siloed documents and lack of health care resources leading to time delay; a line in Chinese about how much reason information is recorded in practice

What changed in the tidied version: each of the four NLP task groups gained a few example tasks, and semantics gained the "bank" example; "Multi-lingual issue" gained the point that most corpora are (American) English, "translate to E, then model" now says translate into English and use English models, and "build models on other language" gained the note that LLMs handle French and other major languages while many African and Asian languages remain hard; "Post-remission phase" is now post-remission monitoring, the arrow back to diagnosis is labelled "suspected relapse", and a note says every step produces a report; "Document siloed" now explains that reports serve local decisions and are rarely linked over time, and "full of jargon, needs experts" was added before lack of resources → time delay; a green line for what NLP offers (extract fields of interest into a structured table) and a negation example were added; the bottom line now says clinical notes record a lot of "reason" information; my takeaway was added.

学习来源与资源

这篇笔记基于我在英属哥伦比亚大学(UBC)微证书项目“用自然语言处理改善患者照护”(Natural Language Processing to Improve Patient Care)中学习课程 Extraction and Analysis of Clinical Documents 的笔记(模块一,Raymond Ng 主讲的“Overview and Motivations”一课)。技术细节核对了:

动手试试

  • medspaCy:开源的临床 NLP Python 库。它的 ConText 组件会把抽取出的发现标成否定、不确定或既往,可以用自己的句子看看“无淋巴血管侵犯”这类问题。

Learning sources and resources

This note is based on my study notes from the University of British Columbia (UBC) micro-certificate program "Natural Language Processing to Improve Patient Care," in the course Extraction and Analysis of Clinical Documents (Module 1, the lesson "Overview and Motivations" by Raymond Ng). Technical details were checked against:

Try it yourself

  • medspaCy: an open-source Python library for clinical NLP. Its ConText component marks extracted findings as negated, uncertain or historical, so you can see the "no lymphovascular invasion" problem on your own sentences.
原图 / Original ↗