Methods

Technical surface

Every method listed here is in use in one of the systems below. It is not a familiarity inventory.

Data engineering and platform

  • Motores OLAP embebidos (DuckDB) sobre Apache Parquet
  • Modelamiento de almacenes de datos por capas
  • Pruebas de calidad de datos (Pointblank)
  • Orquestación de pipelines (Kestra, Docker)
  • Pipelines reproducibles en R y Python
  • Control de versiones y revisión de código

Advanced analytics and biostatistics

  • Análisis de supervivencia y riesgos proporcionales
  • Diferencias en diferencias
  • Descomposición de desigualdad y análisis de equidad
  • Vinculación probabilística de registros (Fellegi-Sunter, Splink)
  • Modelos de proyección con backtest
  • Inferencia y modelamiento estadístico

Artificial intelligence and machine learning

  • Clasificación por ensamble (gradient boosting, XGBoost)
  • Afinamiento de modelos de lenguaje (QLoRA, Llama 3.1)
  • Detección de anomalías multidimensional
  • Calibración de umbrales (índice de Youden)
  • Diseño human-in-the-loop
  • Transparencia algorítmica y auditoría de equidad

Natural language processing

  • Incrustaciones textuales y similitud semántica
  • Extracción de entidades clínicas sobre texto libre
  • Mapeo ontológico (CIE-10, CIE-O3)
  • Expresiones regulares sanitarias
  • Servido local de modelos (Ollama)

Privacy and data governance

  • k-anonimidad y l-diversidad
  • Pseudoanonimización en pipeline
  • Evaluación de impacto en protección de datos
  • Gobernanza bajo la Ley 21.719

2014–2018

Hospital Padre Hurtado · South-East Metropolitan Health Service

Role
Advisor to hospital management and monitor of Explicit Health Guarantees (GES)
Stack
  • Lean Six Sigma
  • BPMN
  • Value-Based Healthcare
  • Gestión de casos

Cancer traceability and active case-management model

A process redesign without a single software licence, which took a public hospital into the national Top 5 for cancer management.

The problem

The starting point combined long delays in specialist access, critical lags in diagnostic confirmation and systematic breaches of the legal deadlines set by the GES regime. Paper referrals stalled at administrative handoffs, and nobody knew where each patient actually was.

Architecture

  1. IntakeCancer suspicion referred from primary care or the emergency department.
  2. FlaggingA fluorescent sticker on the chart and the paper referral: the flag travels with the document through every administrative handoff.
  3. RegistrationEntry into the traceability sheet with a named clinical case manager assigned.
  4. Follow-upActive contact at each milestone: first appointment, diagnostic confirmation, tumour board and treatment decision.
  5. EscalationAlert to hospital management when a GES deadline is at risk, before it expires.
  6. ExitTreatment, or early referral to palliative care and pain relief.

What it produced

  • More than 6,000 patients entered the traceability system over the period.
  • Time to first specialist appointment brought down to 13 days.
  • The hospital placed among the five best public hospitals in Chile for cancer management.
  • Sustained stretches with zero overdue GES guarantees in neoplastic conditions.
  • Faster referral to palliative care and pain relief for patients at advanced stages.

2023

Ministry of Health · Department of Analysis and Management Information

Role
Data scientist, design and implementation team
Stack
  • Detección de anomalías
  • R
  • Python
  • Reportería automatizada

Waiting-list anomaly detection with reverse machine learning

Inverted classification: instead of learning what is typical, the model hunts for what is irregular in the National Waiting List Registry.

The problem

The National Waiting List Registry holds tens of millions of care transactions. Coding errors and divergent practices between facilities stayed invisible inside the aggregate volume, with no systematic mechanism to surface them.

Architecture

  1. SourceNational Waiting List Registry, tens of millions of care transactions.
  2. AggregationThe unit of analysis is not the record but each facility’s time series by service type.
  3. AxesFour signals in parallel: entry and exit volume, time on list against expected thresholds, variance against comparable facilities, and the trajectory of discharge justifications.
  4. ScoringA risk score per facility and service type, not per individual record.
  5. DeliveryTwo outputs by audience: a compliance spreadsheet for the central level and interactive HTML reports for hospital counterparts.

What it produced

  • Enables targeted clinical audits, surfacing coding errors and divergent care practices.
  • Supports migration towards the ministry’s new technology platforms.
  • Ranked among the five best artificial-intelligence implementations in the Chilean State, at the public-transformation AI summit convened by the Digital Government Division and the Ministry of Finance.

2025

Chilean Ministry of Health

Role
Algorithmic system design
Stack
  • NLP
  • Embeddings
  • Gradient boosting
  • XGBoost
  • CIE-10
  • Índice de Youden
  • Caché por hash
  • Human-in-the-loop

Cancer classifier for the national surgical waiting list

NLP, embeddings and gradient-boosted trees to rescue cancer suspicions misfiled as elective surgery. 91.6 % sensitivity over 15,032 clinically validated cases.

The problem

Patients with suspected or evident cancer sit in the waiting list classified as general or non-prioritised elective surgery, losing the priority they are entitled to. The system covers, by design, cancers without an explicit guarantee — melanoma, sarcomas, head and neck, oesophagus, pancreas, hepatobiliary, central nervous system, endometrium — because the sixteen GES cancers already have their own guaranteed pathway. Those are precisely the ones nobody was counting.

Architecture

  1. ExtractionA cut of the national surgical waiting list from the layered warehouse into Parquet, queried with DuckDB: ~475,000 diagnoses.
  2. Deterministic filteringClinical regular expressions and ontological mapping over ICD-10 capture unambiguous criteria before any model is involved.
  3. VectorisationEmbeddings of the free text against centroids of confirmed cancer diagnoses. The normalised text’s hash is the cache key, so only new text is vectorised.
  4. ClassificationA gradient-boosted tree ensemble; the threshold is recalibrated with the Youden index on every retraining.
  5. DecisionThree states. Suspicious and indeterminate are mandatorily routed to medical clinical audit; the model closes nothing.
  6. DeliveryAn official, auditable monthly cut, plus a weekly preliminary channel over the transactional base surfacing cases with about 7 days of lag.

What it produced

  • Classifies roughly 475,000 diagnoses from the national surgical waiting list on every cut.
  • Evaluated on 15,032 cases individually validated by clinical specialists: 91.6 % sensitivity, 97.9 % specificity, 82.8 % precision (PPV) and 99.0 % negative predictive value.
  • The label is official and auditable: it is what the care network uses to prioritise cases with cancer indications.
  • Monthly validation against the Health Services’ own criteria, with nine reports per service, waiting times by cancer stage and the indicator for cancer surgery within 90 days.
  • The loop does not end at classification: weekly comparison against each service’s validation surfaces miscoded records and drives their correction at source, with the clinical leads of each service.

Evaluation

ParameterResultClinical implication
Sensitivity91.6 %High recovery rate for cancer hidden inside non-prioritised demand.
Specificity97.9 %Minimal interference and a low over-diagnosis rate on elective surgical pathways.
Precision (PPV)82.8 %Operational reliability for the medical audit team reviewing the alerts raised.
Negative predictive value99.0 %Analytical confidence when ruling out cancer alarm criteria in the evaluated batch.
Validation record15,032 casesCohort clinically validated through individual expert review.
Run frequencyWeekly (since 2025)Regular traceability, integrated into surgical demand management systems.

2025–2026

Chilean Ministry of Health

Role
Model fine-tuning and deployment
Stack
  • Llama 3.1 8B
  • QLoRA
  • Fine-tuning
  • Ollama
  • CIE-O3
  • Python

Tumour topography extraction with a fine-tuned language model

Llama 3.1 8B fine-tuned with QLoRA to identify the affected organ in each cancer suspicion and map it to ICD-O3. 93.3 % accuracy at topographic group level.

The problem

The classifier says whether there is a cancer suspicion, but not of what. Without the affected organ, a suspicion cannot be clinically prioritised or compared across services, and the free text of referrals uses no controlled vocabulary: the same tumour appears written twenty different ways, abbreviated and misspelled.

Architecture

  1. InputThe cases the classifier flagged as suspicious, in the same run.
  2. ModelLlama 3.1 8B fine-tuned with QLoRA: four-bit quantisation plus low-rank adapters, so training and inference fit on a single GPU.
  3. ServingServed with Ollama inside ministry infrastructure. Clinical text never reaches an external API.
  4. NormalisationOutput is mapped to ICD-O3 topography codes, the standard cancer registries are coded in.

