Skip to main content
GET
/
api
/
v1
/
icsr
List ICSR Cases
curl --request GET \
  --url https://api.example.com/api/v1/icsr
{
  "items": [
    {
      "id": 123,
      "created_at": "<string>",
      "paciente_iniciales": "<string>",
      "paciente_edad": 123,
      "paciente_sexo": "<string>",
      "paciente_peso": 123,
      "reportante_nombre": "<string>",
      "reportante_email": "<string>",
      "reportante_telefono": "<string>",
      "producto_sospechoso": "<string>",
      "fecha_inicio_evento": "<string>",
      "fecha_fin_evento": "<string>",
      "descripcion_evento": "<string>",
      "gravedad": "<string>",
      "estado": "<string>",
      "numero": "<string>",
      "ea_causalidad": "<string>",
      "ea_desenlace": "<string>",
      "productos": [
        {}
      ],
      "concomitantes": [
        {}
      ],
      "seguimientos": [
        {}
      ],
      "eventos": [
        {}
      ]
    }
  ],
  "total": 123,
  "page": 123,
  "page_size": 123
}

Endpoint

GET /api/v1/icsr

Authentication

Requires permission: icsr:list

Query Parameters

page
integer
default:"1"
Page number for pagination (minimum: 1)
page_size
integer
default:"20"
Number of items per page (minimum: 1, maximum: 200)
q
string
Full-text search query. Searches across:
  • Patient initials
  • Case number
  • Product names
  • Event descriptions
  • Reporter name
  • Internal codes
fecha_desde
string
Filter cases with event start date on or after this date (ISO format: YYYY-MM-DD). Alias: date_from
fecha_hasta
string
Filter cases with event start date on or before this date (ISO format: YYYY-MM-DD). Alias: date_to
order_by
string
default:"id"
Field to sort by. Common values:
  • id - Case ID
  • created_at - Creation timestamp
  • fecha_inicio_evento - Event start date
  • gravedad - Severity
  • estado - Status
order_dir
string
default:"desc"
Sort direction:
  • asc - Ascending order
  • desc - Descending order (default, showing newest first)

Response

items
array
Array of ICSR case objects
total
integer
Total number of cases matching the filters (not just the current page)
page
integer
Current page number
page_size
integer
Number of items per page

Example Requests

Basic Listing (First Page)

GET /api/v1/icsr?page=1&page_size=20

Search by Patient Initials

GET /api/v1/icsr?q=JD&page=1&page_size=20

Filter by Date Range

GET /api/v1/icsr?fecha_desde=2024-01-01&fecha_hasta=2024-01-31

Search with Custom Sort

GET /api/v1/icsr?q=amoxicilina&order_by=gravedad&order_dir=asc

Large Page Size

GET /api/v1/icsr?page=1&page_size=100

Example Response

{
  "items": [
    {
      "id": 1234,
      "created_at": "2024-01-20T10:30:00Z",
      "paciente_iniciales": "JD",
      "paciente_edad": 45,
      "paciente_sexo": "M",
      "paciente_peso": 72.5,
      "reportante_nombre": "Dr. Maria Garcia",
      "reportante_email": "[email protected]",
      "producto_sospechoso": "Amoxicilina 500mg",
      "fecha_inicio_evento": "2024-01-15",
      "fecha_fin_evento": "2024-01-18",
      "descripcion_evento": "Paciente desarrolló rash eritematoso generalizado...",
      "gravedad": "No grave",
      "estado": "Cerrado",
      "numero": "ICSR-2024-001",
      "ea_causalidad": "Probable",
      "ea_desenlace": "Recuperado",
      "productos": [
        {
          "id": 5678,
          "nombre_producto": "Amoxicilina",
          "ifa": "Amoxicilina trihidratada",
          "registro_sanitario": "EE-123456",
          "nro_lote": "LOT2024-001",
          "via_administracion": "Oral",
          "dosis_frecuencia": "500mg cada 8 horas"
        }
      ],
      "concomitantes": [],
      "seguimientos": [],
      "eventos": [
        {
          "id": 9012,
          "icsr_id": 1234,
          "texto": "Rash eritematoso generalizado",
          "gravedad": "No grave",
          "causalidad": "Probable",
          "desenlace": "Recuperado",
          "meddra_pt_code": "10037844",
          "meddra_pt_term": "Rash"
        }
      ]
    },
    {
      "id": 1233,
      "created_at": "2024-01-19T14:22:00Z",
      "paciente_iniciales": "AB",
      "paciente_edad": 32,
      "paciente_sexo": "F",
      "reportante_nombre": "Dr. Carlos Lopez",
      "producto_sospechoso": "Ibuprofeno 400mg",
      "fecha_inicio_evento": "2024-01-18",
      "descripcion_evento": "Paciente presentó dolor epigástrico severo...",
      "gravedad": "Grave",
      "estado": "En progreso",
      "ea_causalidad": "Posible",
      "productos": [
        {
          "id": 5677,
          "nombre_producto": "Ibuprofeno",
          "ifa": "Ibuprofeno",
          "forma_farmaceutica": "Tableta"
        }
      ],
      "concomitantes": [],
      "seguimientos": [],
      "eventos": []
    }
  ],
  "total": 156,
  "page": 1,
  "page_size": 20
}

Pagination Calculation

To calculate total pages:
const totalPages = Math.ceil(response.total / response.page_size);
To check if there’s a next page:
const hasNextPage = response.page * response.page_size < response.total;

Search Behavior

The q parameter performs case-insensitive partial matching across multiple fields:
  • Patient: initials, DNI
  • Case: number, internal code, CENAFYT code
  • Product: suspected product name, product array names
  • Event: description/narrative
  • Reporter: name, email
Search is optimized for performance with database indexing on key fields.

Date Filtering

Date filters apply to the fecha_inicio_evento field:
  • fecha_desde is inclusive (>=)
  • fecha_hasta is inclusive (<=)
  • Both can be used together for a range
  • Dates must be in ISO format (YYYY-MM-DD)

Sorting

Available sort fields:
  • id - Numeric case ID (default)
  • created_at - Creation timestamp
  • fecha_inicio_evento - Event start date
  • gravedad - Severity (alphabetical)
  • estado - Status (alphabetical)
  • paciente_iniciales - Patient initials (alphabetical)
Default sort is id DESC (newest cases first).

Performance Notes

  • List queries are optimized with database indexes
  • Large page sizes (>100) may impact performance
  • The response includes complete nested objects (products, events, etc.)
  • For minimal data transfer, consider implementing a “list” endpoint that returns only summary fields

Error Responses

400 Bad Request

{
  "detail": "page must be >= 1"
}
or
{
  "detail": "page_size must be between 1 and 200"
}

401 Unauthorized

{
  "detail": "Not authenticated"
}

403 Forbidden

{
  "detail": "Permission denied: icsr:list required"
}

Build docs developers (and LLMs) love