Skip to main content

Overview

The IPS Calendar module tracks regulatory deadlines and scheduled reports for pharmaceutical products. It integrates with the main IPS reporting system to streamline report creation and compliance tracking.

List Calendar Entries

GET /api/v1/ips/calendario?limit=10&offset=0&q=PARACETAMOL
Authorization: Bearer <token>

Query Parameters

limit
integer
default:"10"
Number of entries to return (1-200)
offset
integer
default:"0"
Number of entries to skip for pagination
q
string
Search query to filter by product name, active ingredient, or registration number

Response

items
array<CalendarioIPSOut>
List of calendar entries
total
integer
Total number of matching entries
Response Example
{
  "items": [
    {
      "id": 789,
      "numero": 1,
      "producto_forma": "PARACETAMOL 500MG - TABLETAS",
      "ifa": "PARACETAMOL",
      "registro_numero": "2021-123456",
      "registro_estado": "Vigente",
      "registro_vencimiento": "2026-03-15",
      "registro_primera_autorizacion": "2021-03-15",
      "ips_version": "1.0",
      "ips_fid": "2024-01-01",
      "ips_fcd": "2024-12-31",
      "ips_anios": 1.0,
      "rs_version": "1.0",
      "rs_fid": "2024-01-01",
      "rs_fcd": "2024-06-30",
      "rs_anios": 0.5,
      "fecha_lim_elaboracion": "2025-01-31",
      "fecha_lim_revision_aprobacion": "2025-02-15",
      "fecha_sometimiento": null,
      "estado_ips": "Borrador",
      "responsable_aprobacion": "Dr. Juan Pérez",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-03-15T10:30:00Z"
    }
  ],
  "total": 1
}

Get Calendar Entry

GET /api/v1/ips/calendario/789
Authorization: Bearer <token>

Path Parameters

item_id
integer
required
ID of the calendar entry

Response

Returns a single CalendarioIPSOut object with all calendar entry details.

Create Calendar Entry

POST /api/v1/ips/calendario
Authorization: Bearer <token>
Content-Type: application/json

{
  "producto_forma": "PARACETAMOL 500MG - TABLETAS",
  "ifa": "PARACETAMOL",
  "registro_numero": "2021-123456",
  "registro_estado": "Vigente",
  "registro_vencimiento": "2026-03-15",
  "registro_primera_autorizacion": "2021-03-15",
  "ips_fid": "2024-01-01",
  "ips_fcd": "2024-12-31",
  "fecha_lim_elaboracion": "2025-01-31",
  "estado_ips": "Borrador"
}

Request Body (CalendarioIPSCreate)

producto_forma
string
required
Product name with pharmaceutical form
ifa
string
required
Active ingredient (IFA)
registro_numero
string
required
Sanitary registration number
registro_estado
string
default:"Vigente"
Registration status
registro_vencimiento
date
Registration expiration date (YYYY-MM-DD)
registro_primera_autorizacion
date
First authorization date (YYYY-MM-DD)
ips_version
string
default:"1.0"
IPS version number
ips_fid
date
IPS period start date (FID - Fecha Inicio Datos)
ips_fcd
date
IPS period end date (FCD - Fecha Cierre Datos)
ips_anios
number
IPS period duration in years
rs_version
string
default:"1.0"
Safety summary (Resumen de Seguridad) version
rs_fid
date
Safety summary period start date
rs_fcd
date
Safety summary period end date
rs_anios
number
Safety summary period duration in years
fecha_lim_elaboracion
date
Report elaboration deadline
fecha_lim_revision_aprobacion
date
Review and approval deadline
fecha_sometimiento
date
Submission date to regulatory authority
estado_ips
string
default:"Borrador"
IPS status: Borrador, Validado, Firmado, Sometido, Aprobado, or Observado
responsable_aprobacion
string
Person responsible for approval

Response

Returns the created calendar entry with HTTP 201 Created.

Update Calendar Entry

PUT /api/v1/ips/calendario/789
Authorization: Bearer <token>
Content-Type: application/json

