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

mrc-4522 Allow user-specified parameter values in Sensitivity #176

Merged
merged 17 commits into from
Aug 30, 2023

Conversation

EmmaLRussell
Copy link
Contributor

@EmmaLRussell EmmaLRussell commented Aug 24, 2023

This branch adds a new sensitivity parameter settings variation type, "User", to the existing types ("Percentage" and "Range"). This allows the user to manually specify the parameter values to use in the sensitivity run.

On reflection, "User" maybe isn't a great term to surface to the, err, user. What would be better? "Values"? "Specific"?

This isn't doing any validation that the parameter's central value is between the lowest and highest values specified - should it?

Key changes:

  • userValues number array added to the settings type to hold these values
  • EditParamSettings dialog updated to support editing these values using the TagInput, plus read-only display in the options tab. The green alert showing generated values is not displayed for user values (as would be showing the same values twice) - I guess we could just show this in the read-only tab view but it feels better to have the user values displayed like the other user settings, and keep the green box for generated values.
  • We don't need to generate batchPars using odin's helper methods for this variation type as we already know the parameter values to use, so the validation and run sensitivity code has been modified to allow this.
  • To be consistent with the other variation types, a minimum of two user values are required.
  • Values are de-duped and sorted as they are entered.

@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (bb536f4) 99.97% compared to head (7d45e46) 99.97%.
Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #176   +/-   ##
=======================================
  Coverage   99.97%   99.97%           
=======================================
  Files         148      148           
  Lines        3412     3436   +24     
  Branches      482      491    +9     
=======================================
+ Hits         3411     3435   +24     
  Misses          1        1           
Files Changed Coverage Δ
.../src/app/components/options/SensitivityOptions.vue 100.00% <ø> (ø)
...pp/static/src/app/store/sensitivity/sensitivity.ts 100.00% <ø> (ø)
...c/src/app/components/options/EditParamSettings.vue 100.00% <100.00%> (ø)
app/static/src/app/components/options/TagInput.vue 100.00% <100.00%> (ø)
app/static/src/app/store/sensitivity/state.ts 100.00% <100.00%> (ø)
app/static/src/app/utils.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EmmaLRussell EmmaLRussell marked this pull request as ready for review August 25, 2023 09:06
@richfitz
Copy link
Member

On reflection, "User" maybe isn't a great term to surface to the, err, user. What would be better? "Values"? "Specific"?

"Custom" perhaps?

@EmmaLRussell
Copy link
Contributor Author

On reflection, "User" maybe isn't a great term to surface to the, err, user. What would be better? "Values"? "Specific"?

"Custom" perhaps?

Yeah, that's probably the word I was looking for! Will change to that!

@EmmaLRussell
Copy link
Contributor Author

OK, that should be working now, ready to review.

Copy link
Member

@richfitz richfitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works

tags: Array as PropType<Tag[] | null>
tags: Array as PropType<Tag[] | null>,
numericOnly: {
type: Boolean,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a difference between Boolean and bool? Or am I getting confused with different languages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's how Vue defines the types of its props, not quite the same as the Typescript types

@@ -5,18 +5,25 @@
<button class="btn btn-primary mb-4 float-end" @click="toggleEdit(true)">Edit</button>
<ul>
<li><strong>Parameter:</strong> {{settings.parameterToVary}}</li>
<li><strong>Scale Type:</strong> {{ settings.scaleType }}</li>
<li v-if="settings.variationType !== 'Custom'"><strong>Scale Type:</strong> {{ settings.scaleType }}</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this should now move below the variation type because then the dependency among the options is easier to work with

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so scale type below variation type, as it isn't relevant for custom variation type.

<li><strong>From:</strong> {{ settings.rangeFrom }}</li>
<li><strong>To:</strong> {{ settings.rangeTo }}</li>
</template>
<li><strong>Number of runs:</strong> {{ settings.numberOfRuns}}</li>
<li v-if="settings.variationType === 'Custom'">
<strong>Values:</strong>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for some hint as to what my central value was. Do we want to encourage the users to bracket it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wondered about that. Do we want to enforce or just encourage?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encourage seems enough - just knowing where it is would be nice

return batchParsResult.value?.error;
});
const updateUserValues = (newValues: number[]) => {
// sort and remove duplicates
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when I entered a duplciate it ended up with a red underline and was not included but no error displayed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder about deferring sort until save? it's a bit alarming atm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The red underline seems to be a bit of a feature of the third party tags input, I think it can happen in the advanced settings too, I'll see if I can get rid of it, and defer sorting

Copy link
Collaborator

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code looks good, youre in the middle of changes, should be good once all those are implemented, you can try handling duplicate values with the on-error event from the tags component, however the red underline will still show up, the class you probably want to modify is
v3ti-new-tag v3ti-new-tag--error, you can change behaviour with this!

You can also wipe their duplicate value and stuff using a v-model on the tags input and setting that to empty string on the on-error event, once the red underline styling is gone, we can control a tooltip!

@EmmaLRussell
Copy link
Contributor Author

  • scale type now displayed below variation type on editor and tab
  • central value displayed as it is for Range type
  • sort happens on OK, not while typing
  • as discussed with @M-Kusumgar the third party tags input isn't great at coping with duplicates at all, so if the user does enter a duplicate we now just remove it immediately (no underlined red text).

@EmmaLRussell EmmaLRussell merged commit fdd2ab9 into main Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants