Survival scenario charts on the governance page; breast treatment entity
This commit is contained in:
@@ -183,6 +183,7 @@
|
|||||||
"cervical_biopsy",
|
"cervical_biopsy",
|
||||||
"mammography",
|
"mammography",
|
||||||
"breast_biopsy",
|
"breast_biopsy",
|
||||||
|
"breast_treatment",
|
||||||
"clinical_note",
|
"clinical_note",
|
||||||
"death",
|
"death",
|
||||||
"mchat",
|
"mchat",
|
||||||
@@ -298,6 +299,7 @@
|
|||||||
"cervical_biopsy",
|
"cervical_biopsy",
|
||||||
"mammography",
|
"mammography",
|
||||||
"breast_biopsy",
|
"breast_biopsy",
|
||||||
|
"breast_treatment",
|
||||||
"clinical_note",
|
"clinical_note",
|
||||||
"death",
|
"death",
|
||||||
"mchat",
|
"mchat",
|
||||||
@@ -818,6 +820,7 @@
|
|||||||
"cervical_biopsy",
|
"cervical_biopsy",
|
||||||
"mammography",
|
"mammography",
|
||||||
"breast_biopsy",
|
"breast_biopsy",
|
||||||
|
"breast_treatment",
|
||||||
"clinical_note",
|
"clinical_note",
|
||||||
"death",
|
"death",
|
||||||
"mchat",
|
"mchat",
|
||||||
@@ -1120,6 +1123,7 @@
|
|||||||
"cervical_biopsy",
|
"cervical_biopsy",
|
||||||
"mammography",
|
"mammography",
|
||||||
"breast_biopsy",
|
"breast_biopsy",
|
||||||
|
"breast_treatment",
|
||||||
"clinical_note",
|
"clinical_note",
|
||||||
"death",
|
"death",
|
||||||
"mchat",
|
"mchat",
|
||||||
@@ -2391,6 +2395,7 @@
|
|||||||
"cervical_biopsy",
|
"cervical_biopsy",
|
||||||
"mammography",
|
"mammography",
|
||||||
"breast_biopsy",
|
"breast_biopsy",
|
||||||
|
"breast_treatment",
|
||||||
"clinical_note",
|
"clinical_note",
|
||||||
"death",
|
"death",
|
||||||
"mchat",
|
"mchat",
|
||||||
@@ -2497,6 +2502,7 @@
|
|||||||
"cervical_biopsy",
|
"cervical_biopsy",
|
||||||
"mammography",
|
"mammography",
|
||||||
"breast_biopsy",
|
"breast_biopsy",
|
||||||
|
"breast_treatment",
|
||||||
"clinical_note",
|
"clinical_note",
|
||||||
"death",
|
"death",
|
||||||
"mchat",
|
"mchat",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { RequestBuilder } from '../../request-builder';
|
|||||||
|
|
||||||
|
|
||||||
export interface Conflicts$Params {
|
export interface Conflicts$Params {
|
||||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function conflicts(http: HttpClient, rootUrl: string, params: Conflicts$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
export function conflicts(http: HttpClient, rootUrl: string, params: Conflicts$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { RequestBuilder } from '../../request-builder';
|
|||||||
|
|
||||||
|
|
||||||
export interface Held$Params {
|
export interface Held$Params {
|
||||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function held(http: HttpClient, rootUrl: string, params: Held$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
export function held(http: HttpClient, rootUrl: string, params: Held$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { Position } from '../models/position';
|
|||||||
export interface Extract {
|
export interface Extract {
|
||||||
column: string;
|
column: string;
|
||||||
concept_map?: (string | null);
|
concept_map?: (string | null);
|
||||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
||||||
formats?: {
|
formats?: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { Position } from '../models/position';
|
|||||||
export interface Fhir {
|
export interface Fhir {
|
||||||
column?: string;
|
column?: string;
|
||||||
concept_map?: (string | null);
|
concept_map?: (string | null);
|
||||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
||||||
id: string;
|
id: string;
|
||||||
inputs?: Array<string>;
|
inputs?: Array<string>;
|
||||||
kind?: 'fhir';
|
kind?: 'fhir';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||||
|
|
||||||
export interface Rejection {
|
export interface Rejection {
|
||||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
||||||
reason: string;
|
reason: string;
|
||||||
record: string;
|
record: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Position } from '../models/position';
|
|||||||
* one `link` node among the inputs. Rule breaks are held for review.
|
* one `link` node among the inputs. Rule breaks are held for review.
|
||||||
*/
|
*/
|
||||||
export interface Target {
|
export interface Target {
|
||||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
|
||||||
id: string;
|
id: string;
|
||||||
inputs?: Array<string>;
|
inputs?: Array<string>;
|
||||||
kind?: 'target';
|
kind?: 'target';
|
||||||
|
|||||||
@@ -13,6 +13,29 @@ describe('governance figures', () => {
|
|||||||
expect((found.figure.data[2] as any).error_y.array[0]).toBeCloseTo(0.05);
|
expect((found.figure.data[2] as any).error_y.array[0]).toBeCloseTo(0.05);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("draws each survival scenario after the cohort's curves, titled with its deaths", () => {
|
||||||
|
const scenario = {
|
||||||
|
escenario: 'HER2+ · ≥60 años · estadio III–IV (Alto)',
|
||||||
|
n: 1142,
|
||||||
|
fallecidos: 308,
|
||||||
|
horizons_months: [6, 12, 18],
|
||||||
|
km: { months: [0, 12], S: [1, 0.8], low: [1, 0.75], high: [1, 0.85] },
|
||||||
|
weibull: { t: [0, 12], S: [1, 0.8] },
|
||||||
|
weibull_fractional: { t: [0, 12], S: [1, 0.79] },
|
||||||
|
points: { COMB: { S: [0.86, 0.8, 0.74], low: [0.85, 0.78, 0.72], high: [0.88, 0.82, 0.76] } },
|
||||||
|
};
|
||||||
|
const found = interpretabilityFigures({
|
||||||
|
kind: 'curves',
|
||||||
|
curves: [{ name: 'Kaplan-Meier', months: [0], survival: [1], low: [1], high: [1] }],
|
||||||
|
predicted: { name: 'Modelo', months: [6], survival: [0.9], low: [0.8], high: [0.95] },
|
||||||
|
escenarios: [scenario],
|
||||||
|
});
|
||||||
|
expect(found.length).toBe(2);
|
||||||
|
expect(found[1].title).toContain('fallecidos = 308');
|
||||||
|
expect(found[1].figure.data.length).toBe(5); // band, KM, Weibull, fractional, points
|
||||||
|
expect((found[1].figure.data[4] as any).x).toEqual([6, 12, 18]);
|
||||||
|
});
|
||||||
|
|
||||||
it('draws a recurrence scenario: KM band, both Weibulls and the model points', () => {
|
it('draws a recurrence scenario: KM band, both Weibulls and the model points', () => {
|
||||||
const [found] = interpretabilityFigures({
|
const [found] = interpretabilityFigures({
|
||||||
kind: 'scenarios',
|
kind: 'scenarios',
|
||||||
|
|||||||
@@ -70,6 +70,15 @@ export function interpretabilityFigures(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Its clinical scenarios, those with enough deaths to draw.
|
||||||
|
...((report['escenarios'] ?? []) as any[]).map((e) =>
|
||||||
|
scenarioFigure(
|
||||||
|
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, fallecidos = ${e.fallecidos.toLocaleString('es-MX')})`,
|
||||||
|
e,
|
||||||
|
e.horizons_months,
|
||||||
|
'Supervivencia S(t)',
|
||||||
|
),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
case 'subgroups':
|
case 'subgroups':
|
||||||
@@ -139,43 +148,16 @@ export function interpretabilityFigures(
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
case 'scenarios':
|
case 'scenarios':
|
||||||
return (report['recurrencia']['escenarios'] as any[]).slice(0, 6).map((e) => ({
|
return (report['recurrencia']['escenarios'] as any[])
|
||||||
title: `${e.cohorte_nombre} · ${e.escenario} (n = ${e.n}, ${e.recaidas} recaídas)`,
|
.slice(0, 6)
|
||||||
figure: {
|
.map((e) =>
|
||||||
data: [
|
scenarioFigure(
|
||||||
...banded(
|
`${e.cohorte_nombre} · ${e.escenario} (n = ${e.n}, ${e.recaidas} recaídas)`,
|
||||||
'Kaplan-Meier (IC 95 %)',
|
e,
|
||||||
{ x: e.km.months, y: e.km.S, low: e.km.low, high: e.km.high },
|
|
||||||
PALETTE[0],
|
|
||||||
),
|
|
||||||
{
|
|
||||||
x: e.weibull.t,
|
|
||||||
y: e.weibull.S,
|
|
||||||
name: 'Weibull',
|
|
||||||
type: 'scatter',
|
|
||||||
mode: 'lines',
|
|
||||||
line: { color: PALETTE[1], dash: 'dot' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: e.weibull_fractional.t,
|
|
||||||
y: e.weibull_fractional.S,
|
|
||||||
name: 'Weibull fraccional',
|
|
||||||
type: 'scatter',
|
|
||||||
mode: 'lines',
|
|
||||||
line: { color: PALETTE[2] },
|
|
||||||
},
|
|
||||||
points(
|
|
||||||
'Modelo (IC 95 % bootstrap)',
|
|
||||||
report['recurrencia']['horizons_months'],
|
report['recurrencia']['horizons_months'],
|
||||||
e.points.COMB,
|
'Supervivencia libre de recaída',
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
layout: {
|
|
||||||
xaxis: { title: { text: 'Meses desde el diagnóstico' } },
|
|
||||||
yaxis: { title: { text: 'Supervivencia libre de recaída' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
case 'age_curves': {
|
case 'age_curves': {
|
||||||
// The metric's own curve; a topography has only electrodes: its first one.
|
// The metric's own curve; a topography has only electrodes: its first one.
|
||||||
const value = report['curves']['value'] ?? Object.values(report['curves'])[0];
|
const value = report['curves']['value'] ?? Object.values(report['curves'])[0];
|
||||||
@@ -228,6 +210,49 @@ export function interpretabilityFigures(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** One clinical scenario: Kaplan-Meier with its band, the classic and fractional Weibull,
|
||||||
|
* and the model's points with their bootstrap band. */
|
||||||
|
function scenarioFigure(
|
||||||
|
title: string,
|
||||||
|
e: any,
|
||||||
|
horizons: number[],
|
||||||
|
yTitle: string,
|
||||||
|
): { title: string; figure: Figure } {
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
figure: {
|
||||||
|
data: [
|
||||||
|
...banded(
|
||||||
|
'Kaplan-Meier (IC 95 % Greenwood)',
|
||||||
|
{ x: e.km.months, y: e.km.S, low: e.km.low, high: e.km.high },
|
||||||
|
PALETTE[0],
|
||||||
|
),
|
||||||
|
{
|
||||||
|
x: e.weibull.t,
|
||||||
|
y: e.weibull.S,
|
||||||
|
name: 'Weibull',
|
||||||
|
type: 'scatter',
|
||||||
|
mode: 'lines',
|
||||||
|
line: { color: PALETTE[1] },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
x: e.weibull_fractional.t,
|
||||||
|
y: e.weibull_fractional.S,
|
||||||
|
name: 'Weibull fraccional',
|
||||||
|
type: 'scatter',
|
||||||
|
mode: 'lines',
|
||||||
|
line: { color: PALETTE[2], dash: 'dash' },
|
||||||
|
},
|
||||||
|
points('LR + HBN combinado (IC 95 % bootstrap)', horizons, e.points.COMB),
|
||||||
|
],
|
||||||
|
layout: {
|
||||||
|
xaxis: { title: { text: 'Meses desde el diagnóstico' } },
|
||||||
|
yaxis: { title: { text: yTitle } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function points(
|
function points(
|
||||||
name: string,
|
name: string,
|
||||||
x: number[],
|
x: number[],
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const ENTITIES: Record<Entity, string> = {
|
|||||||
identity: 'Identidad',
|
identity: 'Identidad',
|
||||||
mammography: 'Mastografía',
|
mammography: 'Mastografía',
|
||||||
breast_biopsy: 'Biopsia de mama',
|
breast_biopsy: 'Biopsia de mama',
|
||||||
|
breast_treatment: 'Tratamiento de cáncer de mama',
|
||||||
mchat: 'M-CHAT',
|
mchat: 'M-CHAT',
|
||||||
ados2: 'ADOS-2',
|
ados2: 'ADOS-2',
|
||||||
eeg: 'Electroencefalograma',
|
eeg: 'Electroencefalograma',
|
||||||
|
|||||||
Reference in New Issue
Block a user