surveydefinition

package
v0.0.0-...-4780336 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SURVEY_ITEM_COMPONENT_ROLE_TITLE          = "title"
	SURVEY_ITEM_COMPONENT_ROLE_RESPONSE_GROUP = "responseGroup"
)
View Source
const (
	QUESTION_TYPE_CONSENT                         = "consent"
	QUESTION_TYPE_SINGLE_CHOICE                   = "single_choice"
	QUESTION_TYPE_MULTIPLE_CHOICE                 = "multiple_choice"
	QUESTION_TYPE_TEXT_INPUT                      = "text"
	QUESTION_TYPE_NUMBER_INPUT                    = "number"
	QUESTION_TYPE_DATE_INPUT                      = "date"
	QUESTION_TYPE_DROPDOWN                        = "dropdown"
	QUESTION_TYPE_LIKERT                          = "likert"
	QUESTION_TYPE_LIKERT_GROUP                    = "likert_group"
	QUESTION_TYPE_EQ5D_SLIDER                     = "eq5d_slider"
	QUESTION_TYPE_NUMERIC_SLIDER                  = "slider"
	QUESTION_TYPE_RESPONSIVE_TABLE                = "responsive_table"
	QUESTION_TYPE_MATRIX                          = "matrix"
	QUESTION_TYPE_MATRIX_RADIO_ROW                = "matrix_radio_row"
	QUESTION_TYPE_MATRIX_DROPDOWN                 = "matrix_dropdown"
	QUESTION_TYPE_MATRIX_INPUT                    = "matrix_input"
	QUESTION_TYPE_MATRIX_NUMBER_INPUT             = "matrix_number_input"
	QUESTION_TYPE_MATRIX_CHECKBOX                 = "matrix_checkbox"
	QUESTION_TYPE_RESPONSIVE_SINGLE_CHOICE_ARRAY  = "responsive_single_choice_array"
	QUESTION_TYPE_RESPONSIVE_BIPOLAR_LIKERT_ARRAY = "responsive_bipolar_likert_array"
	QUESTION_TYPE_CLOZE                           = "cloze"
	QUESTION_TYPE_UNKNOWN                         = "unknown"
	QUESTION_TYPE_EMPTY                           = "empty"
)
View Source
const (
	OPTION_TYPE_DROPDOWN_OPTION             = "option"
	OPTION_TYPE_RADIO                       = "radio"
	OPTION_TYPE_CHECKBOX                    = "checkbox"
	OPTION_TYPE_TEXT_INPUT                  = "text"
	OPTION_TYPE_DATE_INPUT                  = "date"
	OPTION_TYPE_NUMBER_INPUT                = "number"
	OPTION_TYPE_CLOZE                       = "cloze"
	OPTION_TYPE_DROPDOWN                    = "dropdown"
	OPTION_TYPE_EMBEDDED_CLOZE_TEXT_INPUT   = "embedded_cloze_text"
	OPTION_TYPE_EMBEDDED_CLOZE_DATE_INPUT   = "embedded_cloze_date"
	OPTION_TYPE_EMBEDDED_CLOZE_NUMBER_INPUT = "embedded_cloze_number"
	OPTION_TYPE_EMBEDDED_CLOZE_DROPDOWN     = "embedded_cloze_dropdown"
)
View Source
const (
	OPEN_FIELD_COL_SUFFIX = "open"
	TRUE_VALUE            = "TRUE"
	FALSE_VALUE           = "FALSE"
)
View Source
const (
	RESPONSE_ROOT_KEY = "rg"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtractOptions

type ExtractOptions struct {
	IncludeItems []string
	ExcludeItems []string
	UseLabelLang string
}

type ResponseDef

type ResponseDef struct {
	ID           string           `json:"id"`
	ResponseType string           `json:"responseType"`
	Label        string           `json:"label"`
	Options      []ResponseOption `json:"options"`
}

type ResponseOption

type ResponseOption struct {
	ID         string `json:"id"`
	OptionType string `json:"optionType"`
	Label      string `json:"label"`
}

type StudyDB

type StudyDB interface {
	GetSurveyVersions(instanceID string, studyKey string, surveyKey string) (surveys []*studyTypes.Survey, err error)
	GetSurveyVersion(instanceID string, studyKey string, surveyKey string, versionID string) (survey *studyTypes.Survey, err error)
}

type SurveyInfoExporter

type SurveyInfoExporter struct {
	// contains filtered or unexported fields
}

func NewSurveyInfoExporter

func NewSurveyInfoExporter(surveyInfos []SurveyVersionPreview, surveyKey string, shortKeys bool) SurveyInfoExporter

func (SurveyInfoExporter) GetSurveyInfoCSV

func (se SurveyInfoExporter) GetSurveyInfoCSV(writer io.Writer) error

func (SurveyInfoExporter) GetSurveyInfos

func (se SurveyInfoExporter) GetSurveyInfos() []SurveyVersionPreview

type SurveyQuestion

type SurveyQuestion struct {
	ID           string        `json:"id"`
	Title        string        `json:"title"`
	QuestionType string        `json:"questionType"`
	Responses    []ResponseDef `json:"responses"`
}

type SurveyVersionPreview

type SurveyVersionPreview struct {
	VersionID   string           `json:"versionId"`
	Published   int64            `json:"published"`
	Unpublished int64            `json:"unpublished"`
	Questions   []SurveyQuestion `json:"questions"`
}

func PrepareSurveyInfosFromDB

func PrepareSurveyInfosFromDB(
	db StudyDB,
	instanceID string,
	studyKey string,
	surveyKey string,
	parserOptions *ExtractOptions,
) (surveyInfos []SurveyVersionPreview, err error)

func SurveyDefToVersionPreview

func SurveyDefToVersionPreview(
	original *studyTypes.Survey,
	options *ExtractOptions,
) SurveyVersionPreview

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL