Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4864c1981 | |||
| 5fb2bc682a |
@@ -19,5 +19,21 @@ valores = [ # solo codigo; el orden de la lista es el de
|
||||
]
|
||||
```
|
||||
|
||||
A result read from a document's text (a report's interpretation, a PDF's text layer, a note) also says how it's
|
||||
printed. These keys don't reach any table; the silver load reads them (`webapi.orchestration.silver.extracted`):
|
||||
|
||||
```toml
|
||||
[<estudio>.resultados.<resultado>]
|
||||
etiquetas_fuente = ["Densidad mamaria", "Densidad"] # the captions it's printed under
|
||||
buscar_en_texto = true # codigo only: also as a mention anywhere in the text
|
||||
provisional = true # captions and spellings not yet confirmed with the hospital's documents
|
||||
valores = [
|
||||
{ valor = "C", etiqueta = "Heterogéneamente densa", alias = ["Tipo C", "ACR C"] }, # each spelling of the value
|
||||
]
|
||||
```
|
||||
|
||||
A spelling with no alias is stored as `valor_fuente` without `valor_id` and counted as out of catalog; adding it
|
||||
as an alias and reloading turns it into the code. One spelling on two values of a result is rejected.
|
||||
|
||||
Los valores son los que llegan del hospital (los enums de Core). Las etiquetas y los colores de las figuras
|
||||
siguen en `parametros.toml` del kit hasta F3; `indicadores_kit/tests/test_catalogos.py` exige que coincidan.
|
||||
|
||||
@@ -30,6 +30,27 @@ valores = [
|
||||
{ valor = "B6", etiqueta = "BI-RADS 6" },
|
||||
]
|
||||
|
||||
# Read from the radiologist's interpretation (`mast_interpretacion`). Provisional: captions and spellings are
|
||||
# assumptions until the hospital's reports are seen; adding one is a line in `etiquetas_fuente` or `alias`.
|
||||
[mastografia.resultados.densidad]
|
||||
etiqueta = "Densidad mamaria (ACR)"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Densidad mamaria", "Densidad", "Composición mamaria", "Patrón mamario"]
|
||||
valores = [
|
||||
{ valor = "A", etiqueta = "Predominantemente grasa", alias = ["Tipo A", "ACR A", "Categoría A", "(A)", "Grasa"] },
|
||||
{ valor = "B", etiqueta = "Densidades fibroglandulares dispersas", alias = ["Tipo B", "ACR B", "Categoría B", "(B)", "Fibroglandular dispersa"] },
|
||||
{ valor = "C", etiqueta = "Heterogéneamente densa", alias = ["Tipo C", "ACR C", "Categoría C", "(C)", "Heterogéneamente densas"] },
|
||||
{ valor = "D", etiqueta = "Extremadamente densa", alias = ["Tipo D", "ACR D", "Categoría D", "(D)", "Extremadamente densas"] },
|
||||
]
|
||||
|
||||
[mastografia.resultados.tamano_lesion_mm]
|
||||
etiqueta = "Tamaño de la lesión"
|
||||
tipo_valor = "numero"
|
||||
unidad = "mm"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Tamaño de la lesión", "Tamaño del nódulo", "Diámetro mayor", "Mide"]
|
||||
|
||||
[biopsia]
|
||||
etiqueta = "Biopsia de mama"
|
||||
codigos_hospital = ["BIOPSIA_CHICA"]
|
||||
@@ -48,6 +69,85 @@ valores = [
|
||||
etiqueta = "Fecha de solicitud"
|
||||
tipo_valor = "fecha"
|
||||
|
||||
# Read from the pathology report's text layer (`bx_pdf_blob`). Provisional, as the mammography's.
|
||||
[biopsia.resultados.tipo_histologico]
|
||||
etiqueta = "Tipo histológico"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Tipo histológico", "Diagnóstico histopatológico", "Diagnóstico"]
|
||||
buscar_en_texto = true
|
||||
valores = [
|
||||
{ valor = "DUCTAL_INFILTRANTE", etiqueta = "Carcinoma ductal infiltrante", alias = ["Ductal infiltrante", "Carcinoma ductal invasor", "Carcinoma infiltrante de tipo no especial", "CDI"] },
|
||||
{ valor = "LOBULILLAR_INFILTRANTE", etiqueta = "Carcinoma lobulillar infiltrante", alias = ["Lobulillar infiltrante", "Carcinoma lobulillar invasor", "CLI"] },
|
||||
{ valor = "DUCTAL_IN_SITU", etiqueta = "Carcinoma ductal in situ", alias = ["Ductal in situ", "CDIS"] },
|
||||
{ valor = "OTRO", etiqueta = "Otro tipo histológico" },
|
||||
]
|
||||
|
||||
[biopsia.resultados.grado_nottingham]
|
||||
etiqueta = "Grado histológico (Nottingham)"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Grado histológico", "Grado de Nottingham", "Grado Scarff-Bloom-Richardson", "SBR"]
|
||||
valores = [
|
||||
{ valor = "G1", etiqueta = "Grado 1", alias = ["1", "I", "Grado I", "Bien diferenciado"] },
|
||||
{ valor = "G2", etiqueta = "Grado 2", alias = ["2", "II", "Grado II", "Moderadamente diferenciado"] },
|
||||
{ valor = "G3", etiqueta = "Grado 3", alias = ["3", "III", "Grado III", "Poco diferenciado"] },
|
||||
]
|
||||
|
||||
[biopsia.resultados.receptor_estrogeno]
|
||||
etiqueta = "Receptor de estrógeno"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Receptores de estrógeno", "Receptor de estrógenos", "Receptores estrogénicos", "RE", "ER"]
|
||||
valores = [
|
||||
{ valor = "POSITIVO", etiqueta = "Positivo", alias = ["Pos", "+"] },
|
||||
{ valor = "NEGATIVO", etiqueta = "Negativo", alias = ["Neg", "-"] },
|
||||
]
|
||||
|
||||
[biopsia.resultados.receptor_estrogeno_pct]
|
||||
etiqueta = "Receptor de estrógeno, células teñidas"
|
||||
tipo_valor = "numero"
|
||||
unidad = "%"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Receptores de estrógeno", "Receptor de estrógenos", "Receptores estrogénicos", "RE", "ER"]
|
||||
|
||||
[biopsia.resultados.receptor_progesterona]
|
||||
etiqueta = "Receptor de progesterona"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Receptores de progesterona", "Receptor de progesterona", "Receptores progestágenos", "RP", "PR"]
|
||||
valores = [
|
||||
{ valor = "POSITIVO", etiqueta = "Positivo", alias = ["Pos", "+"] },
|
||||
{ valor = "NEGATIVO", etiqueta = "Negativo", alias = ["Neg", "-"] },
|
||||
]
|
||||
|
||||
[biopsia.resultados.receptor_progesterona_pct]
|
||||
etiqueta = "Receptor de progesterona, células teñidas"
|
||||
tipo_valor = "numero"
|
||||
unidad = "%"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Receptores de progesterona", "Receptor de progesterona", "Receptores progestágenos", "RP", "PR"]
|
||||
|
||||
# A bare "positivo" is left unmatched on purpose: it doesn't say whether it's 3+ or an amplified 2+.
|
||||
[biopsia.resultados.her2]
|
||||
etiqueta = "HER2 (inmunohistoquímica)"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["HER2", "HER-2", "HER2/neu", "C-erbB-2"]
|
||||
valores = [
|
||||
{ valor = "H0", etiqueta = "0", alias = ["0", "Negativo (0)", "Score 0"] },
|
||||
{ valor = "H1", etiqueta = "1+", alias = ["1+", "Negativo (1+)", "Score 1+"] },
|
||||
{ valor = "H2", etiqueta = "2+", alias = ["2+", "Equívoco", "Indeterminado", "Score 2+"] },
|
||||
{ valor = "H3", etiqueta = "3+", alias = ["3+", "Positivo (3+)", "Score 3+"] },
|
||||
]
|
||||
|
||||
[biopsia.resultados.ki67_pct]
|
||||
etiqueta = "Ki-67"
|
||||
tipo_valor = "numero"
|
||||
unidad = "%"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Ki-67", "Ki67", "Índice de proliferación"]
|
||||
|
||||
[nota_medica]
|
||||
etiqueta = "Nota médica"
|
||||
|
||||
@@ -56,6 +156,25 @@ etiqueta = "Diagnóstico"
|
||||
tipo_valor = "externo"
|
||||
sistema = "CIE-10"
|
||||
|
||||
# Read from the note's diagnosis and prognosis texts. Provisional; a stage mentioned without a caption counts too
|
||||
# ("... estadio clínico IIA (T2N0M0)").
|
||||
[nota_medica.resultados.estadio_clinico]
|
||||
etiqueta = "Estadio clínico"
|
||||
tipo_valor = "codigo"
|
||||
provisional = true
|
||||
etiquetas_fuente = ["Estadio clínico", "Etapa clínica", "Estadio", "EC"]
|
||||
buscar_en_texto = true
|
||||
valores = [
|
||||
{ valor = "E0", etiqueta = "Estadio 0", alias = ["EC 0", "Etapa 0", "In situ", "Estadio clínico 0", "Etapa clínica 0"] },
|
||||
{ valor = "EI", etiqueta = "Estadio I", alias = ["I", "IA", "IB", "EC I", "EC IA", "EC IB", "Estadio IA", "Estadio IB", "Etapa I", "Estadio clínico I", "Etapa clínica I", "Estadio clínico IA", "Estadio clínico IB"] },
|
||||
{ valor = "EIIA", etiqueta = "Estadio IIA", alias = ["IIA", "EC IIA", "Etapa IIA", "Estadio clínico IIA", "Etapa clínica IIA"] },
|
||||
{ valor = "EIIB", etiqueta = "Estadio IIB", alias = ["IIB", "EC IIB", "Etapa IIB", "Estadio clínico IIB", "Etapa clínica IIB"] },
|
||||
{ valor = "EIIIA", etiqueta = "Estadio IIIA", alias = ["IIIA", "EC IIIA", "Etapa IIIA", "Estadio clínico IIIA", "Etapa clínica IIIA"] },
|
||||
{ valor = "EIIIB", etiqueta = "Estadio IIIB", alias = ["IIIB", "EC IIIB", "Etapa IIIB", "Estadio clínico IIIB", "Etapa clínica IIIB"] },
|
||||
{ valor = "EIIIC", etiqueta = "Estadio IIIC", alias = ["IIIC", "EC IIIC", "Etapa IIIC", "Estadio clínico IIIC", "Etapa clínica IIIC"] },
|
||||
{ valor = "EIV", etiqueta = "Estadio IV", alias = ["IV", "EC IV", "Etapa IV", "Metastásico", "Estadio clínico IV", "Etapa clínica IV"] },
|
||||
]
|
||||
|
||||
[nota_medica.resultados.especialidad]
|
||||
etiqueta = "Especialidad que la escribe"
|
||||
tipo_valor = "codigo"
|
||||
|
||||
@@ -56,6 +56,23 @@ vars:
|
||||
especialidades_diagnostico: ["CIRUGIA_ONCOLOGICA"]
|
||||
horizonte_toma_diagnostico_dias: 180
|
||||
birads_gravedad: ["B1", "B2", "B3", "B0", "B4", "B4A", "B4B", "B4C", "B5", "B6"]
|
||||
# The analysis' stratifiers (models/cama/silver/cama_estratificadores.sql), from the catalog's provisional results
|
||||
# read from reports; placeholders until the domain expert validates them. `estadios`: each clinical stage's
|
||||
# group; `etapa_temprana`: the groups counted as early, the rest of the known ones advanced. The surrogate
|
||||
# molecular subtype: HER2 3+ is HER2-positive; HER2 0 or 1+ with both receptors negative, triple negative; with a
|
||||
# positive receptor, luminal A when Ki-67 is under `ki67_corte` % and progesterone positive with at least
|
||||
# `rp_corte` % (or no percentage), luminal B when Ki-67 is at least `ki67_corte` % or progesterone falls short;
|
||||
# without Ki-67, none. `tamano_t`: T by the lesion's largest diameter in mm, each up to its bound.
|
||||
# The biopsy grades that are an invasive cancer (models/cama/gold/eventos/cama_cancer_invasor.sql).
|
||||
grados_invasor: ["CARCINOMA_INVASOR"]
|
||||
estratos:
|
||||
estadios: {E0: "0", EI: "i", EIIA: "ii", EIIB: "ii", EIIIA: "iii", EIIIB: "iii", EIIIC: "iii", EIV: "iv"}
|
||||
etapa_temprana: ["0", "i", "ii"]
|
||||
her2_positivo: ["H3"]
|
||||
her2_negativo: ["H0", "H1"]
|
||||
ki67_corte: 20
|
||||
rp_corte: 20
|
||||
tamano_t: [{t: "t1", hasta_mm: 20}, {t: "t2", hasta_mm: 50}, {t: "t3", hasta_mm: null}]
|
||||
# TEA's rules (models/tea). The cohort: children whose first M-CHAT was at `edad_min_meses` to `edad_max_meses`
|
||||
# completed months (days / `dias_por_mes`, rounded to one decimal, then truncated); `ventanas`, the age groups of
|
||||
# that age. A confirmation is a neuropediatrics note with one of `cie_tea` (without the dot, compared exactly).
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
-- One row per biopsy report with an invasive cancer (`vars.cama.grados_invasor`), dated by the report, with the
|
||||
-- BI-RADS of the mammogram that led to it (null when none was found or it has no report): the grain of the measures
|
||||
-- that describe the cancers found. When the report became known: the start of the load that wrote it. The birth date
|
||||
-- is the patient's, for strata by age; the tumour's stratifiers come from cama_estratificadores.
|
||||
|
||||
select
|
||||
b.procedimiento_id,
|
||||
b.fuente_id,
|
||||
b.pac_id,
|
||||
b.fecha_reporte,
|
||||
b.grado,
|
||||
m.birads,
|
||||
c.inicio as reporte_conocido_en,
|
||||
persona.fecha_nacimiento
|
||||
from {{ ref('cama_biopsias') }} b
|
||||
join {{ source('silver', 'carga') }} c
|
||||
on c.carga_id = b.reporte_carga_id
|
||||
join {{ source('silver', 'persona') }} persona
|
||||
on persona.pac_id = b.pac_id
|
||||
left join {{ ref('cama_mastografias') }} m
|
||||
on m.procedimiento_id = b.toma_id and m.pac_id = b.pac_id and m.birads is not null
|
||||
where b.fecha_reporte is not null
|
||||
and b.grado in {{ sql_list(var('cama')['grados_invasor']) }}
|
||||
@@ -0,0 +1,122 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: cama_cancer_invasor
|
||||
description: "Reportes de biopsia con cáncer invasor, con el BI-RADS de la mastografía que los originó."
|
||||
config:
|
||||
materialized: view
|
||||
|
||||
semantic_models:
|
||||
- name: cama_cancer_invasor
|
||||
description: "Biopsy reports with an invasive cancer and the BI-RADS that led to them: what the cancers found count."
|
||||
model: ref('cama_cancer_invasor')
|
||||
defaults:
|
||||
agg_time_dimension: fecha_reporte
|
||||
entities:
|
||||
- name: cancer
|
||||
type: primary
|
||||
expr: procedimiento_id
|
||||
- name: paciente
|
||||
type: foreign
|
||||
expr: pac_id
|
||||
dimensions:
|
||||
- name: fecha_reporte
|
||||
type: time
|
||||
type_params:
|
||||
time_granularity: day
|
||||
- name: reporte_conocido_en
|
||||
type: time
|
||||
type_params:
|
||||
time_granularity: day
|
||||
- name: fecha_nacimiento
|
||||
type: time
|
||||
type_params:
|
||||
time_granularity: day
|
||||
- name: birads
|
||||
type: categorical
|
||||
- name: fuente_id
|
||||
type: categorical
|
||||
measures:
|
||||
- name: pacientes_con_cancer_invasor
|
||||
description: "Distinct patients: each counts once per period, however many reports."
|
||||
agg: count_distinct
|
||||
expr: pac_id
|
||||
|
||||
metrics:
|
||||
- name: cama_birads_cancer_invasor
|
||||
label: "BI-RADS de los cánceres invasores"
|
||||
description: >-
|
||||
De las pacientes con una biopsia reportada en el periodo con carcinoma invasor, cuántas tenían cada BI-RADS en la
|
||||
mastografía que originó su biopsia más reciente, por edad y por las características del tumor: estadio clínico,
|
||||
etapa, subtipo molecular y tamaño. Las características vienen de los reportes leídos por texto y son
|
||||
provisionales. «Sin dato»: la biopsia no se ligó a una mastografía con BI-RADS.
|
||||
type: simple
|
||||
type_params:
|
||||
measure: pacientes_con_cancer_invasor
|
||||
config:
|
||||
meta:
|
||||
measure_url: cama/CAMA_BIRADS_CANCER_INVASOR
|
||||
version: 0.1.0
|
||||
scoring: composition
|
||||
basis: paciente
|
||||
grupo: TOTAL
|
||||
contrato: C2
|
||||
tipos_periodo: [semestre, mes]
|
||||
poblaciones_fhir: [measure-observation]
|
||||
conocida_en: [reporte_conocido_en]
|
||||
# Each patient's latest report of the period with a BI-RADS; one without it counts as SIN_DATO.
|
||||
categoria:
|
||||
valor: birads
|
||||
sin_dato: SIN_DATO
|
||||
elige: ultimo_valido
|
||||
valido: "{% raw %}{{ Dimension('cancer__birads') }} is not null{% endraw %}"
|
||||
orden: [fecha_reporte, fuente_id]
|
||||
# The tumour's stratifiers: what cama_estratificadores held by the event cut-off (the stage or the subtype
|
||||
# is usually written after the biopsy). The first value that holds wins: the most advanced, or for the
|
||||
# subtype the one with the worst prognosis, when the reports disagree.
|
||||
estratos:
|
||||
grupo_edad:
|
||||
tipo: edad_al_inicio_del_periodo
|
||||
nacimiento: fecha_nacimiento
|
||||
estadio:
|
||||
tipo: linea_de_tiempo_al_corte
|
||||
etiqueta: Estadio clínico
|
||||
linea: cama_estratificadores
|
||||
valores:
|
||||
- {valor: IV, etiqueta: Estadio IV, si: [{estadio_iv: true}]}
|
||||
- {valor: III, etiqueta: Estadio III, si: [{estadio_iii: true}]}
|
||||
- {valor: II, etiqueta: Estadio II, si: [{estadio_ii: true}]}
|
||||
- {valor: I, etiqueta: Estadio I, si: [{estadio_i: true}]}
|
||||
- {valor: "0", etiqueta: Estadio 0, si: [{estadio_0: true}]}
|
||||
resto: SIN_DATO
|
||||
resto_etiqueta: Sin dato
|
||||
etapa:
|
||||
tipo: linea_de_tiempo_al_corte
|
||||
etiqueta: Etapa
|
||||
linea: cama_estratificadores
|
||||
valores:
|
||||
- {valor: AVANZADA, etiqueta: Avanzada (III a IV), si: [{etapa_avanzada: true}]}
|
||||
- {valor: TEMPRANA, etiqueta: Temprana (0 a II), si: [{etapa_temprana: true}]}
|
||||
resto: SIN_DATO
|
||||
resto_etiqueta: Sin dato
|
||||
clasificacion:
|
||||
tipo: linea_de_tiempo_al_corte
|
||||
etiqueta: Subtipo molecular
|
||||
linea: cama_estratificadores
|
||||
valores:
|
||||
- {valor: TN, etiqueta: Triple negativo, si: [{subtipo_triple_negativo: true}]}
|
||||
- {valor: HER2, etiqueta: HER2 positivo, si: [{subtipo_her2: true}]}
|
||||
- {valor: LUM_B, etiqueta: Luminal B, si: [{subtipo_luminal_b: true}]}
|
||||
- {valor: LUM_A, etiqueta: Luminal A, si: [{subtipo_luminal_a: true}]}
|
||||
resto: SIN_DATO
|
||||
resto_etiqueta: Sin dato
|
||||
tamano:
|
||||
tipo: linea_de_tiempo_al_corte
|
||||
etiqueta: Tamaño tumoral (T)
|
||||
linea: cama_estratificadores
|
||||
valores:
|
||||
- {valor: T3, etiqueta: "> 5 cm (T3)", si: [{tamano_t3: true}]}
|
||||
- {valor: T2, etiqueta: "> 2 a 5 cm (T2)", si: [{tamano_t2: true}]}
|
||||
- {valor: T1, etiqueta: "≤ 2 cm (T1)", si: [{tamano_t1: true}]}
|
||||
resto: SIN_DATO
|
||||
resto_etiqueta: Sin dato
|
||||
@@ -0,0 +1,82 @@
|
||||
{# Each patient's stratifiers for the analysis, as timeline facts (`pac_id`, `tipo`, `fecha`, `conocida_en`): what a
|
||||
measure's `linea_de_tiempo_*` strata ask about. Derived from cama_linea_de_tiempo's lines read from reports, by the
|
||||
rules in `vars.cama.estratos`: the clinical stage's group and early or advanced stage (from a note), the surrogate
|
||||
molecular subtype (from one pathology report's receptors, HER2 and Ki-67 together) and the lesion's T (from a
|
||||
mammography report). A fact is dated and known as the lines it comes from. A view, like the timeline. #}
|
||||
{{ config(materialized = 'view') }}
|
||||
{%- set e = var('cama')['estratos'] -%}
|
||||
|
||||
with linea as (
|
||||
select pac_id, fecha, conocida_en, tipo, valor_codigo, valor_numerico, fuente_tabla, fuente_id
|
||||
from {{ ref('cama_linea_de_tiempo') }}
|
||||
),
|
||||
|
||||
estadio as (
|
||||
select
|
||||
pac_id, fecha, conocida_en,
|
||||
case valor_codigo
|
||||
{%- for codigo, grupo in e['estadios'].items() %}
|
||||
when '{{ codigo }}' then 'estadio_{{ grupo }}'
|
||||
{%- endfor %}
|
||||
end as estadio,
|
||||
case valor_codigo
|
||||
{%- for codigo, grupo in e['estadios'].items() %}
|
||||
when '{{ codigo }}' then '{{ 'etapa_temprana' if grupo in e['etapa_temprana'] else 'etapa_avanzada' }}'
|
||||
{%- endfor %}
|
||||
end as etapa
|
||||
from linea
|
||||
where tipo = 'estadio_clinico'
|
||||
),
|
||||
|
||||
reporte as (
|
||||
select
|
||||
pac_id, fecha, fuente_tabla, fuente_id,
|
||||
max(conocida_en) as conocida_en,
|
||||
max(case when tipo = 'receptor_estrogeno' then valor_codigo end) as re,
|
||||
max(case when tipo = 'receptor_progesterona' then valor_codigo end) as rp,
|
||||
max(case when tipo = 'receptor_progesterona_pct' then valor_numerico end) as rp_pct,
|
||||
max(case when tipo = 'her2' then valor_codigo end) as her2,
|
||||
max(case when tipo = 'ki67_pct' then valor_numerico end) as ki67
|
||||
from linea
|
||||
where tipo in ('receptor_estrogeno', 'receptor_progesterona', 'receptor_progesterona_pct', 'her2', 'ki67_pct')
|
||||
group by pac_id, fecha, fuente_tabla, fuente_id
|
||||
),
|
||||
|
||||
subtipo as (
|
||||
select
|
||||
pac_id, fecha, conocida_en,
|
||||
case
|
||||
when her2 in {{ sql_list(e['her2_positivo']) }} then 'subtipo_her2'
|
||||
when her2 not in {{ sql_list(e['her2_negativo']) }} or her2 is null then null
|
||||
when re = 'NEGATIVO' and rp = 'NEGATIVO' then 'subtipo_triple_negativo'
|
||||
when re = 'POSITIVO' or rp = 'POSITIVO' then
|
||||
case
|
||||
when ki67 is null then null
|
||||
when ki67 < {{ e['ki67_corte'] }} and rp = 'POSITIVO'
|
||||
and (rp_pct is null or rp_pct >= {{ e['rp_corte'] }}) then 'subtipo_luminal_a'
|
||||
else 'subtipo_luminal_b'
|
||||
end
|
||||
end as subtipo
|
||||
from reporte
|
||||
),
|
||||
|
||||
tamano as (
|
||||
select
|
||||
pac_id, fecha, conocida_en,
|
||||
case
|
||||
{%- for t in e['tamano_t'] if t['hasta_mm'] is not none %}
|
||||
when valor_numerico <= {{ t['hasta_mm'] }} then 'tamano_{{ t['t'] }}'
|
||||
{%- endfor %}
|
||||
else 'tamano_{{ (e['tamano_t'] | last)['t'] }}'
|
||||
end as t
|
||||
from linea
|
||||
where tipo = 'tamano_lesion_mm' and valor_numerico is not null
|
||||
)
|
||||
|
||||
select pac_id, estadio as tipo, fecha, conocida_en from estadio where estadio is not null
|
||||
union all
|
||||
select pac_id, etapa as tipo, fecha, conocida_en from estadio where etapa is not null
|
||||
union all
|
||||
select pac_id, subtipo as tipo, fecha, conocida_en from subtipo where subtipo is not null
|
||||
union all
|
||||
select pac_id, t as tipo, fecha, conocida_en from tamano
|
||||
@@ -17,5 +17,17 @@ models:
|
||||
- {estudio_id: "mastografia", clase: "toma", resultado_id: "mastografia.calidad_imagen", clase_de_linea: "procedimiento", tipo: "mastografia", codigo: "mastografia"}
|
||||
- {estudio_id: "mastografia", clase: "reporte", resultado_id: "mastografia.birads", clase_de_linea: "medicion", tipo: "birads", codigo: "birads"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.grado", clase_de_linea: "medicion", tipo: "biopsia", codigo: "grado_histologico"}
|
||||
# Read from the reports' text (provisional catalog results): the stratifiers of the analysis.
|
||||
- {estudio_id: "mastografia", clase: "reporte", resultado_id: "mastografia.densidad", clase_de_linea: "medicion", tipo: "densidad_mamaria"}
|
||||
- {estudio_id: "mastografia", clase: "reporte", resultado_id: "mastografia.tamano_lesion_mm", clase_de_linea: "medicion", tipo: "tamano_lesion_mm", valor: "numerico"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.tipo_histologico", clase_de_linea: "medicion", tipo: "tipo_histologico"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.grado_nottingham", clase_de_linea: "medicion", tipo: "grado_nottingham"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.receptor_estrogeno", clase_de_linea: "medicion", tipo: "receptor_estrogeno"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.receptor_estrogeno_pct", clase_de_linea: "medicion", tipo: "receptor_estrogeno_pct", valor: "numerico"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.receptor_progesterona", clase_de_linea: "medicion", tipo: "receptor_progesterona"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.receptor_progesterona_pct", clase_de_linea: "medicion", tipo: "receptor_progesterona_pct", valor: "numerico"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.her2", clase_de_linea: "medicion", tipo: "her2"}
|
||||
- {estudio_id: "biopsia", clase: "reporte", resultado_id: "biopsia.ki67_pct", clase_de_linea: "medicion", tipo: "ki67_pct", valor: "numerico"}
|
||||
- {estudio_id: "nota_medica", clase: "encuentro", resultado_id: "nota_medica.estadio_clinico", clase_de_linea: "medicion", tipo: "estadio_clinico"}
|
||||
- {estudio_id: null, clase: "orden", resultado_id: null, clase_de_linea: "orden", tipo: "orden", columna: "codigo_fuente"}
|
||||
- {estudio_id: "nota_medica", clase: "encuentro", resultado_id: "nota_medica.diagnostico", clase_de_linea: "diagnostico", tipo: "nota_medica"}
|
||||
|
||||
+1
-1
Submodule WebApi updated: 0f9433949f...dc9a3422e0
Reference in New Issue
Block a user