Skip to content

Commit

Permalink
Update Optimize Output (#4425)
Browse files Browse the repository at this point in the history
Co-authored-by: Yohann Paris <[email protected]>
  • Loading branch information
Tom-Szendrey and YohannParis authored Aug 13, 2024
1 parent 3590c3d commit e69f2e0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const OptimizeCiemssOperation: Operation = {
acceptMultiple: false
}
],
outputs: [{ type: 'simulationId' }],
outputs: [{ type: 'policyInterventionId|datasetId' }],
isRunnable: true,

initState: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import { createForecastChart } from '@/services/charts';
import { mergeResults, renameFnGenerator } from '@/components/workflow/ops/calibrate-ciemss/calibrate-utils';
import { getModelByModelConfigurationId, getUnitsFromModelParts } from '@/services/model';
import { getModelConfigurationById } from '@/services/model-configurations';
import { createDatasetFromSimulationResult } from '@/services/dataset';
import { useProjects } from '@/composables/project';
import {
OptimizeCiemssOperationState,
OptimizeCiemssOperation,
Expand Down Expand Up @@ -235,10 +236,27 @@ Provide a consis summary in 100 words or less.
state.postForecastRunId = postSimId;
emit('update-state', state);
const datasetName = `Forecast run ${state.postForecastRunId}`;
const projectId = useProjects().activeProjectId.value;
const datasetResult = await createDatasetFromSimulationResult(
projectId,
state.postForecastRunId,
datasetName,
false
);
if (!datasetResult) {
return;
}
emit('append-output', {
type: OptimizeCiemssOperation.outputs[0].type,
label: nodeOutputLabel(props.node, `Simulation output`),
value: [postSimId],
label: nodeOutputLabel(props.node, `Optimize output`),
value: [
{
policyInterventionId: state.optimizedInterventionPolicyId,
datasetId: datasetResult.id
}
],
isSelected: false,
state
});
Expand Down

0 comments on commit e69f2e0

Please sign in to comment.