Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Imjuanisss/proyecto-melika/llms.txt

Use this file to discover all available pages before exploring further.

The Medications API exposes MELIKA’s drug catalog for use across the platform — from patient-facing drug information pages to physician prescribing workflows. Medications are classified as either OTC (over-the-counter, no prescription required) or Rx (prescription-only), are linked to medical specialties for contextual filtering, and carry structured presentation data. All read endpoints are public with no authentication required, though write operations are restricted to admin routes at the application layer.

OTC vs Rx Classification

OTC — Over the Counter

Medications available without a prescription. Suitable for display in patient-facing catalogs, symptom checkers, and general wellness flows. Filtered with tipo=OTC.

Rx — Prescription Only

Medications that require a physician’s prescription. These appear in clinical workflows, physician prescribing panels, and are referenced inside clinical records. Filtered with tipo=Rx.

Data Model

The medicamentos table stores the full drug profile including commercial identity, active ingredient, lab origin, and specialty linkage.
FieldTypeNotes
idintegerPrimary key
nombre_comercialVARCHAR(150)Brand/commercial name
principio_activoVARCHAR(150)Generic active ingredient name
principio_activaVARCHAR(150)Legacy duplicate of principio_activo — both are kept in sync on write
laboratorioVARCHAR(100)Manufacturing laboratory
categoriaVARCHAR(100)Legacy text category field (superseded by id_especialidad)
id_especialidadintegerFK → specialties (contextual linkage for catalog filtering)
tipoENUMOTC or Rx (enforced by CHECK constraint)
descripcionTEXTClinical description
indicacionesTEXTClinical indications
posologiaTEXTDosage guidance
contraindicacionesTEXTContraindications
presentacionesTEXTAvailable forms and dosages (e.g. tablets, syrup)
registro_invimaVARCHAR(50)INVIMA registration number (unique when set)
imagen_urlVARCHAR(255)URL to product image
activobooleanOnly TRUE records appear in public queries. Default TRUE
created_attimestampAuto-generated
updated_attimestampAuto-updated
All public-facing endpoints (GET /medicamentos, GET /medicamentos/:id) return only active medications (activo = TRUE). Inactive entries are accessible only via the admin route.

Endpoints

GET /medicamentos

Returns a filtered list of active medications. Supports three independent query filters that can be combined freely: tipo restricts by prescription class, id_especialidad restricts by specialty linkage, and buscar performs a case-insensitive full-text search across both nombre_comercial and principio_activo. Results are ordered alphabetically by nombre_comercial. Authentication: None (public)
tipo
string
Filter by prescription classification. Accepted values: OTC, Rx. Omit to return both types.
id_especialidad
string
Filter by specialty. Pass a numeric specialty ID to restrict results to medications linked to that discipline. Pass "Todos" or omit entirely to return medications across all specialties.
buscar
string
Case-insensitive search string applied via ILIKE against both nombre_comercial and principio_activo. Partial matches are supported.
[].id
integer
Medication identifier.
[].nombre_comercial
string
Commercial/brand name (e.g. "Metformina 500").
[].principio_activo
string
Generic active ingredient (e.g. "metformina").
[].laboratorio
string
Manufacturing laboratory name.
[].tipo
string
"OTC" or "Rx".
[].descripcion
string
Clinical description of the medication.
[].presentaciones
string
Available forms and dosages.
[].imagen_url
string
URL to the product image.
[].id_especialidad
integer
ID of the linked specialty (nullable).
[].activo
boolean
Always true in public responses.
curl -X GET "http://localhost:3000/medicamentos"
Example — GET /medicamentos?tipo=Rx&buscar=metformina:
[
  {
    "id": 14,
    "nombre_comercial": "Metformina 500",
    "principio_activo": "metformina",
    "laboratorio": "Laboratorios GenFar",
    "tipo": "Rx",
    "descripcion": "Antidiabético oral de la clase biguanida. Reduce la producción hepática de glucosa.",
    "presentaciones": "Tabletas 500mg, 850mg, 1000mg",
    "imagen_url": "https://storage.example.com/meds/metformina.jpg",
    "id_especialidad": 4,
    "activo": true
  }
]
Combine tipo=Rx with a buscar term to power a physician-side drug search widget during prescription creation.

GET /medicamentos/admin

Returns all medications including inactive ones (activo = FALSE) for administrative management. Intended for use in admin dashboards where operators manage the drug catalog. Authentication: None at route level (enforced at the admin layer)
[].id
integer
Medication identifier.
[].nombre_comercial
string
Commercial name.
[].principio_activo
string
Active ingredient.
[].laboratorio
string
Manufacturing laboratory.
[].tipo
string
"OTC" or "Rx".
[].activo
boolean
Active status — includes both true and false records.
curl -X GET "http://localhost:3000/medicamentos/admin"

GET /medicamentos/categorias

