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 #4879: Add NPS survey models #4914

Merged
merged 23 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f5432ef
Create survey related models
adhiamboperes Mar 13, 2023
5ceebe0
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
adhiamboperes Mar 13, 2023
749ca4e
Fix protobuf formatting errors
adhiamboperes Mar 13, 2023
896fe91
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Mar 22, 2023
8dd5828
Fix formating nits
adhiamboperes Mar 29, 2023
479b493
Refactor MarketFitAnswer field NA_DONT_USE_OPPIA_ANYMORE to NOT_APP…
adhiamboperes Mar 29, 2023
d0ab6d3
Refactor enum constants to not include the enum name.
adhiamboperes Mar 29, 2023
f62bb61
Refactor message ID documentation
adhiamboperes Mar 29, 2023
86cd883
Refactor SurveyQuestionAnswer to SurveyAnswerOption
adhiamboperes Mar 29, 2023
9384a47
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 3, 2023
384de4e
Refactor SurveyQuestion to use oneof instead of repeated answer list
adhiamboperes Apr 4, 2023
cd962ca
Refactor SurveyQuestion to have a language code
adhiamboperes Apr 4, 2023
db2afcf
Add BUILD definitions for survey.proto
adhiamboperes Apr 4, 2023
1a358c7
Refactor SurveyUserAnswer to contain a oneof of the answer enums
adhiamboperes Apr 4, 2023
f48e9f8
Refactored messages for readability and consistency.
adhiamboperes Apr 4, 2023
8887d9f
Remove unused import in oppia_logger.proto
adhiamboperes Apr 4, 2023
56b6ae1
Rename enum field causing conflicts
adhiamboperes Apr 4, 2023
f6d8ce1
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 11, 2023
9fe9264
Refactor field names
adhiamboperes Apr 12, 2023
34be078
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 18, 2023
c89e35e
Remove string fields in SurveyQuestion and SurveyQuestionOption
adhiamboperes Apr 18, 2023
3fa4ee8
Fix skipped field numbers
adhiamboperes Apr 18, 2023
f55f4cd
Merge branch 'develop' into nps-survey-models
adhiamboperes Apr 21, 2023
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
12 changes: 12 additions & 0 deletions model/src/main/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,18 @@ java_lite_proto_library(
deps = [":platform_parameter_proto"],
)

oppia_proto_library(
name = "survey_proto",
srcs = ["survey.proto"],
visibility = ["//:oppia_api_visibility"],
)

java_lite_proto_library(
name = "survey_java_proto_lite",
visibility = ["//:oppia_api_visibility"],
deps = [":survey_proto"],
)

