OpenMed's open model for finding diseases in Spanish clinical text. It returns every disease mention in Spanish clinical text with exact character offsets and a confidence score. Trained and evaluated by OpenMed. Apache-2.0, runs on CPU.
| Developed by | OpenMed |
|---|---|
| Task | Disease mention extraction, one label: Disease |
| Output | text, start, end, score; text[start:end] is the exact span |
| Parameters | 308M |
| Decoding | Highest-scoring tag per token, no threshold |
| Language | Spanish |
| License | Apache-2.0 |
About OpenMed
OpenMed builds open models and open-source tools for clinical and biomedical text that run on your own hardware.
- 2,300+ open models on Hugging Face for clinical NER, de-identification and more.
- The OpenMed Python SDK, Apache-2.0:
pip install openmedfor de-identification, clinical NER, and FHIR and HL7 tooling, all local. - New models every week: follow OpenMed on Hugging Face and @OpenMed_AI on X.
Quick start
pip install -U "openmed[hf]" # OpenMed 3.1 or later
from openmed import analyze_text
text = (
"Varón de 67 años con diabetes mellitus tipo 2, "
"enfermedad renal crónica estadio 3 y fibrilación "
"auricular, que ingresa por una neumonía adquirida en "
"la comunidad."
)
result = analyze_text(
text,
model_id="OpenMed/mmBERT-ClinicalNER-Disease-Spanish-Base-v1",
sentence_language="es",
)
for e in result.entities:
print(e.start, e.end, e.text, f"{e.confidence:.2f}")
21 45 diabetes mellitus tipo 2 1.00
47 71 enfermedad renal crónica 1.00
84 105 fibrilación auricular 1.00
127 135 neumonía 1.00
Long notes, many notes, GPU
- Pass a whole note:
analyze_textsplits it into sentences (sentence_language="es") and returns offsets into the original text. - The model loads once and stays cached, so call
analyze_textin a loop for many notes. - On a GPU, pass
config=OpenMedConfig(device="cuda")(from openmed import OpenMedConfig).
Evaluation
DisTEMIST, 150 held-out documents: Spanish clinical case reports with 1,723 human-annotated disease mentions, nested ones included. The model was trained on 452 other DisTEMIST documents, its settings were chosen on 148 more, and these 150 were scored once at the end. A prediction counts only if its character span matches exactly. The official DisTEMIST test set was not used, so these numbers are not comparable to the shared-task leaderboard.
| Model | Precision | Recall | F1 |
|---|---|---|---|
| OpenMed mmBERT ClinicalNER Disease Spanish Base v1 (this model) | 67.11 | 73.07 | 69.96 |
| Reference, no Spanish disease training: fastino/gliner2.5-multi-v1, threshold 0.7 | 38.14 | 40.05 | 39.07 |
jhu-clsp/mmBERT-base has no disease tagger before fine-tuning, so the reference is the multilingual GLiNER2.5 extractor on the same documents. This model scores +30.9 F1 points above it (95% CI +27.9 to +33.6, paired bootstrap over 142 groups of documents from the same publication).
The OpenMed Spanish disease models
Same training documents, same test documents, each model at its default setting.
| Model | Parameters | Precision | Recall | F1 |
|---|---|---|---|---|
| OpenMed GLiNER2.5 ClinicalNER Disease Spanish v1 | 287M | 74.53 | 72.03 | 73.26 |
| OpenMed mmBERT ClinicalNER Disease Spanish Base v1 (this model) | 308M | 67.11 | 73.07 | 69.96 |
Examples
Real outputs of this model through the OpenMed SDK, with default settings, on CPU. The sentences are synthetic, written in Spanish for this card. Extracted spans are in bold with their scores.
- Clinical note: Varón de 67 años con diabetes mellitus tipo 21.00, enfermedad renal crónica1.00 estadio 3 y fibrilación auricular1.00, que ingresa por una neumonía1.00 adquirida en la comunidad.
- Abbreviations: Antecedentes: HTA1.00, DM21.00, EPOC0.98 e IC0.62. Ingresa por una reagudización de EPOC1.00.
- Oncology genetics: Las variantes germinales de BRCA1 y BRCA2 aumentan el riesgo de cáncer de mama1.00 y de cáncer de ovario1.00.
- Rare inherited disease: La poliquistosis renal autosómica dominante1.00 es la causa hereditaria más frecuente de enfermedad renal terminal1.00.
- Adverse drug events: Dos pacientes presentaron una hepatotoxicidad inducida por fármacos1.00 y uno un síndrome de Stevens-Johnson1.00 tras iniciar el nuevo tratamiento.
- Neurology differential: La resonancia magnética era compatible con esclerosis múltiple1.00; la neuromielitis óptica1.00 y la encefalomielitis aguda diseminada1.00 se consideraron menos probables.
- Hematology: La biopsia confirmó un linfoma difuso de células B grandes1.00 en una paciente con síndrome de Sjögren1.00 y anemia hemolítica autoinmune1.00 de larga evolución.
- Infection before biologics: Se trató una tuberculosis latente1.00 antes de iniciar adalimumab por su artritis reumatoide1.00.
- Newborn screening: El cribado neonatal detectó fibrosis quística1.00, hipotiroidismo congénito1.00 y fenilcetonuria1.00, pendientes de confirmación.
- Cardiology: El ecocardiograma mostró una miocardiopatía hipertrófica1.00 con insuficiencia mitral moderada1.00, sin derrame pericárdico1.00.
- Negation and family history: Sin antecedentes de asma1.00 ni de epilepsia1.00. Su madre padecía la enfermedad de Huntington1.00.
- Medications only: Se inicia metformina 850 mg cada 12 horas y enalapril 10 mg al día; control en cuatro semanas. (nothing extracted)
A longer note (1,246 characters, 22 spans) in one analyze_text call:
INFORME DE ALTA
Motivo de ingreso: mujer de 72 años con insuficiencia cardiaca con fracción de eyección reducida, enfermedad pulmonar obstructiva crónica y diabetes mellitus tipo 2 que consulta por disnea progresiva de tres días, ortopnea y edemas en ambas piernas.
Evolución: la radiografía de tórax mostró edema pulmonar y un pequeño derrame pleural derecho. La troponina estaba levemente elevada sin curva, y se descartó un síndrome coronario agudo. Se trató con furosemida intravenosa. Al segundo día presentó una insuficiencia renal aguda, que mejoró al reducir la dosis del diurético. Una infección urinaria se trató con fosfomicina. El ingreso se complicó además con un delirium, resuelto al alta.
Antecedentes: hipertensión arterial, dislipemia, artrosis de ambas rodillas, enfermedad por reflujo gastroesofágico y un cáncer de mama tratado hace años con tumorectomía y radioterapia. Sin antecedentes de ictus. Su padre falleció de un cáncer colorrectal.
Diagnósticos al alta: insuficiencia cardiaca descompensada; insuficiencia renal aguda, resuelta; infección urinaria; delirium, resuelto.
Seguimiento: consulta de cardiología en dos semanas con analítica de control; descartar apnea del sueño y anemia ferropénica de forma ambulatoria.
Good to know
- It finds mentions, including negated ones: Sin antecedentes de asma ni de epilepsia still returns
asmaandepilepsia(example 11). OpenMed'sassert_contextrules are written for English and have not been validated on Spanish, so check negation and family history yourself. - Abbreviations work: HTA, DM2, EPOC and IC are found in example 2 (IC with a lower score, 0.62).
- Scores are averaged tag probabilities and sit near 1.00 (30 of 32 example spans round to 1.00), so use them to rank spans, not as calibrated probabilities.
- It tags tokens with one flat label sequence, so it returns one mention where the annotators marked a mention inside another; the evaluation still counts every annotated mention.
- Symptoms are not diseases: disnea, ortopnea and edemas in the longer note are not returned, following the DisTEMIST annotation guidelines.
- Drug names are not diseases: example 12 returns nothing.
Limitations
- Trained and tested on Spanish clinical case reports published in the medical literature (DisTEMIST). It has not been validated on hospital notes; the notes above are synthetic.
- Spanish only, one label. Other labels and the base model's other tasks were not evaluated after fine-tuning.
- No normalization: spans are not mapped to SNOMED CT or ICD-10 codes.
- It finds text spans. It does not diagnose anything and is not a medical device.
Built on
OpenMed fine-tuned this model from jhu-clsp/mmBERT-base by Johns Hopkins University CLSP (MIT), built with the open-source Transformers library. Training and evaluation data: the DisTEMIST corpus of Spanish clinical case reports by Miranda-Escalada et al. (CC BY 4.0). Thank you to Johns Hopkins University CLSP and to the DisTEMIST authors for releasing their work openly.
This model is released under Apache-2.0. No corpus text is included in this repository.
Citation
@misc{panahi2025openmedner,
title={OpenMed NER: Open-Source, Domain-Adapted State-of-the-Art Transformers for Biomedical NER Across 12 Public Datasets},
author={Maziyar Panahi},
year={2025},
eprint={2508.01630},
archivePrefix={arXiv}
}
@inproceedings{miranda2022overview,
title={Overview of DisTEMIST at BioASQ: Automatic detection and normalization of diseases from clinical texts: results, methods, evaluation and multilingual resources},
author={Miranda-Escalada, Antonio and Gasc{\'o}, Luis and Lima-L{\'o}pez, Salvador and Farr{\'e}-Maduell, Eul{\`a}lia and Estrada, Darryl and Nentidis, Anastasios and Krithara, Anastasia and Katsimpras, Georgios and Paliouras, Georgios and Krallinger, Martin},
booktitle={Working Notes of the Conference and Labs of the Evaluation Forum (CLEF), CEUR Workshop Proceedings},
year={2022}
}
@misc{marone2025mmbert,
title={mmBERT: A Modern Multilingual Encoder with Annealed Language Learning},
author={Marc Marone and Orion Weller and William Fleshman and Eugene Yang and Dawn Lawrie and Benjamin Van Durme},
year={2025},
eprint={2509.06888},
archivePrefix={arXiv}
}