Skip to content
maxenglischPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Bachelor Thesis — Medical Letter Anonymization Pipeline (Demo)

This repository is a demonstrative snapshot of the infrastructure and architecture used in my bachelor’s thesis. It shows how the PHI extraction / anonymization pipeline is wired across three backends:

  1. Azure OpenAI / Azure AI (cloud models: GPT-5 family, GPT-OSS-120B, Llama 4, …)
  2. LM Studio (local OpenAI-compatible server)
  3. GPT-OSS-120B on AKS via vLLM (Kubernetes YAML deployment on a GPU node)

It is not a runnable end-to-end dataset release. Real medical letters, ground-truth annotations, and API credentials are intentionally omitted.


What’s here

Path Role
Code/anonymize.py Main pipeline: load letters → call LLM for PHI extraction → anonymize → optional ground-truth comparison / metrics
Code/llm_prompt_config.py System/user prompts and JSON schema for German PHI categories
Code/model_call.py Backend clients and call logic (Azure, LM Studio / OpenAI-compatible, cost helpers)
Code/run_cluster_anonymize.py Thin cluster entrypoint; configures env vars then runs anonymize.main
Code/normalize_documents.py Document normalization (.txt / .docx)
Code/LM_STUDIO_SETUP.md Short guide for local LM Studio usage
infra/gpt-oss-120b/ AKS manifests/templates: namespace, PVC, vLLM Deployment/Service, runner Job
Dockerfile.cluster-runner Image that runs the anonymization job inside the cluster

Architecture (short)

Medical letters (your data)
        │
        ▼
  anonymize.py  ◄── prompts/schema from llm_prompt_config.py
        │
        ├── Azure ──────────── model_call.call_azure_openai
        ├── LM Studio ──────── model_call.call_lm_studio  (localhost or remote OpenAI-compatible URL)
        └── AKS + vLLM ─────── same LM Studio path, pointed at in-cluster vLLM Service
                                    (infra/gpt-oss-120b/*.yaml)
  • Azure: keys and endpoints live as placeholders in model_call.py — replace with your own (preferably via environment variables).
  • Local: start LM Studio (or any OpenAI-compatible server) and set LM_STUDIO_BASE_URL if needed.
  • Cluster: render templates under infra/gpt-oss-120b/, deploy vLLM on a GPU nodepool, then run the Job that executes run_cluster_anonymize.py. See infra/gpt-oss-120b/README.md.

What’s missing (on purpose)

  • API keys / Azure endpoints / deployment names — placeholders only (<your-api-key>, <your-endpoint>, …)
  • Medical evaluation data — e.g. data/GLG_enhanced/, ground-truth JSON, renonymized case modules, annotation/log outputs
  • Cluster secrets — no kubeconfig, ACR credentials, or cloud login material

To reuse this pipeline: plug in your own keys, point paths at your own licensed data, and adjust model/deployment names to match your environment.


Disclaimer

Provided for architecture demonstration and educational reuse of the pipeline layout. Do not commit real patient data or production credentials into a public fork of this repo.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages