Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into workflow-targeted-syn…
Browse files Browse the repository at this point in the history
…c-by-user
  • Loading branch information
mwdchang committed Nov 12, 2024
2 parents e38f566 + 0272da6 commit d452653
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 50 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"husky": "8.0.3",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"prettier-plugin-java": "2.6.4"
"prettier-plugin-java": "2.6.5"
}
}
2 changes: 1 addition & 1 deletion packages/client/hmi-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
"vite": "5.4.10",
"vite-svg-loader": "4.0.0",
"vitest": "0.24.5",
"vue-tsc": "2.1.6"
"vue-tsc": "2.1.10"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<tera-model-configuration-item
:configuration="configuration"
:selected="selectedConfigId === configuration.id"
:empty-input-count="missingInputCount(configuration)"
@click="onSelectConfiguration(configuration)"
@delete="fetchConfigurations(model.id)"
@download="downloadModelArchive(configuration)"
Expand Down Expand Up @@ -255,6 +256,7 @@ import { getMMT, getModel, getModelConfigurationsForModel, getCalendarSettingsFr
import {
createModelConfiguration,
getArchive,
getMissingInputAmount,
getModelConfigurationById,
setInitialExpression,
setInitialSource,
Expand Down Expand Up @@ -299,6 +301,7 @@ const emit = defineEmits(['append-output', 'update-state', 'select-output', 'clo
const isFetchingPDF = ref(false);
const isDocViewerOpen = ref(true);
const selectedConfigMissingInputCount = ref('');
const currentActiveIndexes = ref([0, 1, 2]);
const pdfData = ref<{ document: any; data: string; isPdf: boolean; name: string }[]>([]);
Expand Down Expand Up @@ -329,6 +332,23 @@ const calibratedConfigObservables = computed<Observable[]>(() =>
}))
);
const getTotalInput = (modelConfiguration: ModelConfiguration) =>
modelConfiguration.initialSemanticList.length + modelConfiguration.parameterSemanticList.length;
const getMissingInputCountMessage = (modelConfiguration: ModelConfiguration) => {
const amount = getMissingInputAmount(modelConfiguration);
const total = getTotalInput(modelConfiguration);
const precent = (amount / total) * 100;
return amount ? `Missing values: ${amount}/${total} (${precent.toFixed(0)}%)` : '';
};
const missingInputCount = (modelConfiguration: ModelConfiguration) => {
if (selectedConfigId.value === modelConfiguration.id) {
return selectedConfigMissingInputCount.value;
}
return getMissingInputCountMessage(modelConfiguration);
};
// Check if the model configuration is the same as the original
const isModelConfigChanged = computed(() => !isModelConfigsEqual(originalConfig, knobs.value.transientModelConfig));
Expand Down Expand Up @@ -740,6 +760,7 @@ const debounceUpdateState = debounce(() => {
configuredMmt.value = makeConfiguredMMT(mmt.value, knobs.value.transientModelConfig);
emit('update-state', state);
selectedConfigMissingInputCount.value = getMissingInputCountMessage(state.transientModelConfig);
}, 100);
watch(
() => knobs.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ContextMenu ref="contextMenu" :model="contextMenuItems" />
<p>{{ configuration.description }}</p>
<p>{{ formatTimestamp(configuration.createdOn) }}</p>
<span v-if="emptyInputCount" :class="{ 'input-count': emptyInputCount }">{{ emptyInputCount }}</span>
</div>
</template>

Expand All @@ -23,6 +24,7 @@ const emit = defineEmits(['delete', 'use', 'download']);
const props = defineProps<{
configuration: ModelConfiguration;
selected?: boolean;
emptyInputCount?: string;
}>();
const confirm = useConfirm();
Expand Down Expand Up @@ -102,10 +104,18 @@ header {
}
}
p {
p,
span {
color: var(--text-color-subdued);
font-size: var(--font-caption);
padding-right: var(--gap-6);
&.input-count {
background-color: var(--error-background);
}
}
span {
padding-right: unset;
}
p + p {
Expand Down
4 changes: 1 addition & 3 deletions packages/client/hmi-client/src/services/concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@ const autoCalibrationMapping = async (modelOptions: State[], datasetOptions: Dat

// Fill targetEntities with datasetOptions
datasetOptions.forEach((col) => {
const groundings = col.metadata?.groundings?.identifiers
? Object.entries(col.metadata.groundings.identifiers).map((ele) => ele.join(':'))
: undefined;
const groundings = col.grounding?.identifiers?.map((id) => id.curie);
targetEntities.push({ id: col.name, groundings });
});

Expand Down
30 changes: 29 additions & 1 deletion packages/client/hmi-client/src/services/model-configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
ObservableSemantic,
ParameterSemantic
} from '@/types/Types';
import { isEmpty } from 'lodash';
import { isEmpty, isNaN, isNumber } from 'lodash';
import { pythonInstance } from '@/python/PyodideController';
import { DistributionType } from './distribution';

Expand Down Expand Up @@ -207,3 +207,31 @@ export function getOtherValues(configs: ModelConfiguration[], id: string, key: s
});
return otherValues;
}

export function isNumberInputEmpty(value: string) {
const number = parseFloat(value);
return isNaN(number) || !isNumber(number);
}

export function getMissingInputAmount(modelConfiguration: ModelConfiguration) {
let missingInputs = 0;
modelConfiguration.initialSemanticList.forEach((initial) => {
if (isNumberInputEmpty(initial.expression)) {
missingInputs++;
}
});

modelConfiguration.parameterSemanticList.forEach((parameter) => {
if (parameter.distribution.type === DistributionType.Constant) {
if (isNumberInputEmpty(parameter.distribution.parameters.value)) {
missingInputs++;
}
} else if (
isNumberInputEmpty(parameter.distribution.parameters.minimum) ||
isNumberInputEmpty(parameter.distribution.parameters.maximum)
) {
missingInputs++;
}
});
return missingInputs;
}
86 changes: 43 additions & 43 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3610,30 +3610,30 @@ __metadata:
languageName: node
linkType: hard

"@volar/language-core@npm:2.4.9, @volar/language-core@npm:~2.4.1":
version: 2.4.9
resolution: "@volar/language-core@npm:2.4.9"
"@volar/language-core@npm:2.4.10, @volar/language-core@npm:~2.4.8":
version: 2.4.10
resolution: "@volar/language-core@npm:2.4.10"
dependencies:
"@volar/source-map": "npm:2.4.9"
checksum: 10/5c70f0e2c169d69fe01a2a217ce67882ea67987208210825602c677c85bc13a43ef1c4cc74d241082b61483f359794d5652a3c20840b7e4106693d08e3bdb1c1
"@volar/source-map": "npm:2.4.10"
checksum: 10/2bfc33a5cf215810ff9f9e058e2cb3d1148e21ff69164fa854b6933673db0521cfac8313f7ad3fba8f314d22945fbe2a8ae572888bdf816a820cfa17d4c75ee3
languageName: node
linkType: hard

"@volar/source-map@npm:2.4.9":
version: 2.4.9
resolution: "@volar/source-map@npm:2.4.9"
checksum: 10/4df7739ce4e8c92aa2ef10787b9c7fc06e31ba05d3f82a310ff65af9a1364bbbf968073620554bd107b1ba689daf6911d0ec9d7bd7e4bc8c348142fcf2ddbfdc
"@volar/source-map@npm:2.4.10":
version: 2.4.10
resolution: "@volar/source-map@npm:2.4.10"
checksum: 10/8067c4a52bb54709bb74639419242ada294348f05cd5e22bc4a3cdfe4f7b18b9292c8b231805a56bda306890b97a3969e57d4da49d294e2b6122ec1e74f707e2
languageName: node
linkType: hard

"@volar/typescript@npm:~2.4.1":
version: 2.4.9
resolution: "@volar/typescript@npm:2.4.9"
"@volar/typescript@npm:~2.4.8":
version: 2.4.10
resolution: "@volar/typescript@npm:2.4.10"
dependencies:
"@volar/language-core": "npm:2.4.9"
"@volar/language-core": "npm:2.4.10"
path-browserify: "npm:^1.0.1"
vscode-uri: "npm:^3.0.8"
checksum: 10/a7a22635f913bcd3f003030bd7ea4de526679fe424480b7b438cc67188732093f36af9378b24e2210b788ada31e7dd8c7f78bda1edb2e24266e2cf9eeebac891
checksum: 10/dab415048adac8c260d824092ccac47023600cc580032c3f409d88953bacd3f2568ff666cfcf49d63ef2babec86325886d5dc32ed492335248bfd5580bbadc29
languageName: node
linkType: hard

Expand All @@ -3650,7 +3650,7 @@ __metadata:
languageName: node
linkType: hard

"@vue/compiler-dom@npm:3.5.12, @vue/compiler-dom@npm:^3.4.0":
"@vue/compiler-dom@npm:3.5.12, @vue/compiler-dom@npm:^3.5.0":
version: 3.5.12
resolution: "@vue/compiler-dom@npm:3.5.12"
dependencies:
Expand Down Expand Up @@ -3744,15 +3744,15 @@ __metadata:
languageName: node
linkType: hard

"@vue/language-core@npm:2.1.6":
version: 2.1.6
resolution: "@vue/language-core@npm:2.1.6"
"@vue/language-core@npm:2.1.10":
version: 2.1.10
resolution: "@vue/language-core@npm:2.1.10"
dependencies:
"@volar/language-core": "npm:~2.4.1"
"@vue/compiler-dom": "npm:^3.4.0"
"@volar/language-core": "npm:~2.4.8"
"@vue/compiler-dom": "npm:^3.5.0"
"@vue/compiler-vue2": "npm:^2.7.16"
"@vue/shared": "npm:^3.4.0"
computeds: "npm:^0.0.1"
"@vue/shared": "npm:^3.5.0"
alien-signals: "npm:^0.2.0"
minimatch: "npm:^9.0.3"
muggle-string: "npm:^0.4.1"
path-browserify: "npm:^1.0.1"
Expand All @@ -3761,7 +3761,7 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 10/640d4af0031975620cd3a8050bb4b0f4ed333f241ded195e3bf8c4e571c720b4e3bec3947caf2b10e4e2de19deb7621982d15439de3732d510cd43e325c74a50
checksum: 10/c3aadb89d0af26ffb7b290aa6a79e08dcbe681e5535aa575b4536ba14598e1f670ac6738c94ec73e2611c80489d8e279e7a9a26a4c832471bbfad55992758257
languageName: node
linkType: hard

Expand Down Expand Up @@ -3846,7 +3846,7 @@ __metadata:
languageName: node
linkType: hard

"@vue/shared@npm:3.5.12, @vue/shared@npm:^3.4.0":
"@vue/shared@npm:3.5.12, @vue/shared@npm:^3.5.0":
version: 3.5.12
resolution: "@vue/shared@npm:3.5.12"
checksum: 10/abe229a09a9513f484a03a8c0e63b90949d9fccf64203c1ad510628305e1fdc0e9d064174df88299409a9fbf0c142e4fbcc0a5449f10728fb12d7e10d825abc5
Expand Down Expand Up @@ -3973,6 +3973,13 @@ __metadata:
languageName: node
linkType: hard

"alien-signals@npm:^0.2.0":
version: 0.2.1
resolution: "alien-signals@npm:0.2.1"
checksum: 10/10cbed2693aa3502fd64dba5931a2b050e06c3d2bc9d35ecf3a57b685d3b7dcf3e7990c8d806995e0a56fae3c75e478bac3626697f881e723e7ddc62dd1b9d9b
languageName: node
linkType: hard

"ansi-escapes@npm:^4.2.1":
version: 4.3.2
resolution: "ansi-escapes@npm:4.3.2"
Expand Down Expand Up @@ -5229,13 +5236,6 @@ __metadata:
languageName: node
linkType: hard

"computeds@npm:^0.0.1":
version: 0.0.1
resolution: "computeds@npm:0.0.1"
checksum: 10/738625ccec6e483124d0ac79ec5474ab5c9df103ea05afc1fd840eed7d9004e3d6009b7bc806df564d66ad915c1ee1fb017bd91b2b32606a252ea9870b6a4026
languageName: node
linkType: hard

"concat-map@npm:0.0.1":
version: 0.0.1
resolution: "concat-map@npm:0.0.1"
Expand Down Expand Up @@ -8702,7 +8702,7 @@ __metadata:
vue-feather: "npm:2.0.0"
vue-gtag: "npm:2.0.1"
vue-router: "npm:4.4.5"
vue-tsc: "npm:2.1.6"
vue-tsc: "npm:2.1.10"
vue3-ace-editor: "npm:2.2.4"
vue3-draggable-resizable: "npm:1.6.5"
vue3-lottie: "npm:3.2.0"
Expand Down Expand Up @@ -12163,14 +12163,14 @@ __metadata:
languageName: node
linkType: hard

"prettier-plugin-java@npm:2.6.4":
version: 2.6.4
resolution: "prettier-plugin-java@npm:2.6.4"
"prettier-plugin-java@npm:2.6.5":
version: 2.6.5
resolution: "prettier-plugin-java@npm:2.6.5"
dependencies:
java-parser: "npm:2.3.2"
lodash: "npm:4.17.21"
prettier: "npm:3.2.5"
checksum: 10/fcac3c55893397c9496c4f13e2a47ff9f7ab16f024726ea4f622596734b8b32199184e406ddea4958b4f53cbf36f796b436d5cb81fc8422514e24fef40df9e67
checksum: 10/ce960aa9e968dcbbbf4ac03ba15cbd1ec2d932d96a9eb28e871b3662602db288ca3228240f70484714df7d03cf509f4c7bc4c221997eceb4c8694540167db382
languageName: node
linkType: hard

Expand Down Expand Up @@ -13935,7 +13935,7 @@ __metadata:
husky: "npm:8.0.3"
lint-staged: "npm:15.2.10"
prettier: "npm:3.3.3"
prettier-plugin-java: "npm:2.6.4"
prettier-plugin-java: "npm:2.6.5"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -15310,18 +15310,18 @@ __metadata:
languageName: node
linkType: hard

"vue-tsc@npm:2.1.6":
version: 2.1.6
resolution: "vue-tsc@npm:2.1.6"
"vue-tsc@npm:2.1.10":
version: 2.1.10
resolution: "vue-tsc@npm:2.1.10"
dependencies:
"@volar/typescript": "npm:~2.4.1"
"@vue/language-core": "npm:2.1.6"
"@volar/typescript": "npm:~2.4.8"
"@vue/language-core": "npm:2.1.10"
semver: "npm:^7.5.4"
peerDependencies:
typescript: ">=5.0.0"
bin:
vue-tsc: ./bin/vue-tsc.js
checksum: 10/35bbd95b1b0c3040f5944f90f9d269e2bf09a3a089a09e38d980cc104d2984829aef8febc55e78dd304ab83819129902bfca6f6fe4c522ab0d957ca297eed40b
checksum: 10/a64ad7b4388a1e2679cc0a53b6ecd7e26e5fda131ada06d7f02040c650616bdf93532482224f0e719a912b4d3222ec64997171f4721a29cf734b964141629691
languageName: node
linkType: hard

Expand Down

0 comments on commit d452653

Please sign in to comment.