import { getTemplateData } from './templateEnvelopes' import { validateCalibrationCurveData } from './templateValidators' import type { CalibrationCurveColumnsAdapterResult, CalibrationCurveDataFrameAdapterResult, CalibrationCurveRowsAdapterResult, CalibrationCurveTemplate, CalibrationCurveTemplateData, } from './types' /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toCalibrationCurveRows( template: CalibrationCurveTemplate | CalibrationCurveTemplateData ): CalibrationCurveRowsAdapterResult { const data = getTemplateData(template, 'calibration-curve') validateCalibrationCurveData(data) return [...data.points] .sort((a, b) => a.order - b.order) .map(point => ({ id: point.id, order: point.order, role: point.role, level: point.level, concentration: point.concentration, unit: point.unit, expectedResponse: point.expectedResponse, response: point.response, replicate: point.replicate, include: point.include, status: point.status, analyte: data.analyte, model: data.model, ...(point.metadata ?? {}), })) } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toCalibrationCurveColumns(): CalibrationCurveColumnsAdapterResult { return [ { key: 'order', label: 'Order', sortable: true, align: 'right' }, { key: 'role', label: 'Role', sortable: true }, { key: 'level', label: 'Level', sortable: true }, { key: 'concentration', label: 'Concentration', sortable: true, align: 'right' }, { key: 'unit', label: 'Unit', sortable: true }, { key: 'expectedResponse', label: 'Expected', sortable: true, align: 'right' }, { key: 'response', label: 'Response', sortable: true, align: 'right' }, { key: 'replicate', label: 'Replicate', sortable: true, align: 'right' }, { key: 'include', label: 'Include', sortable: true }, { key: 'status', label: 'Status', sortable: true }, ] } /** @deprecated Scheduled for removal from the core SDK in MINT 1.4; the biology templates move to a dedicated package or the owning plugins. */ export function toCalibrationCurveDataFrame( template: CalibrationCurveTemplate | CalibrationCurveTemplateData ): CalibrationCurveDataFrameAdapterResult { return { data: toCalibrationCurveRows(template), columns: toCalibrationCurveColumns(), rowKey: 'id', } }