surveyresponses

package
v0.0.0-...-45ce995 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClozeHandler

type ClozeHandler struct{}

ClozeHandler implements the QuestionTypeHandler interface for cloze questions

func (*ClozeHandler) GetResponseColumnNames

func (h *ClozeHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*ClozeHandler) ParseResponse

func (h *ClozeHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type ColumnNames

type ColumnNames struct {
	FixedColumns    []string
	ContextColumns  []string
	ResponseColumns []string
	MetaColumns     []string
}

type ConsentHandler

type ConsentHandler struct{}

ConsentHandler implements the QuestionTypeHandler interface for consent questions

func (*ConsentHandler) GetResponseColumnNames

func (h *ConsentHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*ConsentHandler) ParseResponse

func (h *ConsentHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type IncludeMeta

type IncludeMeta struct {
	Postion        bool
	InitTimes      bool
	DisplayedTimes bool
	ResponsedTimes bool
}

type InputValueHandler

type InputValueHandler struct{}

InputValueHandler implements the QuestionTypeHandler interface for input value questions

func (*InputValueHandler) GetResponseColumnNames

func (h *InputValueHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*InputValueHandler) ParseResponse

func (h *InputValueHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type MatrixHandler

type MatrixHandler struct{}

MatrixHandler implements the QuestionTypeHandler interface for matrix questions

func (*MatrixHandler) GetResponseColumnNames

func (h *MatrixHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*MatrixHandler) ParseResponse

func (h *MatrixHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type MultipleChoiceHandler

type MultipleChoiceHandler struct{}

MultipleChoiceHandler implements the QuestionTypeHandler interface for multiple choice questions

func (*MultipleChoiceHandler) GetResponseColumnNames

func (h *MultipleChoiceHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*MultipleChoiceHandler) ParseResponse

func (h *MultipleChoiceHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type ParsedResponse

type ParsedResponse struct {
	ID            string
	ParticipantID string
	OpenedAt      int64
	SubmittedAt   int64
	Version       string
	Context       map[string]string // e.g. Language, or engine version
	Responses     map[string]interface{}
	Meta          ResponseMeta
}

type QuestionTypeHandler

type QuestionTypeHandler interface {
	GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string
	ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}
}

type ResponseExporter

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

func NewResponseExporter

func NewResponseExporter(
	parser *ResponseParser,
	writer io.Writer,
	format string,
) (*ResponseExporter, error)

func (*ResponseExporter) Finish

func (re *ResponseExporter) Finish() error

func (*ResponseExporter) WriteResponse

func (re *ResponseExporter) WriteResponse(
	rawResp *studytypes.SurveyResponse,
) error

type ResponseMeta

type ResponseMeta struct {
	Initialised map[string][]int64
	Displayed   map[string][]int64
	Responded   map[string][]int64
	Position    map[string]int32
}

type ResponseParser

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

func NewResponseParser

func NewResponseParser(
	surveyKey string,
	surveyVersions []studydefinition.SurveyVersionPreview,
	removeRootKey bool,
	includeMeta *IncludeMeta,
	questionOptionSep string,
) (*ResponseParser, error)

func (*ResponseParser) ParseResponse

func (rp *ResponseParser) ParseResponse(
	rawResp *studytypes.SurveyResponse,
) (ParsedResponse, error)

func (*ResponseParser) ResponseToFlatObj

func (rp *ResponseParser) ResponseToFlatObj(
	parsedResponse ParsedResponse,
) (map[string]interface{}, error)

func (*ResponseParser) ResponseToLongFormat

func (rp *ResponseParser) ResponseToLongFormat(
	parsedResponse ParsedResponse,
) ([][]string, error)

func (*ResponseParser) ResponseToStrList

func (rp *ResponseParser) ResponseToStrList(
	parsedResponse ParsedResponse,
) ([]string, error)

type ResponsiveTableHandler

type ResponsiveTableHandler struct{}

ResponsiveTableHandler implements the QuestionTypeHandler interface for responsive table questions

func (*ResponsiveTableHandler) GetResponseColumnNames

func (h *ResponsiveTableHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*ResponsiveTableHandler) ParseResponse

func (h *ResponsiveTableHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type SingleChoiceHandler

type SingleChoiceHandler struct{}

SingleChoiceHandler implements the QuestionTypeHandler interface for single choice questions

func (*SingleChoiceHandler) GetResponseColumnNames

func (h *SingleChoiceHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*SingleChoiceHandler) ParseResponse

func (h *SingleChoiceHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

type UnknownTypeHandler

type UnknownTypeHandler struct{}

UnknownTypeHandler implements the QuestionTypeHandler interface for unknown question types

func (*UnknownTypeHandler) GetResponseColumnNames

func (h *UnknownTypeHandler) GetResponseColumnNames(question sd.SurveyQuestion, questionOptionSep string) []string

func (*UnknownTypeHandler) ParseResponse

func (h *UnknownTypeHandler) ParseResponse(question sd.SurveyQuestion, response *studytypes.SurveyItemResponse, questionOptionSep string) map[string]interface{}

Jump to

Keyboard shortcuts

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