Skip to article
IICTPIICTP

Blog / AI & Machine Learning / Applied AI & Agents

Applied AI & AgentsDecember 4, 20268 MIN READ

Five MedGemma 2 use cases you can build, with steps and checks

Short answer: five practical things to build with MedGemma 2 are record queries through tools, clinical score calculations run as code, answers that cite your own protocols, document extraction and an offline assistant. In each one the model proposes, ordinary software checks, and a qualified person decides.

Three steps: a case note and task, MedGemma 2 writing reasoning and Python code, and an isolated sandbox returning creatinine clearance of 41.0 mL/min
Image: Google Research, MedCalc workflow figure. Illustrative, not clinical guidance.

TL;DR The short version

  • Five builds: record queries, clinical calculations, cited protocol answers, document extraction and an offline assistant.
  • The model proposes, ordinary software checks, and a qualified person decides.
  • Start with invented patients and measure invented values and correct refusals before a pilot.
In this post
  1. TL;DR
  2. What rule applies to all five?
  3. Use case 1: ask questions of patient records
  4. Use case 2: calculate clinical scores with code
  5. Use case 3: answer from your own protocols with citations
  6. Use case 4: turn documents into structured data
  7. Use case 5: an offline assistant at the point of care
  8. How can you use it if you are not a developer?
  9. What should you measure before a pilot?
  10. Frequently asked questions
  11. Related reading
  12. Sources and further reading

Short answer: five practical things to build with MedGemma 2 are record queries through tools, clinical score calculations run as code, answers that cite your own protocols, document extraction and an offline assistant. In each one the model proposes, ordinary software checks, and a qualified person decides.

What rule applies to all five?

MedGemma 2 is a starting point for developers, not a clinical tool. Google says its outputs are not intended to directly inform diagnosis, patient management or treatment, and need independent verification. Use synthetic or properly de-identified data while you build.

Build every use case on invented patients first. Set up the model with Ollama before you start.

Use case 1: ask questions of patient records

Google says MedGemma 2 can generate FHIR and SQL queries and handle several rounds of tool calls. Give it narrow, read-only functions instead of database access.

  1. Write one read-only tool. Return only the fields the question needs. This one uses made-up data.

    def get_latest_lab(patient_id: str, test: str) -> str:
        """Latest lab result for a patient.
    
        Args:
          patient_id: Patient identifier
          test: Lab test name, for example creatinine
        """
        fake = {('demo-1', 'creatinine'): '1.4 mg/dL on 2026-11-30'}
        return fake.get((patient_id, test.lower()), 'no result found')
  2. Let the model call it. The model asks for the tool, your code runs it, and the result goes back for the answer.

    from ollama import chat
    
    messages = [{'role': 'user', 'content': 'What is the latest creatinine for patient demo-1?'}]
    r = chat(model='medgemma2', messages=messages, tools=[get_latest_lab])
    messages.append(r.message)
    for call in r.message.tool_calls or []:
        if call.function.name == 'get_latest_lab':
            messages.append({'role': 'tool', 'tool_name': 'get_latest_lab',
                             'content': get_latest_lab(**call.function.arguments)})
    print(chat(model='medgemma2', messages=messages).message.content)
  3. Enforce access outside the model. Check in code that this user may see this patient. Never rely on the prompt for permission.

  4. Log and test. Record each call and result. Include a missing result and a wrong patient ID in your tests.

Use case 2: calculate clinical scores with code

Google’s example has the 26B model reason about a creatinine clearance case and write Python, which a separate sandbox runs.

Three steps: a case note and task, MedGemma 2 writing reasoning and Python code, and an isolated sandbox returning creatinine clearance of 41.0 mL/min
Image: Google Research, MedCalc workflow figure. Illustrative, not clinical guidance.
  1. Ask for code, not a number. Request Python that stores the result in one named variable.

  2. Run it with no network. Treat generated code as untrusted. Save it as calc.py and run it in a throwaway container.

    docker run --rm -i --network none --read-only --memory 256m --cpus 1 \
      python:3.12-slim python - < calc.py
  3. Compare with a reviewed formula. For scores you use often, keep your own tested function and flag any difference. This reproduces Google’s example case.

    def crcl_female_adjusted(age, height_cm, weight_kg, creatinine_mg_dl):
        ibw = 45.5 + 2.3 * (height_cm / 2.54 - 60)
        adjusted = ibw + 0.4 * (weight_kg - ibw)  # for overweight patients
        return (140 - age) * adjusted / (72 * creatinine_mg_dl) * 0.85
    
    assert round(crcl_female_adjusted(49, 155.5, 61.0, 1.4), 1) == 41.0
  4. Show the working. Display inputs, units and formula to the clinician, not only the result.

Use case 3: answer from your own protocols with citations

  1. Collect approved documents. Use current versions with an owner and a review date.

  2. Retrieve before you ask. Search the documents, then place only the matching passages in the prompt, each with an ID.

  3. Demand a citation or a refusal. Use an instruction like this one.

    Answer only from the passages below. After each claim give the passage ID in brackets.
    If the passages do not answer the question, reply: not covered in the supplied documents.
  4. Verify the citation in code. Reject answers that cite an ID you did not send, and let the reader open the passage.

Use case 4: turn documents into structured data

Ollama’s page lists PDF to FHIR or JSON extraction and clinical coding such as LOINC.

  1. Get the text or page image. Convert the PDF with a normal library, or send page images.

  2. Extract against a schema. Allow empty values so the model is not pushed to invent them. The setup guide shows the code.

  3. Validate every field. Check units, ranges, dates and that each value appears in the source.

  4. Confirm codes against the official list. Look up each suggested code in your terminology service. Do not accept a code because it looks right.

  5. Route doubts to a person. Anything failing a check goes to a review queue.

Use case 5: an offline assistant at the point of care

The E4B model is small enough for phones, tablets and laptops, which matters where connectivity is poor.

  1. Choose the build. Take the E4B checkpoint for LiteRT-LM. Google gives about 4 to 5 GB of inference memory for the mixed 4-bit and 8-bit build.

  2. Limit the scope. Reference lookup, note drafting or form filling, with a visible statement of what it must not be used for.

  3. Test on the real device. Measure speed, battery, heat and accuracy on the cheapest device you will support.

  4. Plan updates and loss. Encrypt stored data, require a lock screen and decide how a new model version reaches offline devices.

How can you use it if you are not a developer?

  • Clinicians: supply realistic de-identified test cases and mark the answers. That is the most valuable input a project can get.
  • Managers: ask for the error count, the review step and the named owner before a pilot.
  • Students: use it to practise query writing and evaluation on synthetic records, and check facts against textbooks and guidelines.
  • Security and compliance teams: map data flows, retention and access, and check the rules that apply to medical software where you work.

What should you measure before a pilot?

MeasureQuestion it answers
Correct on your test setDoes it do the task?
Made-up values per 100 casesHow often does it invent?
Correct refusalsDoes it say when data is missing?
Citation accuracyDoes the cited text support the claim?
Reviewer time per caseDoes it save work after checking?
Results by patient groupIs anyone served worse?

Sources were read on 4 December 2026. We have not benchmarked or run MedGemma 2 ourselves, and tags, sizes and terms can change, so check the linked originals.

Frequently asked questions

  • What is MedGemma 2 used for? Building health software that queries records, runs calculations, grounds answers in sources, extracts data and reads some kinds of medical image.
  • Can it write orders into a record? Only if your software lets it. Keep write actions behind explicit human approval.
  • Can I fine-tune it? Google publishes fine-tuning notebooks at github.com/google-health/medgemma.

Sources and further reading

  1. Google Research. Fereshteh Mahvar and Maddie Traverse. Introducing MedGemma 2: Our most capable open model for health AI developers. 3 December 2026. https://research.google/blog/introducing-medgemma-2-our-most-capable-open-model-for-health-ai-developers/
  2. Google. Gaurav Mohta and Daniel Golden. Introducing MedGemma 2: our most advanced open model for healthcare. 3 December 2026. https://blog.google/innovation-and-ai/technology/health/medgemma-2/
  3. Ollama. medgemma2 library page and tags. https://ollama.com/library/medgemma2
  4. Ollama documentation: tool calling. https://docs.ollama.com/capabilities/tool-calling
  5. Google Health. MedGemma notebooks. https://github.com/google-health/medgemma
  6. Google. Health AI Developer Foundations terms of use. https://developers.google.com/health-ai-developer-foundations/terms
Cite this article

Go deeper: AIP™ credential · the TPBOK™ standard · Domain: Applied AI & Emerging Tech Integration · Check your experience

IICTP is an independent technical credentialing body.

Practitioners on Contour

New guides in your inbox

Plain-language guides on technical practice, now and then. You confirm your address first, and you can unsubscribe at any time.

Keep reading

← All posts

Where do you stand?

Find the credential that fits the work you do.

Keyboard shortcuts

LListen, pause or resume
SSave or unsave this post
FFocus mode on or off
TJump to the TL;DR
NNext post in this topic
PPrevious post in this topic
QCopy a link to the selected text
?Show this list