Skip to main content

Overview

VIGIA’s Surveillance module provides comprehensive monitoring of global pharmacovigilance databases and regulatory agencies, enabling early detection of safety signals and regulatory actions.

Multi-Source Monitoring

FDA, EMA, DIGEMID Peru, VigiAccess WHO

Scheduled Scraping

Automated data collection with configurable CRON schedules

Smart Filtering

Filter by severity, medication, date ranges, and keywords

Automated Reports

Weekly email reports in PDF, CSV, XLSX, or HTML

Surveillance Scopes

VIGIA separates surveillance into two scopes:
ScopeDescriptionSources
NationalDomestic regulatory monitoringDIGEMID (Peru), national health authorities
ExternalInternational monitoringFDA, EMA, VigiAccess, Health Canada, MHRA
Each scope has independent configuration for sources, schedules, and recipients.

Data Sources

Configuring Sources

GET /api/v1/surveillance/sources?scope=national
Response:
{
  "sources": [
    {
      "id": "uuid-1234",
      "name": "DIGEMID Alertas",
      "url": "https://www.digemid.minsa.gob.pe/alertas",
      "enabled": true
    },
    {
      "id": "uuid-5678",
      "name": "DIGEMID RAM",
      "url": "https://www.digemid.minsa.gob.pe/ram",
      "enabled": false
    }
  ]
}

Update Sources

POST /api/v1/surveillance/sources?scope=external
Content-Type: application/json

{
  "sources": [
    {
      "name": "FDA Drug Safety",
      "url": "https://www.fda.gov/drugs/drug-safety-and-availability",
      "enabled": true
    },
    {
      "name": "EMA Safety Updates",
      "url": "https://www.ema.europa.eu/en/human-regulatory/post-authorisation/pharmacovigilance",
      "enabled": true
    },
    {
      "name": "VigiAccess",
      "url": "http://www.vigiaccess.org/",
      "enabled": true
    }
  ]
}
When updating sources, the entire list is replaced. Include all sources you want to keep active.

Automated Scraping

Scraping Schedule

Configure CRON-based automatic scraping:
GET /api/v1/surveillance/schedule?scope=national
Response:
{
  "cron": "0 9 * * MON",
  "next_run_iso": "2024-03-11T09:00:00+00:00"
}

Update Schedule

POST /api/v1/surveillance/schedule?scope=external
Content-Type: application/json

{
  "cron": "0 9 * * MON,THU",
  "next_run_iso": "2024-03-07T09:00:00-05:00"
}
Common CRON Patterns:
  • 0 9 * * MON: Every Monday at 9:00 AM
  • 0 9 * * MON,THU: Monday and Thursday at 9:00 AM
  • 0 */6 * * *: Every 6 hours
  • 0 9 1 * *: First day of each month at 9:00 AM
Timezone: Schedules run in America/Lima timezone by default.

Manual Run

Trigger immediate scraping:
POST /api/v1/surveillance/run?scope=national
Scrapes all enabled sources and returns:
{
  "ok": true,
  "results": {
    "uuid-1234": {
      "items_found": 15,
      "items_new": 3,
      "source": "DIGEMID Alertas"
    },
    "uuid-5678": {
      "error": "Connection timeout"
    }
  }
}

Surveillance Items

Each scraped item contains:
# Model: backend/app/models/surveillance.py:20-34
class SurveillanceItem:
    - fuente: Source name (FDA, EMA, etc.)
    - titulo: Alert/announcement title
    - medicamento: Drug/product name
    - evento: Adverse event or safety issue
    - severidad: Severity (Alta, Media, Baja)
    - tendencia: Trend (Aumentando, Estable, Disminuyendo)
    - url: Source URL
    - fecha: Item date/time
    - fecha_publicada: Published date
    - scope: national or external

Severity Levels

SeveridadCriteriaExample
AltaDeath, hospitalization, recall”FDA recalls drug due to contamination”
MediaSerious ADR, label change”New black box warning for hepatotoxicity”
BajaMinor ADR, information update”Updated administration guidelines”

Querying Results

GET /api/v1/surveillance/results?scope=external&limit=20&offset=0

Advanced Filtering

GET /api/v1/surveillance/results?
  scope=national&
  query=paracetamol&
  severity=Alta&
  medicamento=PARACETAMOL&
  date_from=2024-01-01&
  date_to=2024-03-31&
  limit=50