android_library(
name = "test_models",
testonly = True,
Expand Down
1 change: 0 additions & 1 deletion model/src/main/proto/oppia_logger.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ syntax = "proto3";

package model;

import "exploration.proto";
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
import "languages.proto";
import "profile.proto";

Expand Down
206 changes: 206 additions & 0 deletions model/src/main/proto/survey.proto
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
syntax = "proto3";

package model;

import "languages.proto";

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

// Corresponds to a single survey.
message Survey {
// The ID of the survey. This is a string value that uniquely identifies the survey.
// The ID should ostensibly be unique across all surveys globally for the purpose of analysis.
// This field is used to retrieve information about a survey, and should be treated as read-only.
string survey_id = 1;

// A list of questions that make up the survey.
repeated SurveyQuestion questions = 2;
}

// Represents a question that is part of the Survey.
message SurveyQuestion {
// The ID of the survey question. This is a string value that uniquely identifies the question
// within the context of the survey, and is guaranteed to be unique within the survey scope only.
string question_id = 1;

// The semantic name of the question used to identify it in the analytics dashboard.
SurveyQuestionName question_name = 2;

// The actual text value of the question.
string question = 3;

// The type of question.
oneof question_type {
// Corresponds to a question with multiple choices.
SurveyQuestionOptionList multiple_choice = 4;

// Corresponds to a question with multiple choices and a free-text 'other' option.
SurveyQuestionOptionList multiple_choice_with_other = 5;

// Indicates whether this question takes a free-text response.
bool free_form_text = 6;
}

// The language to which this question is localized.
OppiaLanguage language = 7;
}

// Represents a list of answer options for a multiple choice question.
message SurveyQuestionOptionList {
repeated SurveyQuestionOption options = 1;
}

// Corresponds to the semantic name given to each question.
enum SurveyQuestionName {
// The question name is unknown.
QUESTION_NAME_UNSPECIFIED = 0;

// Corresponds to the name of the user type question.
USER_TYPE = 1;

// Corresponds to the market fit question.
MARKET_FIT = 2;

// Corresponds to the NPS question.
NPS = 3;

// Corresponds to the open-ended question for a NPS promoter.
PROMOTER_FEEDBACK = 4;

// Corresponds to the open-ended question for a NPS passive.
PASSIVE_FEEDBACK = 5;

// Corresponds to the open-ended question for a NPS detractor.
DETRACTOR_FEEDBACK = 6;
}

// Represents the multiple choice answer available for a question.
message SurveyQuestionOption {
// The ID of this question option. It is a string that uniquely identifies the question option
// within the context of a survey question. It is only unique within the scope of a survey.
string question_option_id = 1;

// The semantic name of the question this answer option is tied to.
SurveyQuestionName question_name = 2;

// The actual text value of the answer option.
string label = 3;
BenHenning marked this conversation as resolved.
Show resolved Hide resolved

// The type of answer this option represents.
oneof answer {
// The enum representation of the type of user answer option.
UserTypeAnswer user_type = 4;

// The enum representation of the market fit answer option.
MarketFitAnswer market_fit = 5;

// The integer value representing the nps score option.
int32 nps_score = 6;
}
}

// Represents an answer that was selected by a user for a survey question.
message SurveySelectedAnswer {
// The ID of the survey to which this answer is tied. This is a string value that uniquely
// identifies the survey globally.
string survey_id = 1;

// Semantic name of the question the response is tied to.
SurveyQuestionName question_name = 2;

// The value of the answer the user gave.
oneof answer {
// The enum representation of the type of user answer selected.
UserTypeAnswer user_type = 3;

// The enum representation of the market fit answer selected.
MarketFitAnswer market_fit = 4;

// The integer value representing the nps score selected by the user.
int32 nps_score = 5;
}
}

// Represents the different types of users who could be taking the survey.
// Consists of answer options for the user type question.
enum UserTypeAnswer {
// User type unknown.
USER_TYPE_UNSPECIFIED = 0;

// Corresponds to an unspecified or unknown type of user.
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
OTHER = 1;

// Corresponds to a user who is a teacher.
TEACHER = 2;

// Corresponds to a user who is a parent.
PARENT = 3;

// Corresponds to a user who is a learner.
LEARNER = 4;
}

// Represents general opinion of the user about the Oppia android app.
// Consists of answer options for the market fit question.
enum MarketFitAnswer {
// Answer unknown.
MARKET_FIT_ANSWER_UNSPECIFIED = 0;

// Corresponds to the answer for Very Disappointed.
VERY_DISAPPOINTED = 1;

// Corresponds to the answer for Disappointed.
DISAPPOINTED = 2;

// Corresponds to the answer for Not Disappointed.
NOT_DISAPPOINTED = 3;

// Corresponds to the answer for N/A - Don't use Oppia Anymore.
NOT_APPLICABLE_WONT_USE_OPPIA_ANYMORE = 4;
}

// Represents the status of the survey at the time it is exited.
enum SurveyCompletionStatus {
// The completion status is unknown.
SURVEY_COMPLETION_STATUS_UNSPECIFIED = 0;

// Corresponds to the survey being declined, not started.
DECLINED = 1;

// Corresponds to the survey being exited before the mandatory questions are completed.
EXITED_NOT_COMPLETED = 2;

// Corresponds to the mandatory part of the survey being completed.
MANDATORY_PART_COMPLETED = 3;

// Corresponds to the optional part of the survey being completed.
FULLY_COMPLETED = 4;
}

// Corresponds to a survey question that exists ephemerally in the UI and will disappear
// once the user finishes or exits the survey session.
message EphemeralSurveyQuestion {
// The actual question the user is currently viewing.
SurveyQuestion question = 1;

// Indicates whether this question has a previous question that has been answered,
// or if this is the initial question.
bool has_previous_question = 2;

// Indicates whether this question has an upcoming question that can be navigated to.
bool has_next_question = 3;

// Indicates possible states a question can take depending on whether a user needs to provide an
// answer or has navigated to a previous question, or has reached the last question.
oneof question_type {
// A pending question that requires an answer to continue.
bool pending_question = 4;

// The SurveySelectedAnswer given to complete the previous question.
SurveySelectedAnswer selected_answer = 5;

// Present if this is the last question in the survey.
bool terminal_question = 6;
}
}