Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/RubenDarioGuerreroNeira/Ecosistema-IA-Colombia/llms.txt

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

Salud IA Bot covers two specialized health domains that are often difficult for citizens to navigate: mental health and sexual and reproductive health. Both modules load structured XML datasets at startup and respond to natural-language queries with statistics, risk profiles, and care route guidance. When structured data is available the bot answers directly; otherwise LLaMA 3.1 adds context and natural fluency to the response.
Salud IA Bot provides informational guidance only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always refer users to licensed healthcare providers for clinical decisions. Emergency protocol responses are returned verbatim from static structured data — the LLM is never used to generate first-aid or emergency instructions.

Mental Health module

The mental health module reads Salud_Mental.xml at startup into MentalHealthService. Each record maps a CIE-10 diagnostic code and description to age-bracket case counts: menor_a_1, de_1_a_4, de_5_a_9, de_10_a_14, de_15_a_19, de_20_a_49, de_50_a_64, _65_y_mas, and a total. The exported interfaces are:
export interface MentalHealthEvent {
  diagnostico_ingreso: string;
  codigo_dx_ingreso: string;
  menor_a_1: number;
  de_1_a_4: number;
  de_5_a_9: number;
  de_10_a_14: number;
  de_15_a_19: number;
  de_20_a_49: number;
  de_50_a_64: number;
  _65_y_mas: number;
  total: number;
  a_o_diagn_stico: string;
}

export interface MentalHealthEventWithTotal extends MentalHealthEvent {
  total_en_ciclo: number;
}

What users can ask

"¿Cuáles son los perfiles de riesgo en salud mental?"
-> Returns risk profile breakdown by life cycle (niños, adolescentes, jovenes, adultos, mayores)
   for the most prevalent CIE-10 diagnoses

"Graficar diagnósticos de salud mental"
-> Triggers ChartService to render a bar chart of top diagnoses by total cases

"Muéstrame un gráfico de depresión y ansiedad"
-> Calls getComparisonBetweenDiagnoses() then generates a comparative chart

Key service methods

MentalHealthService provides a layered search strategy that prioritizes precision over recall:
1

Exact match

getStatsForDiagnosis(query) first checks for an exact match against diagnostico_ingreso or codigo_dx_ingreso after normalization.
2

Token-scored candidate search

findDiagnosisInText(text) tokenizes the query and scores each diagnosis by how many tokens overlap, returning the highest-scoring candidate. A full phrase match in the query scores 2000; a partial inclusion scores 1400+.
3

Life-cycle aggregation

getTopByLifeCycle(cycle, limit) groups the eight age fields into five life-cycle buckets and returns the diagnoses with the most cases in the requested cycle.
Life cycle keyUnderlying age fields
ninosmenor_a_1, de_1_a_4, de_5_a_9
adolescentesde_10_a_14, de_15_a_19
jovenesde_15_a_19, de_20_a_49
adultosde_20_a_49, de_50_a_64
mayores_65_y_mas
4

Risk profile

getRiskProfileByDiagnosis(diagName) returns the full life-cycle distribution for a single diagnosis, enabling risk profile summaries per condition.

Statistical outputs

getAgeDistribution() aggregates totals across all diagnoses for every age bracket, providing a national picture of the age profile of mental health hospitalizations. getTopDiagnoses(limit) returns the most prevalent CIE-10 diagnoses by total case count, useful for chart generation.

Sexual and Reproductive Health module

The sexual health module answers questions from Salud_sexual_-_preguntas.xml, a curated dataset of frequently asked questions covering:
  • Reproductive rights and access to services
  • Contraception methods and correct usage
  • ITS/HIV prevention: transmission routes, testing, treatment access
  • Gender violence care routes: step-by-step guidance on how to access attention in cases of sexual or domestic violence in specific Colombian cities

Example queries

"¿Cómo acceder a una ruta de atención en violencia de género en Cali?"
-> Returns the step-by-step care route for gender violence cases in Cali

"Información sobre prevención de ITS"
-> Returns Q&A entries about ITS prevention, transmission, and testing

Intencion enum

SexualHealthService.classifyIntent(query) classifies incoming queries using the Intencion enum exported from sexual-health.service.ts. The detection is keyword-based and evaluates conditions in priority order:
export enum Intencion {
  BUSCAR_INFORMACION = 'buscar_info',
  BUSCAR_SERVICIO = 'buscar_servicio',
  PREVENCION = 'prevencion',
  TRATAMIENTO = 'tratamiento',
  DERECHOS = 'derechos',
  EMERGENCIA = 'emergencia',
  RIESGO_ITS = 'riesgo_its',
  EMBARAZO_ADOLESCENTE = 'embarazo_adolescente',
}
Detected keywordsResolved intent
emergencia, urgente, violacion, abuso, agresion, acido, ataqueEMERGENCIA
vih, sexo sin proteccion, condon, itsRIESGO_ITS
embarazada, adolescente, gestanteEMBARAZO_ADOLESCENTE
donde, acudir, ips, servicio, hospital, conseguir, pastillasBUSCAR_SERVICIO
(default)BUSCAR_INFORMACION
For high-priority bypass queries (e.g. keywords vih, condon, pastillas, vasectomia, embarazada), searchByKeyword returns a hardcoded expert response directly before consulting the XML question bank, guaranteeing accurate guidance on critical topics regardless of dataset coverage.

Emergency protocols

emergency-protocols.ts exports EMERGENCY_PROTOCOLS, a static object with pre-defined structured protocols for critical situations that require immediate action. Each protocol contains a keywords array for detection and a response string returned verbatim to the user:

Sexual violence

Triggered by keywords violar, violacion, abuso sexual. Provides step-by-step guidance including post-exposure prophylaxis (PPE within 72 hours) and the national helpline Linea 155.

Acid/chemical attack

Triggered by keywords acido, quemadura, quimico. Details what NOT to do (rub, apply ice, burst blisters) and the correct first-aid response (continuous water irrigation).

Domestic / partner violence

Triggered by keywords golpea, pega, violencia, maltrato. Provides care routes: Linea 155, Fiscalia, Policia, and Comisarias de Familia.

HIV exposure risk

Triggered by keywords jeringas, comparti, vih. Instructs users to go to emergency services immediately to request post-exposure prophylaxis within 72 hours.
These protocols are returned verbatim from the static EMERGENCY_PROTOCOLS object — LLaMA 3.1 is not involved in generating emergency instructions, ensuring that safety-critical steps are never altered or hallucinated by the model.

LLaMA 3.1 augmentation

For both mental and sexual health modules, structured data from the XML datasets is always injected as context into the LLaMA 3.1 prompt via the RAG pattern. The model’s role is to format and explain the structured findings in clear, empathetic Spanish — not to generate statistics or clinical facts from parametric memory. This means the numbers are always real, but the prose is always fluent.

Build docs developers (and LLMs) love