{
  "estado_ips": "Validado",
  "fecha_sometimiento": "2025-02-01"
}

Path Parameters

item_id
integer
required
ID of the calendar entry to update

Request Body

Same fields as CalendarioIPSCreate. All fields are optional.

Audit Trail

Updates are automatically tracked with before/after change detection:
{
  "changes": {
    "estado_ips": ["Borrador", "Validado"],
    "fecha_sometimiento": [null, "2025-02-01"]
  }
}

Delete Calendar Entry

DELETE /api/v1/ips/calendario/789
Authorization: Bearer <token>

Path Parameters

item_id
integer
required
ID of the calendar entry to delete

Response

Returns HTTP 204 No Content on successful deletion.

Search Calendar Products

GET /api/v1/ips/calendario-search?q=PARACETA&limit=20
Authorization: Bearer <token>

Query Parameters

q
string
Search query for product name, active ingredient, or registration number
limit
integer
default:"20"
Maximum results to return (1-200)

Response

Returns a list of matching products in {id, label} format for dropdown/autocomplete use:
[
  {
    "id": 789,
    "label": "PARACETAMOL 500MG - TABLETAS [Reg: 2021-123456]"
  },
  {
    "id": 790,
    "label": "PARACETAMOL 1G SUSPENSION [Reg: 2022-654321]"
  }
]

Get Product Form Options

Retrieve unique product forms from the calendar for autocomplete.
GET /api/v1/ips/calendario/opciones?q=PARA&limit=20
Authorization: Bearer <token>

Query Parameters

q
string
Search filter for product form
limit
integer
default:"20"
Maximum options to return (1-200)

Response

Returns an array of strings, ordered by frequency:
[
  "PARACETAMOL 500MG - TABLETAS",
  "PARACETAMOL 1G - SUSPENSION ORAL",
  "PARACETAMOL 100MG/ML - GOTAS"
]

Prefill Report from Calendar

Get prefilled data for creating an IPS report from a calendar entry.
GET /api/v1/ips/calendario/789/prefill
Authorization: Bearer <token>

Path Parameters

cal_id
integer
required
Calendar entry ID to prefill from

Response

{
  "producto": {
    "nombre": "PARACETAMOL 500MG - TABLETAS",
    "principio_activo": "PARACETAMOL",
    "forma_farmaceutica": "TABLETAS",
    "presentacion": "CAJA X 20 TABLETAS",
    "via": "ORAL",
    "registro_sanitario": "2021-123456",
    "fecha_autorizacion": "2021-03-15",
    "fabricante": ""
  },
  "report": {
    "version": 1,
    "periodo_inicio": "2024-01-01",
    "periodo_fin": "2024-12-31",
    "estado": "borrador"
  },
  "cal_id": 789
}

Create Report from Calendar

Create an IPS report directly from a calendar entry.
POST /api/v1/ips/from-calendario?cal_id=789
Authorization: Bearer <token>
Content-Type: application/json

{
  "fuentes": [
    {
      "title": "Safety study",
      "collection": "PMC",
      "year": 2024
    }
  ],
  "kpis": {
    "literaturas_detected": 50
  },
  "unidades_comercializadas": 50000
}

Query Parameters

cal_id
integer
required
Calendar entry ID to create report from
periodo_inicio
date
Override period start date (defaults to calendar entry dates)
periodo_fin
date
Override period end date (defaults to calendar entry dates)

Request Body (Optional)

fuentes
array
Initial literature sources to attach
kpis
object
Initial KPI values
unidades_comercializadas
integer
Units commercialized during period

Response

Returns the created IPSReportOut with associated product automatically created or matched.

View Report History by Calendar

Get all IPS reports associated with a calendar entry.
GET /api/v1/ips/calendario/789/reports?limit=50&offset=0
Authorization: Bearer <token>

Path Parameters

cal_id
integer
required
Calendar entry ID

Query Parameters

limit
integer
default:"50"
Number of reports to return (1-200)
offset
integer
default:"0"
Number of reports to skip

Response

Returns an array of IPSReportOut objects, ordered by most recent first.

Build docs developers (and LLMs) love