Returns a deduplicated list of specialty names (not IDs) that have at least one active medication linked to them. This powers category filter UIs in medication browsers, letting patients or physicians narrow results to a specific discipline before applying further filters. Authentication: None (public)
[]
string
Array of specialty name strings (e.g. ["Cardiología", "Endocrinología", "Pediatría"]). Each value corresponds to the nombre field of a specialty that has at least one active medication linked via id_especialidad.
curl -X GET "http://localhost:3000/medicamentos/categorias"
Example response:
[
  "Cardiología",
  "Endocrinología",
  "Medicina General",
  "Neurología",
  "Pediatría"
]

GET /medicamentos/:id

Retrieves the full profile of a single active medication by its ID. Returns 404 if the medication does not exist or is inactive. Authentication: None (public)
id
integer
required
The medication’s unique identifier.
id
integer
Medication identifier.
nombre_comercial
string
Commercial/brand name.
principio_activo
string
Generic active ingredient.
laboratorio
string
Manufacturing laboratory.
tipo
string
"OTC" or "Rx".
descripcion
string
Clinical description.
indicaciones
string
Clinical indications.
contraindicaciones
string
Contraindications.
presentaciones
string
Available forms and dosages.
registro_invima
string
INVIMA registration number.
imagen_url
string
Product image URL.
id_especialidad
integer
Linked specialty ID.
activo
boolean
Active status (true for all public responses).
created_at
string
ISO 8601 creation timestamp.
updated_at
string
ISO 8601 last-updated timestamp.
curl -X GET "http://localhost:3000/medicamentos/14"
Example response:
{
  "id": 14,
  "nombre_comercial": "Metformina 500",
  "principio_activo": "metformina",
  "laboratorio": "Laboratorios GenFar",
  "tipo": "Rx",
  "descripcion": "Antidiabético oral de la clase biguanida. Reduce la producción hepática de glucosa.",
  "indicaciones": "Diabetes mellitus tipo 2",
  "contraindicaciones": "Insuficiencia renal severa",
  "presentaciones": "Tabletas 500mg, 850mg, 1000mg",
  "registro_invima": "M-1234-56",
  "imagen_url": "https://storage.example.com/meds/metformina.jpg",
  "id_especialidad": 4,
  "activo": true,
  "created_at": "2024-01-15T10:00:00.000Z",
  "updated_at": "2024-06-01T08:30:00.000Z"
}

POST /medicamentos

Creates a new medication entry in the catalog. The request body uses short field names (nombre, principio, presentacion) that the controller maps to the corresponding database column names. This route is exposed through the /medicamentos path and is also mirrored under /admin/medicamentos (with different field names — see the Admin API). Authentication: None at route level (enforced at the admin layer)
nombre
string
required
The brand or commercial name of the medication. Stored as nombre_comercial.
tipo
string
required
Prescription classification. Must be exactly "OTC" or "Rx".
principio
string
Active ingredient(s). Stored in both principio_activo and principio_activa columns.
descripcion
string
Free-text description of the medication.
presentacion
string
Physical form / presentations (e.g. "Tabletas 500 mg"). Stored as presentaciones.
activo
boolean
Whether the medication is active in the catalog. Defaults to true.
laboratorio
string
Name of the pharmaceutical laboratory.
id_especialidad
integer
Optional link to a specialty ID (used for catalog filtering).
imagen_url
string
URL of the medication’s product image.
curl -X POST http://localhost:3000/medicamentos \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Atorvastatina 20",
    "principio": "atorvastatina",
    "tipo": "Rx",
    "descripcion": "Inhibidor de la HMG-CoA reductasa. Indicado para la reducción del colesterol LDL.",
    "presentacion": "Tabletas 10mg, 20mg, 40mg",
    "laboratorio": "Pfizer",
    "id_especialidad": 1
  }'

PUT /medicamentos/:id

Fully updates an existing medication record. Uses the same short field names as POST /medicamentos. Setting activo=false removes the medication from all public-facing queries without deleting the record. Authentication: None at route level (enforced at the admin layer)
id
integer
required
The ID of the medication to update.
nombre
string
Updated commercial name. Stored as nombre_comercial.
principio
string
Updated active ingredient. Stored as principio_activo and principio_activa.
tipo
string
Updated classification: "OTC" or "Rx".
descripcion
string
Updated clinical description.
presentacion
string
Updated presentation forms and dosages. Stored as presentaciones.
activo
boolean
Set to false to deactivate and hide from public listings.
laboratorio
string
Updated laboratory name.
id_especialidad
integer
Updated specialty linkage.
imagen_url
string
Updated product image URL.
curl -X PUT http://localhost:3000/medicamentos/14 \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Metformina 500",
    "principio": "metformina",
    "tipo": "Rx",
    "presentacion": "Tabletas 500mg, 850mg, 1000mg; Solución oral 500mg/5ml",
    "activo": true
  }'

Build docs developers (and LLMs) love