What it produced

  • 93.3 % accuracy at the ICD-O3 C## topographic group level.
  • Suspicion stops being a binary label and becomes clinically actionable: cases can be routed to the right specialty.
  • A precedent for fine-tuning an open model inside government, with no clinical text sent to external services.

2025–2026

Chilean Ministry of Health

Role
Modelling, calibration and simulator
Stack
  • R
  • Backtesting
  • Simulación
  • JavaScript

Waiting list projection model and simulator

Projection calibrated per Health Service, with backtesting and a 30-check adversarial audit, plus a simulator for exploring capacity and allocation-policy scenarios.

The problem

Decisions on surgical capacity and budget allocation are made looking at the current stock of the list, which only describes the past. Projecting requires modelling entries, exits and their seasonality separately, and those dynamics differ too much between territories for a single national model to be useful.

Architecture

  1. InputHistorical series of monthly cuts, broken down by Health Service.
  2. ModelEntries and exits are modelled separately, each with its own seasonality: the stock is the result, not the variable.
  3. CalibrationOne fit per Health Service instead of a single national model, because territorial dynamics are not comparable.
  4. VerificationBacktesting over historical cuts and a 30-check adversarial audit designed to break the model.
  5. OutputAn in-browser simulator where the decision-maker moves capacity and allocation-policy assumptions.

What it produced

  • Moves the conversation from the current stock to the list’s expected trajectory.
  • The simulator puts the model directly in the hands of the decision-maker, which is where the assumptions actually get argued.

2024–2026

Chilean Ministry of Health

Role
Library design and implementation
Stack
  • R
  • k-anonimidad
  • l-diversidad
Code
GitHub ↗

Clinical data anonymisation with k-anonymity and l-diversity

An R library implementing the ministry technical standard, so waiting-list data can be released without opening the door to re-identification.

The problem

Freedom-of-information requests and open data publication require releasing real datasets. Removing the identifier is not enough: age, municipality, specialty and date together are enough to re-identify someone in any small group, and in health the sensitive attribute is the diagnosis itself.

Architecture

  1. Field classificationEach column is declared a direct identifier, a quasi-identifier or a sensitive attribute. In health the sensitive attribute is the diagnosis.
  2. GeneralisationIterative level degradation over the quasi-identifiers, one step at a time, instead of a single pass that over-generalises.
  3. Verificationk is checked over each equivalence class and l over the diversity of the sensitive attribute within each class.
  4. GateIf the output does not reach the threshold, it is not exported. The decision belongs to the code, not to the judgement of whoever releases it.

What it produced

  • Base library published as an open repository, reusable by any institution subject to the same standard.
  • Underpins transparency releases over waiting-list data, with an explicit and checkable criterion instead of a case-by-case judgement call.

2023–2026

Chilean Ministry of Health

Role
Linkage model implementation
Stack
  • Record linkage
  • Fellegi-Sunter
  • Splink
  • DuckDB
  • Jaro-Winkler
  • Dip de Hartigan
  • Python

Probabilistic deduplication and record linkage at national scale

Unifying fragmented identities to find out how much surgical demand actually exists.

The problem

Multiple identifying keys distort the care database. Migrants awaiting visa processing, newborns and undocumented people enter under temporary numeric identifiers and later receive their definitive national ID, with no automatic system-side merge of their care events.

Architecture

  1. Source2.1 million records with multiple identifying keys per person.
  2. EngineSplink over DuckDB, in-process: blocked comparison runs on the same machine, with no cluster.
  3. ComparisonJaro-Winkler similarity over name, date of birth, sex and address, weighted under the Fellegi-Sunter framework.
  4. Model selection40 candidate configurations are trained and the one that separates matches from non-matches most cleanly is kept, measured with Hartigan’s dip test over the score distribution.
  5. OutputUnified identities that correct the count of real surgical demand.

What it produced

  • Corrects the overstatement of surgical waiting lists caused by redundant records.
  • Objective indicators of real demand, underpinning sector budget allocation and Ministry of Health policy.

2021–2026

Chilean Ministry of Health · LatinR community

Role
Analytics architecture and technical transfer
Stack
  • DuckDB
  • DuckDB-WASM
  • Apache Parquet
  • R
  • Quarto
  • Shiny
  • Python
  • Kestra
  • Docker
  • Pointblank

