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

Fix part of #122: Add a proto for explorations #128

Merged
merged 10 commits into from
Sep 21, 2019
157 changes: 157 additions & 0 deletions model/src/main/proto/exploration.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
syntax = "proto3";

import "subtitled_html.proto";
import "interaction_object.proto";

package model;

option java_package = "org.oppia.app.model";
option java_multiple_files = true;

// Structure for a single exploration.
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeExploration.kt
message Exploration {
// Mapping from a state name to a state object
map<string, State> states = 1;
repeated ParamChange param_changes = 2;
repeated ParamSpec param_specs = 3;
string init_state_name = 4;
string objective = 5;
bool correctness_feedback_enabled = 6;
string title = 7;
string language_code = 8;
}

// Structure for a param change.
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeParamChange.kt
message ParamChange {
string generator_id = 1;
string name = 2;
ParamChangeCustomizationArgs customization_args = 3;
}

// Structure for a param spec.
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeParamSpec.kt
message ParamSpec {
ObjectType obj_type = 1;
}

// Supported object types for parameters.
enum ObjectType {
UNICODE_STRING = 0;
}

// Structure for a single state
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeState.kt
message State {
// Mapping from content_id to a VoiceoverMapping
map<string, VoiceoverMapping> recorded_voiceovers = 1;
SubtitledHtml content = 2;
// Mapping from content_id to a TranslationMapping
map<string, TranslationMapping> written_translations = 3;
repeated ParamChange param_changes = 4;
string classifier_model_id = 5;
Interaction interaction = 6;
// Boolean indicating whether the creator wants to ask for answer details
// from the learner about why they picked a particular answer while
// playing the exploration.
bool solicit_answer_details = 7;
vinitamurthi marked this conversation as resolved.
Show resolved Hide resolved
}

// Structure for customization args for ParamChange objects.
message ParamChangeCustomizationArgs {
bool parse_with_jinja = 1;
// If the param change has only a single value, we will populate just
// one element in this list
repeated string list_of_values = 3;
}

message VoiceoverMapping {
// Mapping from language_code to a VoiceOver
map<string, Voiceover> voiceover_mapping = 1;
}

// Structure for a single voiceover
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeVoiceover.kt
message Voiceover {
int64 file_size_bytes = 1;
bool needs_update = 2;
string file_name = 3;
}

// Structure for a single interaction
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeInteractionInstance.kt
message Interaction {
string id = 1;
repeated AnswerGroup answer_groups = 2;
Solution solution = 3;
repeated AnswerGroup confirmed_unclassified_answers = 4;
Hint hint = 5;
Outcome default_outcome = 6;
// Mapping from the name of a customization arg to the default interaction
// object of the customization arg
map<string, InteractionObject> customization_args = 7;
}

message TranslationMapping {
// Mapping from language_code to Translation
map<string, Translation> translation_mapping = 1;
}

// Structure for a single translation
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeWrittenTranslation.kt
message Translation {
string html = 1;
bool needs_update = 2;
}

// Structure for a single answer group
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeAnswerGroup.kt
message AnswerGroup {
string tagged_skill_misconception_id = 1;
Outcome outcome = 2;
repeated RuleSpec rule_specs = 3;
repeated TrainingData training_data = 4;
}

// Structure for a single training data instance
message TrainingData {
int32 answer_group_index = 1;
repeated string answers = 2;
}

// Structure for a single solution
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeSolution.kt
message Solution {
string interaction_id = 1;
// Flag that is true if correct_answer is the only correct answer of the question.
bool answer_is_exclusive = 2;
vinitamurthi marked this conversation as resolved.
Show resolved Hide resolved
string correct_answer = 3;
SubtitledHtml explanation = 4;
}

// Structure for a single hint
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeHint.kt
message Hint {
SubtitledHtml hint_content = 1;
}

// Structure for a single outcome
// Maps from: data/src/main/java/org/oppia/data/backends/gae/model/GaeOutcome.kt
message Outcome {
string dest_state_name = 1;
string refresher_exploration_id = 2;
SubtitledHtml feedback = 3;
repeated ParamChange param_changes = 4;
string missing_prerequisite_skill_id = 5;
bool labelled_as_correct = 6;
}

// Structure for a single rule spec
message RuleSpec {
// Mapping from the name of the rule template to the value of the rule template.
// The keys and values for this map can be deduced from
// https://github.com/oppia/oppia/blob/develop/extensions/interactions/rule_templates.json
map<string, InteractionObject> inputs = 1;
string rule_type = 2;
}
50 changes: 50 additions & 0 deletions model/src/main/proto/interaction_object.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
syntax = "proto3";

package model;

option java_package = "org.oppia.app.model";
option java_multiple_files = true;

// Structure for any interaction object
message InteractionObject {
oneof object_type {
string normalized_string = 1;
int32 signed_int = 2;
uint32 non_negative_int = 3;
float real = 4;
bool bool_value = 5;
NumberWithUnits number_with_units = 6;
// repeated fields cannot be within a oneof so lists are
// wrapped into a new message.
StringList set_of_html_string = 7;
}
}

// Structure containing a string list.
message StringList {
repeated string string_list = 1;
}

// Structure for a number with units object.
message NumberWithUnits {
oneof number_type {
float real = 1;
Fraction fraction = 2;
}
repeated Unit units = 3;
}

// Structure for a unit
message Unit {
string unit = 1;
int32 exponent = 2;
}

// Structure for a fraction object.
message Fraction {
bool is_negative = 1;
bool whole_number = 2;
int32 numerator = 3;
int32 denominator = 4;
}

11 changes: 11 additions & 0 deletions model/src/main/proto/subtitled_html.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package model;

option java_package = "org.oppia.app.model";
option java_multiple_files = true;

message SubtitledHtml {
string html = 1;
string content_id = 2;
}