Dataset Viewer
Auto-converted to Parquet Duplicate
chunk_id
stringlengths
12
31
module
stringclasses
19 values
section
stringclasses
11 values
source_page
stringlengths
1
7
source_file
stringclasses
19 values
text
stringlengths
768
10.8k
embeddings
listlengths
384
384
Annex I_0000
Annex I
1
Annex I.pdf
26 July 2024 EMA/876333/2011 Rev 5* Guideline on good pharmacovigilance practices (GVP) Annex I - Definitions (Rev 5) Date for coming into effect of first version 2 July 2012 Date for coming into effect of Revision 1 13 December 2012 Date for coming into effect of Revision 2 8 January 2014 Date for coming into effect o...
[ -0.07143712788820267, -0.009018485434353352, 0.055038921535015106, -0.008645111694931984, 0.015048806555569172, 0.0007985435076989233, 0.010687844827771187, 0.03303534910082817, -0.007171211298555136, -0.011221623979508877, 0.022316599264740944, 0.022672558203339577, -0.05097543075680733, ...
Annex I_0001
Annex I
1
Annex I.pdf
26 July 2024 EMA/876333/2011 Rev 5* Guideline on good pharmacovigilance practices (GVP) Annex I - Definitions (Rev 5) Date for coming into effect of first version 2 July 2012 Date for coming into effect of Revision 1 13 December 2012 Date for coming into effect of Revision 2 8 January 2014 Date for coming into effect o...
[ -0.07143712788820267, -0.009018485434353352, 0.055038921535015106, -0.008645111694931984, 0.015048806555569172, 0.0007985435076989233, 0.010687844827771187, 0.03303534910082817, -0.007171211298555136, -0.011221623979508877, 0.022316599264740944, 0.022672558203339577, -0.05097543075680733, ...
Annex I_0002
Annex I
1-2
Annex I.pdf
26 July 2024 EMA/876333/2011 Rev 5* Guideline on good pharmacovigilance practices (GVP) Annex I - Definitions (Rev 5) Date for coming into effect of first version 2 July 2012 Date for coming into effect of Revision 1 13 December 2012 Date for coming into effect of Revision 2 8 January 2014 Date for coming into effect o...
[ -0.07143712788820267, -0.009018485434353352, 0.055038921535015106, -0.008645111694931984, 0.015048806555569172, 0.0007985435076989233, 0.010687844827771187, 0.03303534910082817, -0.007171211298555136, -0.011221623979508877, 0.022316599264740944, 0.022672558203339577, -0.05097543075680733, ...
Annex I_0003
Annex I
1-3
Annex I.pdf
Reproduction is authorised provided the source is acknowledged. - Addition of the definition of Immunisation stress-related response (ISRR) which has become available since GVP A I Rev 4, to supplement the other definitions relating to adverse events following immunisation; - Deletion of Footnote 11 of GVP A I Rev 4 re...
[ -0.006384676322340965, 0.01721244677901268, 0.036722492426633835, -0.025387199595570564, 0.0045662811025977135, -0.04355921968817711, 0.0420246347784996, 0.02730717323720455, -0.02633768506348133, -0.013206182979047298, -0.0016144978580996394, -0.028167277574539185, -0.026607533916831017, ...
Annex I_0004
Annex I
2-4
Annex I.pdf
Guideline on good pharmacovigilance practices (GVP) – Annex I (Rev 5) EMA/876333/2011 Rev 5 of 26 July 2024 Page 2/32 Table of contents Abuse of a medicinal product ........................................................................................ 6 Active substance ..................................................
[ -0.059003353118896484, -0.014824177138507366, 0.04002958536148071, -0.04941130056977272, 0.03202114626765251, -0.011602986603975296, 0.08680175244808197, 0.06109681352972984, -0.02979184128344059, -0.004723636899143457, -0.018032602965831757, -0.02542627789080143, 0.0015143622877076268, 0....
Annex I_0005
Annex I
4-6
Annex I.pdf
21 Potential risk ............................................................................................................ 22 Primary data collection .............................................................................................. 22 Quality adherence .....................................................
[ -0.011733535677194595, 0.016216032207012177, -0.019701655954122543, -0.03422300145030022, 0.03373197466135025, 0.015541939996182919, 0.0016605894779786468, 0.010541100986301899, 0.023947780951857567, -0.027759643271565437, -0.004497022833675146, -0.024936040863394737, 0.024841777980327606, ...
Annex I_0006
Annex I
6-7
Annex I.pdf
See also Substance Advanced therapy medicinal product (ATMP) A medicinal product for human use that is either a gene therapy medicinal product, a somatic cell therapy product or a tissue engineered products as defined in Regulation (EC) No 1394/2007 [Reg (EC) No 1394/2007 Art 1(1)]. Adverse event (AE) In the context of...
[ -0.036135606467723846, -0.007090410217642784, 0.0024883735459297895, -0.03872315585613251, 0.05030147358775139, -0.04549887776374817, 0.10755527764558792, 0.06668183207511902, -0.01726429909467697, -0.017538975924253464, 0.0036047729663550854, -0.029556619003415108, 0.011910795234143734, -...
Annex I_0007
Annex I
6-7
Annex I.pdf
Therefore all spontaneous reports notified by healthcare professionals or consumers are considered suspected adverse reactions, since they convey the Guideline on good pharmacovigilance practices (GVP) – Annex I (Rev 5) EMA/876333/2011 Rev 5 of 26 July 2024 Page 6/32 suspicions of the primary sources, unless the primar...
[ -0.00023935614444781095, 0.021626433357596397, -0.004448900930583477, -0.03640789911150932, 0.0498209223151207, -0.017682934179902077, 0.08686062693595886, 0.06675777584314346, 0.008809595368802547, -0.01586504466831684, 0.008472077548503876, 0.0161972027271986, -0.03490995988249779, 0.037...
Annex I_0008
Annex I
7-8
Annex I.pdf
5th ed. Altamonte Springs, FL: The IIA Research Foundation; 2003. Guideline on good pharmacovigilance practices (GVP) – Annex I (Rev 5) EMA/876333/2011 Rev 5 of 26 July 2024 Page 7/32 Biological medicinal product A medicinal product, the active substance of which is a biological substance [DIR 2001/83/EC, Annex 1, Part...
[ -0.03085530549287796, 0.0008684711647219956, 0.005629062652587891, -0.03895058482885361, 0.047886334359645844, -0.03360136225819588, 0.08669260889291763, 0.03919365629553795, -0.03060709498822689, 0.008586855605244637, -0.012002180330455303, -0.05408011004328728, 0.008647942915558815, -0.0...
Annex I_0009
Annex I
8-9
Annex I.pdf
This definition is also applicable to periodic safety update reports. See also Signal, Refuted signal Guideline on good pharmacovigilance practices (GVP) – Annex I (Rev 5) EMA/876333/2011 Rev 5 of 26 July 2024 Page 8/32 Company core data sheet (CCDS) For medicinal products, a document prepared by the marketing authoris...
[ -0.004876916762441397, -0.03643873706459999, 0.024618245661258698, -0.03319940343499184, 0.01099564041942358, 0.0029233661480247974, 0.05227884650230408, 0.032185137271881104, 0.019315596669912338, 0.04178209602832794, 0.009327864274382591, -0.061267342418432236, 0.020272759720683098, -0.0...
Annex I_0010
Annex I
9-10
Annex I.pdf
See also Validated signal, Signal management process, Signal confirmation by the PRAC Rapporteur or (lead) Member State, Signal analysis and prioritisation by the PRAC, Non-confirmed signal Consumer For the purpose of reporting cases of suspected adverse reactions, a person who is not a healthcare professional such as ...
[ -0.03690815716981888, 0.022944822907447815, 0.009521526284515858, -0.05598621442914009, 0.013178647495806217, -0.026087842881679535, 0.04476271569728851, 0.029995091259479523, -0.00033957924460992217, 0.02374764159321785, 0.03780561313033104, -0.025418298318982124, -0.026249874383211136, 0...
Annex I_0011
Annex I
10-11
Annex I.pdf
DHPCs are not replies to enquiries from healthcare professionals. Disease registry A patient registry whose members are defined by a particular disease or disease-related patient characteristic regardless of exposure to any medicinal product, other treatment or particular health service. See also Patient registry Guide...
[ -0.033423006534576416, -0.011965947225689888, 0.027708644047379494, -0.0730842724442482, 0.017507405951619148, -0.01760644093155861, 0.1044473946094513, 0.07020695507526398, -0.013181631453335285, 0.018095320090651512, 0.001617404050193727, -0.060218941420316696, 0.03179479390382767, -0.00...
Annex I_0012
Annex I
11-12
Annex I.pdf
Definition and application of terms of vaccine pharmacovigilance (report of CIOMS/WHO Working Group on Vaccine Pharmacovigilance). Genève: CIOMS; 2012. Guideline on good pharmacovigilance practices (GVP) – Annex I (Rev 5) EMA/876333/2011 Rev 5 of 26 July 2024 Page 11/32 This definition does not include unintentional qu...
[ -0.0060270740650594234, 0.008564031682908535, 0.01127700787037611, -0.07713374495506287, 0.026441311463713646, -0.022795911878347397, 0.10158506780862808, 0.046988289803266525, -0.021649440750479698, 0.012789467349648476, -0.031333841383457184, -0.04895365238189697, 0.007782282307744026, 0...
Annex I_0013
Annex I
12-13
Annex I.pdf
Herbal substances are precisely defined by the plant part used and the botanical name according to the binominal system [DIR 2001/83/EC Art 1(31)]. 7 The only exemption from this is that legally binding acts from the EU (e.g. Commission Decisions) do not directly confer rights and obligations but have first to be trans...
[ 0.036194488406181335, -0.031225210055708885, 0.027657506987452507, -0.03711896762251854, 0.051622048020362854, -0.03177174553275108, 0.13783618807792664, -0.00044430175330489874, -0.05520018935203552, 0.021048735827207565, -0.029774444177746773, -0.009415247477591038, -0.02891341783106327, ...
Annex I_0014
Annex I
13-14
Annex I.pdf
In a clinical trial, the comparator may be placebo, an active substance or non-exposure. Adverse reactions included in section 4.8 of the summary of product characteristics (SmPC) are also considered identified risks, unless they are class-related reactions which are mentioned in the SmPC but which are not specifically...
[ -0.01731030084192753, 0.0026384165976196527, -0.00661228084936738, -0.010845955461263657, 0.007699613459408283, -0.050783369690179825, 0.13388745486736298, 0.03598199039697647, -0.027499638497829437, 0.006516559515148401, -0.011330646462738514, -0.08455001562833786, 0.011338325217366219, 0...
End of preview. Expand in Data Studio

GVP Modules RAG Chunks

Structured chunked corpus of EMA Good Pharmacovigilance Practices (GVP) modules, prepared for Retrieval-Augmented Generation (RAG).

This dataset is designed to be used together with the Open-GVP family of models:

Dataset Summary

Item Details
Source Official EMA GVP Module PDFs
Chunking Sentence-aware packing (≈500 words, 2-sentence overlap) — identical to the chunking used for Open-GVP training data
Embeddings BAAI/bge-small-en-v1.5 (L2-normalized)
Index FAISS index included at faiss_index/gvp_embeddings.faiss

Fields

Field Type Description
chunk_id string Globally unique ID ({module}_{index:04d})
module string GVP module name (e.g. GVP_Module_VI)
section string Best-effort section / heading number
source_page string Page number or page range (e.g. "12" or "12-13")
source_file string Original PDF filename
text string Chunk content

How to Use

1. Load the dataset + FAISS index

from datasets import load_dataset
from huggingface_hub import hf_hub_download
from sentence_transformers import SentenceTransformer

DATASET_ID = "drvivekpoojary/gvp-modules-rag-chunks"

ds = load_dataset(DATASET_ID, split="train")

# Download and load the FAISS index
faiss_path = hf_hub_download(
    repo_id=DATASET_ID,
    filename="faiss_index/gvp_embeddings.faiss",
    repo_type="dataset"
)
ds.load_faiss_index("embeddings", faiss_path)

embedder = SentenceTransformer("BAAI/bge-small-en-v1.5")

2. Retrieve relevant chunks

query = "What are the reporting timeframes for fatal ICSRs according to GVP Module VI?"
query_emb = embedder.encode([query], normalize_embeddings=True)[0]

scores, retrieved = ds.get_nearest_examples("embeddings", query_emb, k=5)

for i, text in enumerate(retrieved["text"]):
    print(f"[{retrieved['module'][i]} | Page {retrieved['source_page'][i]} | {retrieved['section'][i]}]")
    print(text[:300], "...\n")

3. Full RAG Script (Transformers + Ollama)

Copy the complete script below. It supports two backends:

  • transformers — for users/testers with a GPU (4B / 7B / 14B + bf16 / 8bit / 4bit)
  • ollama — for users without a GPU (uses a local GGUF via Ollama)
"""
gvp_rag_query.py

Runs GVP RAG queries against the published dataset + FAISS index (downloaded
from HF Hub -- read-only here, no upload logic) and generates an answer via
one of two backends, covering all three scenarios in one script:

  My use / Testers (real GPU, 4B-14B range)
      -> BACKEND = "transformers"
      -> PRECISION selects bf16 / 8bit / 4bit per available VRAM, so the
         same script serves your own machine and any tester regardless of
         card size. This replaces hardcoding torch.bfloat16 + device_map="auto".

  Users (no GPU)
      -> BACKEND = "ollama"
      -> Talks to a local Ollama server running a GGUF build of the model.
         Retrieval (embedding + FAISS) is CPU-native either way, so only the
         generation step changes between backends.

Confirmed model repos:
  4B  -> drvivekpoojary/Open-GVP-Qwen3-4B-Instruct
  7B  -> drvivekpoojary/Open-GVP-Qwen2.5-7B-Instruct
  14B -> drvivekpoojary/Open-GVP-Qwen2.5-14B-Instruct (coming soon)

Each model repo ships a Modelfile. For Ollama:
  download the GGUF + Modelfile, then
  `ollama create <tag> -f Modelfile`
  and set OLLAMA_MODEL_NAME to <tag>.
"""

import requests
from datasets import load_dataset
from huggingface_hub import hf_hub_download
from sentence_transformers import SentenceTransformer

# ====================== SHARED CONFIG ======================
DATASET_ID = "drvivekpoojary/gvp-modules-rag-chunks"
FAISS_FILENAME = "faiss_index/gvp_embeddings.faiss"
EMBEDDING_MODEL = "BAAI/bge-small-en-v1.5"
TOP_K = 5

BACKEND = "transformers"  # "transformers" (My use / Testers) | "ollama" (Users)

# --- transformers backend ---
MODEL_TIERS = {
    "4b": "drvivekpoojary/Open-GVP-Qwen3-4B-Instruct",
    "7b": "drvivekpoojary/Open-GVP-Qwen2.5-7B-Instruct",
    "14b": "drvivekpoojary/Open-GVP-Qwen2.5-14B-Instruct",  # not yet uploaded
}
MODEL_TIER = "7b"
MODEL_ID = MODEL_TIERS[MODEL_TIER]

PRECISION = "4bit"  # "bf16" | "8bit" | "4bit" -- set per available VRAM
# Rough VRAM guide:
#   14B  bf16 ~28GB | 8bit ~14GB | 4bit ~8-9GB
#    7B  bf16 ~14GB | 8bit ~7GB  | 4bit ~5GB
#    4B  bf16 ~8GB  | 8bit ~4GB  | 4bit ~3GB

# --- ollama backend ---
OLLAMA_HOST = "http://localhost:11434"
OLLAMA_MODEL_NAME = "gvp-model:latest"  # tag from your `ollama create` / Modelfile
# =============================================================

SYSTEM_PROMPT = """You are an expert pharmacovigilance assistant specialized in EMA Good Pharmacovigilance Practices (GVP).
Answer the user's question accurately using ONLY the provided regulatory context.
If the context does not contain sufficient details, explicitly state the limitation.
Always reference the specific GVP Module, section, or page numbers where available."""


# ---------------- retrieval (shared, CPU-safe) ----------------
def load_retriever():
    print("Loading dataset + FAISS index...")
    ds = load_dataset(DATASET_ID, split="train")
    faiss_path = hf_hub_download(
        repo_id=DATASET_ID, filename=FAISS_FILENAME, repo_type="dataset"
    )
    ds.load_faiss_index("embeddings", faiss_path)
    embedder = SentenceTransformer(EMBEDDING_MODEL)
    return ds, embedder


def retrieve(ds, embedder, query: str, k: int = TOP_K) -> str:
    query_emb = embedder.encode([query], normalize_embeddings=True)[0]
    _scores, retrieved = ds.get_nearest_examples("embeddings", query_emb, k=k)
    parts = []
    for i in range(len(retrieved["text"])):
        parts.append(
            f"--- Chunk {i + 1} | {retrieved['module'][i]} | "
            f"Page {retrieved['source_page'][i]} | {retrieved['section'][i]} ---\n"
            f"{retrieved['text'][i]}"
        )
    return "\n\n".join(parts)


def build_user_content(query: str, context_str: str) -> str:
    return f"""CONTEXT FROM OFFICIAL EMA GVP GUIDELINES:
{context_str}

USER QUESTION:
{query}

INSTRUCTIONS:
Provide a precise, objective, and compliant regulatory response based strictly on the context above.
Cite the Module and page/section whenever possible."""


# ---------------- transformers backend (My use / Testers) ----------------
def load_transformers_model():
    import torch
    from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

    tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)

    kwargs = {"device_map": "auto"}
    if PRECISION == "bf16":
        kwargs["torch_dtype"] = torch.bfloat16
    elif PRECISION == "8bit":
        kwargs["quantization_config"] = BitsAndBytesConfig(load_in_8bit=True)
    elif PRECISION == "4bit":
        kwargs["quantization_config"] = BitsAndBytesConfig(
            load_in_4bit=True,
            bnb_4bit_quant_type="nf4",
            bnb_4bit_compute_dtype=torch.bfloat16,
        )
    else:
        raise ValueError(f"Unknown PRECISION: {PRECISION}")

    model = AutoModelForCausalLM.from_pretrained(MODEL_ID, **kwargs)
    return tokenizer, model


def generate_transformers(tokenizer, model, user_content: str) -> str:
    import torch

    messages = [
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": user_content},
    ]
    prompt = tokenizer.apply_chat_template(
        messages, tokenize=False, add_generation_prompt=True
    )
    inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
    with torch.no_grad():
        outputs = model.generate(
            **inputs,
            max_new_tokens=768,
            temperature=0.1,
            top_p=0.9,
            repetition_penalty=1.05,
            do_sample=True,
        )
    return tokenizer.decode(
        outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True
    ).strip()


# ---------------- ollama backend (Users, no GPU) ----------------
def generate_ollama(user_content: str) -> str:
    resp = requests.post(
        f"{OLLAMA_HOST}/api/chat",
        json={
            "model": OLLAMA_MODEL_NAME,
            "messages": [
                {"role": "system", "content": SYSTEM_PROMPT},
                {"role": "user", "content": user_content},
            ],
            "stream": False,
            "options": {"temperature": 0.1, "top_p": 0.9},
        },
        timeout=300,
    )
    resp.raise_for_status()
    return resp.json()["message"]["content"].strip()


# ---------------- dispatch ----------------
def answer_gvp_query(query: str, ds, embedder, model_state) -> str:
    context_str = retrieve(ds, embedder, query)
    user_content = build_user_content(query, context_str)

    if BACKEND == "transformers":
        tokenizer, model = model_state
        return generate_transformers(tokenizer, model, user_content)
    elif BACKEND == "ollama":
        return generate_ollama(user_content)
    else:
        raise ValueError(f"Unknown BACKEND: {BACKEND}")


if __name__ == "__main__":
    ds, embedder = load_retriever()

    if BACKEND == "transformers":
        model_state = load_transformers_model()
    else:
        model_state = None  # Ollama serves the model itself

    query = "What are the specific timeframes for reporting fatal or life-threatening ICSRs according to GVP Module VI?"
    print("\n=== RESPONSE ===")
    print(answer_gvp_query(query, ds, embedder, model_state))

Requirements

pip install datasets sentence-transformers transformers torch huggingface_hub faiss-cpu requests
# Optional (for 4bit/8bit):
pip install bitsandbytes
# Optional (for Ollama backend):
# Install Ollama separately and create the model from the GGUF + Modelfile

Intended Use

  • Building offline / local RAG systems for pharmacovigilance
  • Grounding Open-GVP models in official EMA GVP text
  • Research and education on regulatory RAG pipelines

Not intended for clinical decision-making or regulatory submissions without qualified human expert review.

Dataset Creation

  1. Official GVP Module PDFs were extracted with block-level reading-order sorting.
  2. Text was split into sentences with abbreviation- and heading-aware period protection.
  3. Sentences were packed into ~500-word chunks with a 2-sentence overlap (identical logic to the Open-GVP training data pipeline).
  4. Each chunk received a globally unique chunk_id, module name, approximate section heading, and source page(s).
  5. Embeddings were computed with BAAI/bge-small-en-v1.5 and a FAISS index was built.

License

Apache License 2.0


Disclaimer: This dataset is an independent academic resource prepared for research and educational purposes. It is not affiliated with, endorsed by, or an official product of the European Medicines Agency (EMA) or the Heads of Medicines Agencies.

Downloads last month
6