-
Notifications
You must be signed in to change notification settings - Fork 527
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
Fix part of #122: Add a proto for explorations #128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Overall LGTM, but I'd like to do one more pass after these comments are addressed.
|
||
// Data for a single rule spec | ||
message RuleSpec { | ||
map<string, HtmlStringList> inputs = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is HtmlStringList the only type for inputs, or can it be something else? It appears this was represented with 'Any' in the original structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the file the comment - https://github.com/oppia/oppia/blob/ec254cfcc87843c36e24d68d335cc811536fb2d4/core/domain/state_domain.py#L1146 points to, I believe they are a list of html strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per https://github.com/oppia/oppia/blob/develop/extensions/interactions/rule_templates.json I think the inputs are typed based on the rule spec. E.g. some can be CodeString, others Fraction, or list of HTML strings. I think for the interactions we're supporting (#28, #29, #30, #31, #32, #33, #34, #35) we should support the corresponding rulespecs for them. Should we be using 'anyof' here, instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeCustomizationArgs.kt | ||
message CustomizationArgs { | ||
bool parse_with_jinja = 1; | ||
string value = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is value always type string? This was 'Any' in the GAE model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on a search of the codebase - https://github.com/oppia/oppia/search?l=YAML&p=2&q=customization_args
I could see that each of the customization args have a value field that is a string. Not sure if we need anything else apart from the value field?
@seanlip is there a way to find out all the possible customization args we can get?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vinitamurthi -- "customization args" is an overloaded term. They exist for interactions, parameters, and a whole bunch of other things.
For interactions: see extensions/interaction/NameOfInteraction and look at the python file. There's a list of customization arg descriptions in there, with their possible schemas.
For parameters, it's defined here: https://github.com/oppia/oppia/blob/develop/core/domain/param_domain.py#L99
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated customization args for param changes and interactions.
For interactions I noticed this comment: https://github.com/oppia/oppia/blob/1b668fd3c74f9481232a3c1c73ecd632036a902e/core/domain/state_domain.py#L340 where its a map from name to a default value.
Default value can be different types so I looked at the different possible values in extensions/interaction/NameOfInteraction and added them to an InteractionObject message
Hi @vinitamurthi is this ready for another review? If so, please reassign to me so that I know. Thanks! |
This is now ready for a second pass..PTAL @BenHenning ! |
Hint hint = 5; | ||
Outcome default_outcome = 6; | ||
// Mapping from the name of a customization arg to the default interaction | ||
// object of the customization arg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove extra space between 'object' and 'of'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
// Data for a single rule spec | ||
message RuleSpec { | ||
map<string, HtmlStringList> inputs = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per https://github.com/oppia/oppia/blob/develop/extensions/interactions/rule_templates.json I think the inputs are typed based on the rule spec. E.g. some can be CodeString, others Fraction, or list of HTML strings. I think for the interactions we're supporting (#28, #29, #30, #31, #32, #33, #34, #35) we should support the corresponding rulespecs for them. Should we be using 'anyof' here, instead?
} | ||
|
||
// Structure representing a graph object. | ||
message Graph { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
option java_multiple_files = true; | ||
|
||
message InteractionObject { | ||
oneof object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe: oneof object_type
. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added an object type, so changed this field to value - what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't quite what I meant--followed up below. Let me know if you want to discuss further.
…lone + review fixes
@BenHenning made the changes you requested, PTAL! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vinitamurthi--after my last set of comments are addressed this looks good to me. You can re-assign to me if you want me to take one more pass, but otherwise if you address my comments feel free to submit this.
// Structure for any interaction object | ||
message InteractionObject { | ||
ObjectType object_type = 1; | ||
oneof value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I was wondering if we could call the oneof object_type. Do we need a separate enum? I thought oneof generated an enum for us to switch on & retrieve the value. If that's right, we don't need the extra enum and it's a bit redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah oops I misunderstood. Changed it
} | ||
} | ||
|
||
// Structure containing lists. Note we should fill only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead we can just make this a StringList. At that point, the extra caveat in the documentation doesn't seem necessary since it's probably sufficiently clear that the purpose of the proto is to be a StringList.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ObjectType number_type = 1; | ||
float real = 2; | ||
Fraction fraction = 3; | ||
// Controllers are expected to convert the unit into a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a domain object, not a view model object, so we could conceivably have different model objects that contain UI-specific data. We should model these protos based on what we need to store on-disk. If units are already stored as strings in Oppia, then let's keep this. Otherwise, let's use a type closer to what the backend uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good..based on the schema here - https://github.com/oppia/oppia/blob/ae11e9dbeac66b5faeb68b7a2b1f16ccfdbc5ba6/extensions/objects/models/objects.py#L937
I believe there is a string value and an int value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm there is indeed a string value and an int value, but note that a "Units" object is a list of (string, int) things.
For example, "kg m s^-2" is represented as [(kg, 1), (m, 1), (s, -2)] (but with dicts instead of tuples.
|
||
// Structure for a number with units object. | ||
message NumberWithUnits { | ||
ObjectType number_type = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this maybe instead be a oneof between the float & Fraction? I don't think we'd ever have a NumberWithUnits containing a list of strings, for instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@BenHenning I made the changes and I am merging this now |
Explanation
This PR creates a proto for handling an exploration instance. It will be used by the exploration controllers and views
Fixes part of #115
Checklist