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

additional heuristic for template parsing handling multiple outputs #5157

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
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 @@ -230,6 +230,12 @@ export const rawTemplatesSummary = (miraModel: MiraModel) => {
return allTemplates;
};

const generateKey = (t: TemplateSummary) => {
if (t.name.split('_').length > 1) {
return `${t.name.split('_')[0]}:${t.subject}:${t.outcome}:${t.controllers.join('-')}`;
}
return `${t.subject}:${t.outcome}:${t.controllers.join('-')}`;
};
export const collapseTemplates = (miraModel: MiraModel) => {
const allTemplates: TemplateSummary[] = [];
const uniqueTemplates: TemplateSummary[] = [];
Expand Down Expand Up @@ -279,7 +285,7 @@ export const collapseTemplates = (miraModel: MiraModel) => {
const matrixMap = new Map<string, MiraTemplate[]>();

allTemplates.forEach((t) => {
const key = `${t.subject}:${t.outcome}:${t.controllers.join('-')}`;
const key = generateKey(t);
if (!tempMatrixMap.has(key)) {
tempMatrixMap.set(key, []);
}
Expand All @@ -295,7 +301,7 @@ export const collapseTemplates = (miraModel: MiraModel) => {

// 3 Rename and sanitize everything
uniqueTemplates.forEach((t) => {
const key = `${t.subject}:${t.outcome}:${t.controllers.join('-')}`;
const key = generateKey(t);
t.name = `template-${check.get(key)}`;
});
tempMatrixMap.forEach((value, key) => {
Expand Down Expand Up @@ -425,7 +431,6 @@ export const createParameterMatrix = (miraModel: MiraModel, miraTemplateParams:
};
};

// const genKey = (t: TemplateSummary) => `${t.subject}:${t.outcome}:${t.controllers.join('-')}`;
export const convertToIGraph = (
miraModel: MiraModel,
initObservableSummary: ObservableSummary,
Expand Down