Closed j-or closed 1 year ago
I didn't notice this bug report and just spent an hour reaching the same conclusion :) A side effect of the data points not updating is that the Python backend fails because of a mismatch between input and data space
For future reference, the following Zod code will validate that all datapoints have a name that is defined in in variable definitions:
export const experimentSchema = z
.object({
id: z.string(),
lastEvaluationHash: z.string().optional(),
changedSinceLastEvaluation: z.boolean(),
info: infoSchema,
extras: z.record(z.unknown()),
categoricalVariables: z.array(categorialVariableSchema),
valueVariables: z.array(valueVariableSchema),
scoreVariables: z.array(scoreVariableSchema),
optimizerConfig: optimizerSchema,
results: experimentResultSchema,
dataPoints: z.array(dataEntrySchema),
})
.refine(s =>
s.dataPoints.reduce(
(prev, curr) =>
prev
? curr.data.reduce(
(acc, dp) =>
acc
? s.categoricalVariables.find(cv => cv.name === dp.name) !==
undefined ||
s.valueVariables.find(cv => cv.name === dp.name) !==
undefined ||
s.scoreVariables.find(cv => cv.name === dp.name) !==
undefined
: false,
true
)
: false,
true
)
)
Editing the name of a factor (input model variable) visually removes the factor from data points, because the name is not updated in data points.