aemps-cima / README.md
hsilvosa's picture
Publish AEMPS CIMA current-state research snapshot
05da2dd verified
|
Raw
History Blame Contribute Delete
6.76 kB
---
license: other
language:
- es
pretty_name: AEMPS CIMA Research Dataset
tags:
- medicine
- public-data
- regulatory
- knowledge-graph
configs:
- config_name: active_ingredients
data_files:
- split: train
path: data/active_ingredients/*.parquet
- config_name: administration_routes
data_files:
- split: train
path: data/administration_routes/*.parquet
- config_name: atc_codes
data_files:
- split: train
path: data/atc_codes/*.parquet
- config_name: document_links
data_files:
- split: train
path: data/document_links/*.parquet
- config_name: documents
data_files:
- split: train
path: data/documents/*.parquet
- config_name: excipients
data_files:
- split: train
path: data/excipients/*.parquet
- config_name: medications
data_files:
- split: train
path: data/medications/*.parquet
- config_name: photos
data_files:
- split: train
path: data/photos/*.parquet
- config_name: presentations
data_files:
- split: train
path: data/presentations/*.parquet
---
# AEMPS CIMA Research Dataset
This directory builds a research-ready snapshot of CIMA, the medicine information system maintained by the Spanish Agency of Medicines and Medical Devices (AEMPS).
The source exposes official information about authorized and non-authorized medicines, commercial presentations, active ingredients, ATC codes, pharmaceutical forms, administration routes, regulatory status, safety-related indicators, segmented summaries of product characteristics and patient leaflets.
The project is intended exclusively for research and data exploration. It is not medical advice and must not be used to make prescribing, dispensing, diagnosis, treatment, regulatory, or safety decisions. Users should consult AEMPS and qualified healthcare professionals for current authoritative information.
## Original source and credit
All source records are provided by **Agencia Española de Medicamentos y Productos Sanitarios (AEMPS)** through CIMA.
- CIMA: <https://cima.aemps.es/cima/publico/home.html>
- REST API documentation, version 1.23: <https://cima.aemps.es/cima/resources/docs/CIMA_REST_API.pdf>
- AEMPS open data statement: <https://sede.aemps.gob.es/datos-abiertos/>
AEMPS describes these data as public and reusable, subject where applicable to source attribution. The generated provenance file records the exact retrieval time and source endpoints. Before public release, the maintainer must review the current AEMPS legal notice and set the precise Hugging Face license metadata if a standard license identifier applies.
## Hugging Face contents
The staging process creates one dataset configuration per relational table. Every configuration uses a single `train` split because CIMA is an entity and document collection, not a predefined supervised-learning benchmark.
| Configuration | Unit | Main content |
|---|---|---|
| `medications` | One medicine registration | Names, regulatory state, prescription and safety flags, dose and pharmaceutical form |
| `presentations` | One commercial presentation | National code, status, commercialization and supply flags |
| `active_ingredients` | One medicine–ingredient edge | Ingredient identifiers and names |
| `excipients` | One medicine–excipient edge | Excipient identifiers, amounts, units, and ordering |
| `atc_codes` | One medicine–ATC edge | ATC code, description and level |
| `administration_routes` | One medicine–route edge | Route identifiers and descriptions |
| `documents` | One segmented document section | Product information or patient leaflet section in HTML and plain text |
| `document_links` | One source document reference | Document type, URL and segmented-content availability |
| `photos` | One source image reference | Packaging or pharmaceutical-form image URLs and update times |
No raw API responses are uploaded. The release also includes machine-readable schema, profile, quality, provenance, and checksum files.
This first release is a complete current-state snapshot at the retrieval date. Historical change events are intentionally excluded: they are not required to represent the current catalogue, and collecting the full event register would substantially delay publication. A future release may expose history as a separate dataset configuration.
## Installation
Python 3.11 or newer is recommended.
```bash
cd aemps-cima
python -m venv .venv
python -m pip install -e ".[dev]"
```
## Usage
Run a small end-to-end sample first:
```bash
cima-pipeline run --config configs/sample.json
```
Run the full snapshot:
```bash
cima-pipeline run --config configs/default.json
```
The `run` command downloads, normalizes, profiles, validates, and stages the release. Individual stages are also available:
```bash
cima-pipeline download --config configs/default.json
cima-pipeline normalize --config configs/default.json
cima-pipeline analyze --config configs/default.json
cima-pipeline stage --config configs/default.json
```
The default configuration excludes the historical change register. Set
`include_change_register` to `true` only when intentionally building a separate historical
release; that endpoint contains more than one million events and is not needed for the
current-state snapshot.
Inspect `hf_staging/` before publishing. Uploading is deliberately separate and explicit:
```bash
cima-pipeline upload --config configs/default.json --repo-id ORGANIZATION/DATASET_NAME
```
Set `HF_TOKEN` in the environment or authenticate with the Hugging Face CLI. The upload command never includes `data/raw`.
## Storage lifecycle
After a release is verified on Hugging Face, delete `data/raw`, `data/processed`, and `hf_staging` locally. They are reproducible and ignored by Git. Keep the code, configuration, schemas, tests, and lightweight `artifacts` metadata in the repository.
## Splits, classes, and limitations
There is no target label and therefore no class count. Fields such as ATC group, regulatory state, prescription status, and pharmaceutical form are categorical attributes, not benchmark classes. All configurations contain a 100% `train` split. Researchers creating prediction tasks should define their own patient-safe, leakage-aware, and preferably temporal evaluation design.
CIMA changes over time. A snapshot can become outdated, records may be corrected retrospectively, text availability varies by medicine, and relationships reflect the source representation at retrieval time. Dates returned by the API require careful timezone interpretation. The pipeline preserves source values and records its normalization decisions.