📦 Moved to new directory. Last updated 12.2.2026. New location: claude-config/library/03-memory-state/deep-dives/state-12-entity-extraction.html

Deep dive 12 of 27: Entity Extraction

Nov 19, 2026 · Michael Chang · Status in NurseOps Now: ✅ built (a different way)

Show definitions in ( ) · hover a highlighted word for its meaning, click it for details · open with ?defs=1 to show definitions

Part of: Remembering the right things: state management in NurseOps Now, section Compression Strategies: Summarization and Entity Extraction (7.2) · All 27 solutions · ← Rolling Summaries · Vector Compression via RAG →

Read in this order

  1. In plain words: what it is, without jargon
  2. The problem it solves: the problem, and the standard approach in my words
  3. How to implement it (ServiceApps): scenario, steps, code and real output
  4. In NurseOps Now: built or not, and where
  5. Trade-offs and Interview answer

In plain words

Entity extraction (pulling key facts (names, dates, IDs) out of text into a structured record) pulls the key facts out of a conversation (name, asset, issue, deadline, what was already tried) into a small structured record. That record is pinned at the top of the prompt (the instructions and text given to the AI), so the facts are never lost in summaries.

In plain terms: filling in the ticket's form fields instead of re-reading the whole email thread (one saved conversation, here one per user and case) every time.

The problem it solves

History can't keep growing and Hallucination drift (details slowly changing as summaries are summarized again): facts buried in a long chat get lost or changed when the chat is shortened.

The standard approach (in my words): extract key variables into a structured JSON (a simple text format for structured data) object that stays at the top of the context window (everything sent to the AI in one call; it has a size limit), keeping facts exact while dropping the conversational scaffolding.

How to implement it (ServiceApps)

Illustrative example: no ServiceApps (a company platform for IT tickets, HR requests and help-center articles) instance is connected, so the scenario and data are made up. The code is a self-contained sketch; it was run on that made-up data on Nov 19, 2026, and the output below is from that run.

The setting. ServiceApps (a company platform for IT tickets, HR requests and help-center articles) Assist, an AI helper inside a company's ServiceApps (a company platform for IT tickets, HR requests and help-center articles) portal. Employees ask it IT and HR questions; it answers from knowledge-base (KB (knowledge base: a library of help articles)) articles, looks up the employee's own tickets (incidents (a ServiceApps ticket for something broken) like INC0012345) and requests, and keeps one conversation per employee and ticket.

The scenario. An employee explains a VPN problem over four messages. ServiceApps (a company platform for IT tickets, HR requests and help-center articles) Assist turns them into a profile.

Steps.

  1. Define the fields you need (name, department, asset, issue, since, deadline, tried).
  2. Ask the model to fill them as JSON (a simple text format for structured data) with a schema (a fixed form the AI's answer must fit) (see Output Guardrails: Schema Enforcement (requiring the AI's answer to match a fixed shape, checked in code)).
  3. Store the profile; update fields as new facts arrive.
  4. Pin the profile at the top of each call instead of the old chat.

The code (Python):

import json, re
chat = ["Hi, I'm Dana from Finance.", "Hello Dana! How can I help you today?",
        "My laptop LT-4471 won't connect to VPN since Monday.", "Sorry about that. Does it show an error code?",
        "No code, it just spins and then times out.", "Thanks. Have you tried restarting the laptop?",
        "I already restarted twice.", "Okay. Is this blocking your work right now?",
        "It's urgent, I have the quarter close on Friday.", "Understood, I'll treat this as high priority."]

def extract(lines):                              # stand-in for an AI call with a JSON schema
    text = " ".join(lines)
    return {"name": re.search(r"I'm (\w+)", text).group(1),
            "department": re.search(r"from (\w+)", text).group(1),
            "asset": re.search(r"\b[A-Z]{2}-\d{4}\b", text).group(0),
            "issue": "VPN won't connect, times out",
            "since": re.search(r"since (\w+)", text).group(1),
            "deadline": re.search(r"close on (\w+)", text).group(1),
            "already_tried": ["restart x2"]}

profile = extract(chat)
print(json.dumps(profile, indent=1))
print("pinned profile:", len(json.dumps(profile, separators=(",", ":"))), "chars, instead of the chat:", len(" ".join(chat)), "chars")

Output (from running the code above):

{
 "name": "Dana",
 "department": "Finance",
 "asset": "LT-4471",
 "issue": "VPN won't connect, times out",
 "since": "Monday",
 "deadline": "Friday",
 "already_tried": [
  "restart x2"
 ]
}
pinned profile: 163 chars, instead of the chat: 418 chars

What to watch for.

In plain terms: the assistant keeps a small form filled in as you talk, and reads the form instead of the whole chat.

In NurseOps Now

Built, a different way. The AI review extracts the request's key fields (member (a person covered by the health plan), CPT code (a standard code for a medical procedure), ICD-10 (a standard code for a diagnosis) codes, provider (the doctor or clinic asking for the test)) into a validated JSON (a simple text format for structured data) result stored in the ai_reviews table, and AI Assist (the app's chat helper for staff questions) fetches case facts with a tool (a function the AI can call, such as policy search) instead of keeping a profile in the prompt (the instructions and text given to the AI). See Step 4.

Trade-offs

Interview answer

"I extract the facts that matter into a typed record (asset, issue, deadline, what was tried) and pin that at the top of each call. The record is validated with a schema (a fixed form the AI's answer must fit), and it survives any amount of chat compression because it's not chat."

All data in this post is made up. No real people, tickets or patient data.

← Back to all 27 solutions in the state management blog

Key terms

Every highlighted word in this post links here. Click ↩ Back to return to the spot you came from.

AI Assist
The app's chat helper for staff questions.Used in: In NurseOps Now↩ Back to where you were
context window
Everything sent to the AI in one call; it has a size limit.Used in: The problem it solves↩ Back to where you were
CPT code
A standard code for a medical procedure.Used in: In NurseOps Now↩ Back to where you were
entity extraction
Pulling key facts (names, dates, IDs) out of text into a structured record.Used in: In plain words↩ Back to where you were
hallucination drift
Details slowly changing as summaries are summarized again.Used in: The problem it solves↩ Back to where you were
ICD-10
A standard code for a diagnosis.Used in: In NurseOps Now↩ Back to where you were
incident
A ServiceApps ticket for something broken.Used in: How to implement it (ServiceApps)↩ Back to where you were
JSON
A simple text format for structured data.Used in: The problem it solves, How to implement it (ServiceApps), In NurseOps Now↩ Back to where you were
KB
Knowledge base: a library of help articles.Used in: How to implement it (ServiceApps)↩ Back to where you were
member
A person covered by the health plan.Used in: In NurseOps Now↩ Back to where you were
output guardrails: schema enforcement
Requiring the AI's answer to match a fixed shape, checked in code.Used in: How to implement it (ServiceApps)↩ Back to where you were
prompt
The instructions and text given to the AI.Used in: In plain words, In NurseOps Now↩ Back to where you were
provider
The doctor or clinic asking for the test.Used in: In NurseOps Now↩ Back to where you were
sanitization layer
Code that masks personal details and secrets before anything is saved.Used in: How to implement it (ServiceApps)↩ Back to where you were
schema
A fixed form the AI's answer must fit.Used in: How to implement it (ServiceApps), Interview answer↩ Back to where you were
ServiceApps
A company platform for IT tickets, HR requests and help-center articles.Used in: How to implement it (ServiceApps)↩ Back to where you were
thread
One saved conversation, here one per user and case.Used in: In plain words↩ Back to where you were
tool
A function the AI can call, such as policy search.Used in: In NurseOps Now↩ Back to where you were