Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike/update model configuration #3802

Merged
merged 43 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c6f5e62
Updating the current `ModelConfiguration` class to be `ModelConfigura…
dvince2 May 29, 2024
183a52d
Adding POJOs for our model config typing as well as the generated typ…
dvince2 May 29, 2024
879a5f8
More legacy renaming.
dvince2 May 29, 2024
a727c7a
Service and Repository
dvince2 May 29, 2024
93d0609
Database entity prep
dvince2 May 29, 2024
9da19c4
Changing endpoints. More renaming to legacy
dvince2 May 29, 2024
0be46d9
New controller
dvince2 May 29, 2024
efd780c
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 May 30, 2024
8593a79
Creating model configs
dvince2 Jun 3, 2024
2d7e78e
Merging main
dvince2 Jun 3, 2024
99e7adf
Updating model config
dvince2 Jun 3, 2024
467f0c9
delete model config
dvince2 Jun 3, 2024
5d880c1
Updaing front end to use legacy while this is transfered
dvince2 Jun 3, 2024
f61758c
Front end model configuration service
dvince2 Jun 4, 2024
bcf0a60
merging main
dvince2 Jun 4, 2024
a714ec2
merging main
dvince2 Jun 4, 2024
43c0279
Merging main
dvince2 Jun 4, 2024
ace64de
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 4, 2024
cb333da
generating types
dvince2 Jun 4, 2024
8c70378
leg work on endpoint
dvince2 Jun 4, 2024
721021e
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 4, 2024
6c293ad
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 5, 2024
dbc08e0
fixing relations
dvince2 Jun 5, 2024
4a25160
Stuffing `values` for front end
dvince2 Jun 5, 2024
7ce19fb
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 5, 2024
87d89d4
generated types
dvince2 Jun 5, 2024
bcb9676
Removing unused properties
dvince2 Jun 5, 2024
1d27648
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 5, 2024
5eba212
Correct casing
dvince2 Jun 5, 2024
458d1c9
Merging main
dvince2 Jun 7, 2024
0f8ffc2
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 7, 2024
a30b5fd
chore: lint and format server codebase
github-actions[bot] Jun 7, 2024
93a183b
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 10, 2024
8b3a4a8
Removing `values` map
dvince2 Jun 10, 2024
a3c5661
Fixing swagger implementation
dvince2 Jun 10, 2024
567ce89
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 10, 2024
6bf4a82
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 11, 2024
2535d1b
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 11, 2024
6e7f1bf
Function to create an AMR model structure from model configuration (#…
blanchco Jun 11, 2024
94c12f8
chore: lint and format server codebase
github-actions[bot] Jun 11, 2024
9f0373b
chore: update generated types
blanchco Jun 11, 2024
d1f6189
Merge remote-tracking branch 'origin/main' into spike/update-model-co…
dvince2 Jun 11, 2024
e27c98e
Correct Schemas
dvince2 Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@
<script setup lang="ts">
import Button from 'primevue/button';
import InputText from 'primevue/inputtext';
import type { ModelConfiguration } from '@/types/Types';
import type { ModelConfigurationLegacy } from '@/types/Types';

defineProps<{
editValue: string;
modelConfigurations: ModelConfiguration[];
modelConfigurations: ModelConfigurationLegacy[];
calibrationConfig?: boolean;
cellEditStates: any[];
}>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
<script setup lang="ts">
import Button from 'primevue/button';
import InputText from 'primevue/inputtext';
import type { ModelConfiguration } from '@/types/Types';
import type { ModelConfigurationLegacy } from '@/types/Types';

defineProps<{
editValue: string;
modelConfigurations: ModelConfiguration[];
modelConfigurations: ModelConfigurationLegacy[];
calibrationConfig?: boolean;
cellEditStates: any[];
baseInitialsAndParameters: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
:open-value-config="openValueConfig"
@close-modal="openValueConfig = false"
@update-configuration="
(configToUpdate: ModelConfiguration) => emit('update-configuration', configToUpdate)
(configToUpdate: ModelConfigurationLegacy) =>
emit('update-configuration', configToUpdate)
"
/>
</Teleport>
Expand All @@ -106,7 +107,7 @@ import Button from 'primevue/button';
import SelectButton from 'primevue/selectbutton';
import { PetrinetRenderer, NodeType } from '@/model-representation/petrinet/petrinet-renderer';
import { getModelType, getMMT } from '@/services/model';
import type { Model, ModelConfiguration } from '@/types/Types';
import type { Model, ModelConfigurationLegacy } from '@/types/Types';
import TeraResizablePanel from '@/components/widgets/tera-resizable-panel.vue';
import TeraTooltip from '@/components/widgets/tera-tooltip.vue';

Expand All @@ -129,7 +130,7 @@ import TeraStratifiedMatrixPreview from '../model-configurations/tera-stratified
const props = defineProps<{
model: Model;
isEditable: boolean;
modelConfiguration?: ModelConfiguration;
modelConfiguration?: ModelConfigurationLegacy;
isPreview?: boolean;
}>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</template>

<script setup lang="ts">
import { Model, ModelConfiguration } from '@/types/Types';
import { getInitialExpression, getInitialSource } from '@/services/model-configurations';
import { Model, ModelConfigurationLegacy } from '@/types/Types';
import { getInitialExpression, getInitialSource } from '@/services/model-configurations-legacy';
import TeraInput from '@/components/widgets/tera-input.vue';
import { ref } from 'vue';
import Button from 'primevue/button';
Expand All @@ -43,7 +43,7 @@ import {

const props = defineProps<{
model: Model;
modelConfiguration: ModelConfiguration;
modelConfiguration: ModelConfigurationLegacy;
initialId: string;
}>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
</template>

<script setup lang="ts">
import { Model, ModelConfiguration } from '@/types/Types';
import { getInitials } from '@/services/model-configurations';
import { Model, ModelConfigurationLegacy } from '@/types/Types';
import { getInitials } from '@/services/model-configurations-legacy';
import { StratifiedMatrix } from '@/types/Model';
import { ref } from 'vue';
import { collapseInitials, isStratifiedModel } from '@/model-representation/mira/mira';
Expand All @@ -69,8 +69,8 @@ import TeraStratifiedMatrixModal from './model-configurations/tera-stratified-ma
import TeraInitialEntry from './tera-initial-entry.vue';

const props = defineProps<{
modelConfiguration: ModelConfigurationLegacy;
model: Model;
modelConfiguration: ModelConfiguration;
mmt: MiraModel;
mmtParams: MiraTemplateParams;
}>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ import AccordionTab from 'primevue/accordiontab';
import Column from 'primevue/column';
import DataTable from 'primevue/datatable';
import { FeatureConfig, ResultType } from '@/types/common';
import type { Dataset, Model, ModelConfiguration, ProjectAsset } from '@/types/Types';
import type { Dataset, Model, ModelConfigurationLegacy, ProjectAsset } from '@/types/Types';
import { AssetType } from '@/types/Types';
import SelectButton from 'primevue/selectbutton';
import TeraRelatedDocuments from '@/components/widgets/tera-related-documents.vue';
Expand All @@ -112,7 +112,7 @@ import TeraModelSemanticTables from '@/components/model/tera-model-semantic-tabl

const props = defineProps<{
model: Model;
modelConfigurations?: ModelConfiguration[];
modelConfigurations?: ModelConfigurationLegacy[];
featureConfig?: FeatureConfig;
isGeneratingCard?: boolean;
}>();
Expand Down Expand Up @@ -210,7 +210,7 @@ function fetchAsset() {
emit('fetch-model');
}

function updateConfiguration(updatedConfiguration: ModelConfiguration) {
function updateConfiguration(updatedConfiguration: ModelConfigurationLegacy) {
emit('update-configuration', updatedConfiguration);
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@
</template>

<script setup lang="ts">
import { Model, ModelConfiguration } from '@/types/Types';
import { getParameterSource, getParameterDistribution } from '@/services/model-configurations';
import { ModelConfigurationLegacy, Model } from '@/types/Types';
import {
getParameterSource,
getParameterDistribution
} from '@/services/model-configurations-legacy';
import TeraInput from '@/components/widgets/tera-input.vue';
import { ref } from 'vue';
import Button from 'primevue/button';
Expand All @@ -101,7 +104,7 @@ import { getParameter } from '@/model-representation/service';

const props = defineProps<{
model: Model;
modelConfiguration: ModelConfiguration;
modelConfiguration: ModelConfigurationLegacy;
parameterId: string;
}>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
</template>

<script setup lang="ts">
import { Model, ModelConfiguration, ModelDistribution } from '@/types/Types';
import { getParameterDistribution, getParameters } from '@/services/model-configurations';
import { Model, ModelConfigurationLegacy, ModelDistribution } from '@/types/Types';
import { getParameterDistribution, getParameters } from '@/services/model-configurations-legacy';
import { StratifiedMatrix } from '@/types/Model';
import { computed, ref } from 'vue';
import { collapseParameters, isStratifiedModel } from '@/model-representation/mira/mira';
Expand All @@ -159,7 +159,7 @@ import TeraStratifiedMatrixModal from './model-configurations/tera-stratified-ma

const props = defineProps<{
model: Model;
modelConfiguration: ModelConfiguration;
modelConfiguration: ModelConfigurationLegacy;
mmt: MiraModel;
mmtParams: MiraTemplateParams;
}>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
import { computed, ref, watch } from 'vue';
import { cloneDeep, isEmpty } from 'lodash';
import Button from 'primevue/button';
import type { Model, ModelConfiguration, ModelParameter } from '@/types/Types';
import type { Model, ModelConfigurationLegacy, ModelParameter } from '@/types/Types';
import InputText from 'primevue/inputtext';
import Datatable from 'primevue/datatable';
import Column from 'primevue/column';
Expand All @@ -257,7 +257,7 @@ import TeraInputNumber from '@/components/widgets/tera-input-number.vue';

const props = defineProps<{
model: Model;
modelConfigurations?: ModelConfiguration[];
modelConfigurations?: ModelConfigurationLegacy[];
mmt: MiraModel;
mmtParams: MiraTemplateParams;
data?: ModelConfigTableData[]; // we can use our own passed in data or the computed one. this is for the embedded matrix table
Expand All @@ -272,7 +272,7 @@ const isStratified = computed(() => isStratifiedModel(props.mmt));

interface SuggestedValue {
parameter: ModelParameter;
configuration: ModelConfiguration;
configuration: ModelConfigurationLegacy;
index: number;
}
const selectedValue = ref<SuggestedValue | null>(null);
Expand Down
11 changes: 7 additions & 4 deletions packages/client/hmi-client/src/components/model/tera-model.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ import TeraModelDescription from '@/components/model/petrinet/tera-model-descrip
import Button from 'primevue/button';
import InputText from 'primevue/inputtext';
import ContextMenu from 'primevue/contextmenu';
import { addDefaultConfiguration, updateModelConfiguration } from '@/services/model-configurations';
import {
addDefaultConfiguration,
updateModelConfiguration
} from '@/services/model-configurations-legacy';
import { getModel, getModelConfigurations, isModelEmpty, updateModel } from '@/services/model';
import { FeatureConfig } from '@/types/common';
import { AssetType, type Model, type ModelConfiguration } from '@/types/Types';
import { AssetType, type Model, type ModelConfigurationLegacy } from '@/types/Types';
import { useProjects } from '@/composables/project';
import { logger } from '@/utils/logger';

Expand All @@ -84,7 +87,7 @@ const emit = defineEmits([
]);

const model = ref<Model | null>(null);
const modelConfigurations = ref<ModelConfiguration[]>([]);
const modelConfigurations = ref<ModelConfigurationLegacy[]>([]);
const newName = ref('New Model');
const isRenaming = ref(false);
const isModelLoading = ref(false);
Expand Down Expand Up @@ -166,7 +169,7 @@ async function updateModelName() {
isRenaming.value = false;
}

async function updateConfiguration(updatedConfiguration: ModelConfiguration) {
async function updateConfiguration(updatedConfiguration: ModelConfigurationLegacy) {
await updateModelConfiguration(updatedConfiguration);
setTimeout(async () => {
emit('update-model-configuration');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ import {
ClientEventType,
CsvAsset,
DatasetColumn,
ModelConfiguration,
ModelConfigurationLegacy,
State
} from '@/types/Types';
import { getTimespan, chartActionsProxy, drilldownChartSize } from '@/components/workflow/util';
Expand Down Expand Up @@ -228,7 +228,7 @@ const modelStateOptions = ref<State[] | undefined>();
const datasetColumns = ref<DatasetColumn[]>();
const csvAsset = shallowRef<CsvAsset | undefined>(undefined);

const modelConfig = ref<ModelConfiguration>();
const modelConfig = ref<ModelConfigurationLegacy>();

const modelConfigId = computed<string | undefined>(() => props.node.inputs[0]?.value?.[0]);
const datasetId = computed<string | undefined>(() => props.node.inputs[1]?.value?.[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ import TeraPyciemssCancelButton from '@/components/pyciemss/tera-pyciemss-cancel
import { chartActionsProxy, drilldownChartSize, getTimespan } from '@/components/workflow/util';
import type {
CsvAsset,
ModelConfiguration,
ModelConfigurationLegacy,
EnsembleModelConfigs,
EnsembleCalibrationCiemssRequest,
State
Expand Down Expand Up @@ -287,7 +287,7 @@ const currentDatasetFileName = ref<string>();
const datasetColumnNames = ref<string[]>();

const listModelLabels = ref<string[]>([]);
const allModelConfigurations = ref<ModelConfiguration[]>([]);
const allModelConfigurations = ref<ModelConfigurationLegacy[]>([]);
// List of each observible + state for each model.
const allModelOptions = ref<State[][]>([]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ import {
ClientEventType,
CsvAsset,
DatasetColumn,
ModelConfiguration,
ModelConfigurationLegacy,
ScimlStatusUpdate,
State
} from '@/types/Types';
Expand Down Expand Up @@ -256,7 +256,7 @@ const inProgressSimulationId = ref<string>(props.node.state.inProgressSimulation

const csvAsset = shallowRef<CsvAsset | undefined>(undefined);

const modelConfig = ref<ModelConfiguration>();
const modelConfig = ref<ModelConfigurationLegacy>();
const modelConfigId = computed<string | undefined>(() => props.node.inputs[0]?.value?.[0]);
const datasetId = computed<string | undefined>(() => props.node.inputs[1]?.value?.[0]);
const currentDatasetFileName = ref<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ import TeraProgressSpinner from '@/components/widgets/tera-progress-spinner.vue'
import type {
FunmanPostQueriesRequest,
Model,
ModelConfiguration,
ModelConfigurationLegacy,
ModelParameter
} from '@/types/Types';
import { makeQueries } from '@/services/models/funman-service';
import { WorkflowNode, WorkflowOutput } from '@/types/workflow';
import { getModelConfigurationById } from '@/services/model-configurations';
import { getModelConfigurationById } from '@/services/model-configurations-legacy';
import { useToastService } from '@/services/toast';
import { pythonInstance } from '@/python/PyodideController';
import TeraFunmanOutput from '@/components/workflow/ops/funman/tera-funman-output.vue';
Expand Down Expand Up @@ -294,7 +294,7 @@ const requestConstraints = computed(() =>

const requestParameters = ref<any[]>([]);
const model = ref<Model | null>();
const modelConfiguration = ref<ModelConfiguration>();
const modelConfiguration = ref<ModelConfigurationLegacy>();

const modelStates = ref<string[]>([]); // Used for form's multiselect.
const modelParameters = ref<string[]>([]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Operation, WorkflowOperationTypes, BaseState } from '@/types/workflow';
import type { Model, ModelConfiguration } from '@/types/Types';
import type { Model, ModelConfigurationLegacy } from '@/types/Types';

export const name = 'ModelConfigOperation';

Expand All @@ -9,7 +9,7 @@ export interface ModelEditCode {
}

export interface ModelConfigOperationState extends BaseState {
transientModelConfig: ModelConfiguration;
transientModelConfig: ModelConfigurationLegacy;
modelEditCodeHistory: ModelEditCode[];
hasCodeBeenRun: boolean;
tempConfigId: string; // This is used for beaker context when there is no output selected. It is a config id that is in TDS and marked as temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ import {
setInitialExpression,
setParameterSource,
setParameterDistributions
} from '@/services/model-configurations';
} from '@/services/model-configurations-legacy';
import { useToastService } from '@/services/toast';
import type { Intervention, Model, ModelConfiguration } from '@/types/Types';
import type { Intervention, Model, ModelConfigurationLegacy } from '@/types/Types';
import { TaskStatus } from '@/types/Types';
import type { WorkflowNode } from '@/types/workflow';
import { OperatorStatus } from '@/types/workflow';
Expand Down Expand Up @@ -347,7 +347,7 @@ const emit = defineEmits(['append-output', 'update-state', 'select-output', 'clo

interface BasicKnobs {
tempConfigId: string;
transientModelConfig: ModelConfiguration;
transientModelConfig: ModelConfigurationLegacy;
}

const knobs = ref<BasicKnobs>({
Expand Down Expand Up @@ -564,8 +564,8 @@ const datasetIds = computed(() => props.node.inputs?.[2]?.value);

const suggestedConfigurationContext = ref<{
isOpen: boolean;
tableData: ModelConfiguration[];
modelConfiguration: ModelConfiguration | null;
tableData: ModelConfigurationLegacy[];
modelConfiguration: ModelConfigurationLegacy | null;
}>({
isOpen: false,
tableData: [],
Expand Down Expand Up @@ -730,7 +730,7 @@ const initialize = async () => {
}
};

const applyConfigValues = (config: ModelConfiguration) => {
const applyConfigValues = (config: ModelConfigurationLegacy) => {
const state = cloneDeep(props.node.state);
knobs.value.transientModelConfig = cloneDeep(config);

Expand Down Expand Up @@ -762,7 +762,7 @@ const applyConfigValues = (config: ModelConfiguration) => {
logger.success(`Configuration applied ${config.name}`);
};

const onOpenSuggestedConfiguration = (config: ModelConfiguration) => {
const onOpenSuggestedConfiguration = (config: ModelConfigurationLegacy) => {
suggestedConfigurationContext.value.modelConfiguration = config;
suggestedConfigurationContext.value.isOpen = true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ import TeraNotebookJupyterInput from '@/components/llm/tera-notebook-jupyter-inp
import teraNotebookJupyterThoughtOutput from '@/components/llm/tera-notebook-jupyter-thought-output.vue';

import { KernelSessionManager } from '@/services/jupyter';
import { getModelIdFromModelConfigurationId } from '@/services/model-configurations';
import { getModelIdFromModelConfigurationId } from '@/services/model-configurations-legacy';
import TeraSaveAssetModal from '@/page/project/components/tera-save-asset-modal.vue';
import { saveCodeToState } from '@/services/notebook';
import { ModelEditOperationState } from './model-edit-operation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { v4 as uuidv4 } from 'uuid';
import type { NotebookSession } from '@/types/Types';
import { cloneDeep } from 'lodash';
import { getModel } from '@/services/model';
import { addDefaultConfiguration } from '@/services/model-configurations';
import { addDefaultConfiguration } from '@/services/model-configurations-legacy';
import TeraDrilldown from '@/components/drilldown/tera-drilldown.vue';

import { ModelTransformerState } from './model-transformer-operation';
Expand Down
Loading
Loading