Filter Parameters:
  • query: Full-text search across title, medication, event
  • severity: Filter by severity level
  • medicamento: Exact or partial medication name
  • date_from / date_to: Date range (ISO 8601 format)
  • scope: national or external
Response:
{
  "items": [
    {
      "id": "item-uuid-1",
      "fuente": "FDA",
      "titulo": "FDA warns of liver injury risk with acetaminophen",
      "medicamento": "Acetaminophen",
      "evento": "Hepatotoxicity",
      "severidad": "Alta",
      "tendencia": "Aumentando",
      "url": "https://www.fda.gov/...",
      "fecha": "2024-03-01T14:30:00Z",
      "fecha_publicada": "2024-03-01T10:00:00Z"
    }
  ],
  "total": 145,
  "page": 1,
  "page_size": 50
}

Automated Reports

Send Weekly Reports

Generate and email surveillance reports:
POST /api/v1/surveillance/send-reports
Content-Type: application/json

{
  "scope": "external",
  "recipients": [
    "[email protected]",
    "[email protected]"
  ],
  "inline": true,
  "pdf": true,
  "csv": false,
  "xlsx": true,
  "filters": {
    "severity": "Alta",
    "date_from": "2024-02-26",
    "date_to": "2024-03-03"
  },
  "title": "VIGIA - Vigilancia Internacional Semanal"
}
Options:
  • inline: Include HTML table in email body
  • pdf: Attach PDF report
  • csv: Attach CSV export
  • xlsx: Attach Excel spreadsheet
  • filters: Apply filters (optional, defaults to last week)
Response:
{
  "ok": true,
  "sent_to": ["[email protected]", "[email protected]"],
  "attachments": ["surveillance_report.pdf", "surveillance_report.xlsx"],
  "inline": true,
  "count": 23,
  "applied_filters": {
    "severity": "Alta",
    "date_from": "2024-02-26T05:00:00+00:00",
    "date_to": "2024-03-03T04:59:59+00:00",
    "defaulted_to_last_week": false,
    "scope": "external"
  }
}
Default behavior: If no date filters provided, reports default to the previous ISO week (Monday-Sunday).

Integration with ICSR

Surveillance items can trigger ICSR creation:
1

Detect Signal

Surveillance identifies new safety signal from FDA
2

Review Alert

Pharmacovigilance team reviews the alert details
3

Create ICSR (if applicable)

If the signal affects company products, create ICSR for investigation
4

Document in IPS

Include surveillance finding in next IPS report under “Regulatory Actions”

VigiAccess Integration

Special integration with WHO VigiAccess database:
# VigiAccess specific endpoints
GET /api/v1/vigiaccess/search?drug=paracetamol&reaction=hepatotoxicity

GET /api/v1/vigiaccess/dashboard?product_id=123
Features:
  • Global ADR statistics from 150+ countries
  • Comparative analysis across regions
  • Temporal trend analysis
  • Dashboard visualization
Source: backend/app/routers/vigiaccess.py, backend/app/routers/vigiaccess_dashboard.py

API Endpoints Summary

Configuration

# Get sources
GET /api/v1/surveillance/sources?scope={national|external}

# Update sources
POST /api/v1/surveillance/sources?scope={national|external}

# Get schedule
GET /api/v1/surveillance/schedule?scope={national|external}

# Update schedule
POST /api/v1/surveillance/schedule?scope={national|external}

Scraping

# Run now
POST /api/v1/surveillance/run?scope={national|external}

Results

# Get filtered results
GET /api/v1/surveillance/results?
  scope={scope}&
  limit={int}&
  offset={int}&
  query={text}&
  severity={Alta|Media|Baja}&
  medicamento={name}&
  date_from={YYYY-MM-DD}&
  date_to={YYYY-MM-DD}

Reports

# Send email reports
POST /api/v1/surveillance/send-reports

Code References

FeatureImplementation
Modelsbackend/app/models/surveillance.py:11-44
Routerbackend/app/routers/surveillance.py:1-300
Scraper Servicebackend/app/services/scraper.py
Report Generationbackend/app/services/reports.py
Filtersbackend/app/services/report_filters.py
VigiAccessbackend/app/routers/vigiaccess.py

Best Practices

Source Management

  • Enable only reliable, official sources
  • Test new sources with manual run first
  • Monitor scraper errors and adjust URLs
  • Review source list quarterly

Alert Management

  • Set up severity-based email filters
  • Review high-severity alerts within 24h
  • Document signal evaluation decisions
  • Link alerts to ICSRs when creating reports

Build docs developers (and LLMs) love