Analytics architecture on open technology

Tens of millions of rows queried on ordinary machines, with embedded OLAP engines and no proprietary licences.

The problem

Building solutions over databases of tens of millions of hospital transactions inside government runs into recurring limits: workstations with little physical memory and saturated central servers. The usual answer — buying licences and clusters — was not viable.

Architecture

  1. StorageApache Parquet columnar files on shared storage, instead of a served database.
  2. EngineDuckDB in-process, running on the analyst’s own machine: tens of millions of rows with no cluster and no server.
  3. Layers and gateA raw (bronze) and a transformed (silver) layer, with 34 automated Pointblank tests over both. It is a gate, not a report: what fails the tests is not published and goes back to the facility that produced it.
  4. ExecutionA single entry script per project, with the cut-off date as a parameter, orchestrated by Kestra on Docker.
  5. ExplorationDuckDB compiled to WebAssembly queries the same Parquet from the browser, with no backend to stand up and no database to expose.
  6. TraceabilityGit and GitHub Flow with pull-request review: every change of criteria is dated and attributed.

What it produced

  • Reduced fiscal dependence on proprietary software licences.
  • Analytical capability enabled directly on local teams across the care network.
  • Architecture actively transferred to the regional community through LatinR (2021, 2024, 2025 and 2026) and the international useR! 2022 conference.

Applications

Software I built and maintain

Tools of my own with a running deployment. Where the repository is public, it is linked.

  • Atenciones de urgencia respiratorias

    In production · public repository

    Viewer for respiratory emergency care in Chile by epidemiological week, built on open data from the Ministry’s statistics department, refreshed automatically every day.

    • Next.js
    • Datos abiertos DEIS
    • GitHub Actions
    • GitHub Pages
  • Autoevaluación de gobernanza de datos

    In production · public repository

    Self-assessment instrument for data protection and governance maturity in public institutions, aligned to Chile’s data protection law and the State data management model. It runs entirely in the browser: no answer ever leaves the assessor’s machine.

    • TypeScript
    • Ley 21.719
    • MGDE
    • Cliente puro
  • anonimizacion-datos

    Public repository

    An R library implementing k-anonymity and l-diversity over the ministry technical standard, with iterative level degradation and output verification before export.

    • R
    • k-anonimidad
    • l-diversidad
  • Flowy

    In production · private repository

    A Kanban board for teams that make decisions in meetings: it records the agreements and who committed to them, not just the tasks. Includes recurrences, blocking dependencies, a weekly executive summary and an admin panel.

    • Next.js
    • PostgreSQL
    • API REST
    • Servidor MCP
    • Vercel
  • hazlacondatos.com

    In production

    The school’s platform: course catalogue, cohort material and interactive tutorials, published as a static site.

    • Astro
    • MDX
  • Cosmic Locket

    In development · personal use

    A personal source manager: saves links, posts and documents with full-text search, captured from the browser or from a phone. A tool built for my own teaching work.

    • Next.js
    • Supabase
    • PWA

In progress

Office of Intelligence and Strategic Health Management

Since 1 September 2026 I have been part of the new department within the Office of Intelligence and Strategic Health Management at the Chilean Ministry of Health. The office concentrates the technical work of a 45-strong multidisciplinary team around seven strategic modernisation programmes, with national health interoperability as the target for 2030.

  1. 01

    National Digital Prescription

    Standardising and fully digitising the prescription and dispensing flow for medicines.

  2. 02

    Shared Clinical Record and Interoperability

    A platform so each person’s clinical history follows them securely across the public and private care network.

  3. 03

    Digital Transformation of Waiting Lists

    Intensive use of analytics, flow optimisation and artificial intelligence to relieve demand for appointments and surgery.

  4. 04

    New National Immunisation System

    A unified digital registry with continuous traceability for the national vaccination plan.

  5. 05

    Health Map

    A geo-intelligence platform structuring the supply and capacity of the care network.

  6. 06

    Medicine Traceability

    Monitoring the supply, storage and dispensing chain for medicines across health facilities.

  7. 07

    Citizen Digital Health Portal

    A unified interface giving patients access to their medical information, appointments and administrative processes in the public system.