edulab

package module
v0.0.0-...-775080a Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 2 Imported by: 0

README

EduLab

Coverage

Running locally

By default, the project runs on port 8080: http://localhost:8080.

With Docker Compose
docker compose -f server-compose.yaml up -d --build server
With Go
go mod tidy
go run cmd/server/main.go

Two databases are supported SQLite (default) and PostgreSQL. For PostgreSQL, you have to set the following environmental variables:

POSTGRES_USER=%your db user%
POSTGRES_PASSWORD=%your db password%
POSTGRES_HOSTNAME=%your db hostname%
POSTGRES_DB=%your db name%

Adding a new language

Add the language go to translations.go

For Spanish, for example:

//go:generate gotext -srclang=en update -out=catalog.go -lang=en,pt-BR,es github.com/louisbranch/edulab/cmd/server

Then run:

go generate translations/translations.go

A new file for the language will be created at translations/locales.

Copy the source file for the one containing the translated messages:

cp translations/locales/es/out.gotext.json translations/locales/es/messages.gotext.json

After translating the messages in messages.gotext.json, run the generator again to update the language catalog:

go generate translations/translations.go

Finally, for the language to appear on the website, add the new language to the server.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assessment

type Assessment struct {
	ID             string
	ExperimentID   string
	PublicID       string
	Description    string
	Type           AssessmentType
	QuestionsCount int
}

type AssessmentType

type AssessmentType string
const (
	AssessmentTypePre  AssessmentType = "pre"
	AssessmentTypePost AssessmentType = "post"
)

type Cohort

type Cohort struct {
	ID           string
	ExperimentID string
	PublicID     string
	Name         string
	Description  string
}

type Database

type Database interface {
	CreateExperiment(*Experiment) error
	UpdateExperiment(Experiment) error
	FindExperiments() ([]Experiment, error)
	FindExperiment(publicID string) (Experiment, error)
	DeleteExperiment(publicID string) error

	CreateAssessment(*Assessment) error
	FindAssessment(experimentID string, publicID string) (Assessment, error)
	FindAssessments(experimentID string) ([]Assessment, error)

	CreateQuestion(*Question) error
	FindQuestion(assessmentID string, id string) (Question, error)
	FindQuestions(assessmentID string) ([]Question, error)

	CreateQuestionChoice(*QuestionChoice) error
	FindQuestionChoices(assessmentID string) ([]QuestionChoice, error)

	CreateCohort(*Cohort) error
	UpdateCohort(experimentID string, c Cohort) error
	FindCohort(experimentID string, publicID string) (Cohort, error)
	FindCohorts(experimentID string) ([]Cohort, error)

	CreateDemographic(*Demographic) error
	FindDemographics(experimentID string) ([]Demographic, error)

	CreateDemographicOption(*DemographicOption) error
	FindDemographicOptions(experimentID string) ([]DemographicOption, error)

	CreateParticipant(*Participant) error
	FindParticipant(experimentID string, accessToken string) (Participant, error)
	FindParticipants(experimentID string) ([]Participant, error)

	CreateParticipation(*Participation) error
	UpdateParticipation(Participation) error
	FindParticipation(experimentID string, assessmentID string, participantID string) (Participation, error)
	FindParticipations(experimentID string) ([]Participation, error)
	FindParticipationsByParticipant(experimentID string, participantID string) ([]Participation, error)
	FindParticipationsByAssessment(experimentID string, assessmentID string) ([]Participation, error)
}

type Demographic

type Demographic struct {
	ID           string
	ExperimentID string
	Text         string
	Type         InputType
}

type DemographicOption

type DemographicOption struct {
	ID            string
	DemographicID string
	Text          string
}

type Experiment

type Experiment struct {
	ID                string
	PublicID          string
	Name              string
	Description       string
	CreatedAt         time.Time
	ParticipantsCount int
}

type InputType

type InputType string
const (
	InputSingle   InputType = "single"
	InputMultiple InputType = "multiple"
	InputText     InputType = "text"
)

type Participant

type Participant struct {
	ID           string
	PublicID     string
	ExperimentID string
	CohortID     string
	AccessToken  string
}

type Participation

type Participation struct {
	ExperimentID  string
	CohortID      string
	AssessmentID  string
	ParticipantID string
	Answers       json.RawMessage `json:"answers"`
	Demographics  json.RawMessage `json:"demographics"`
}

type Question

type Question struct {
	ID           string
	AssessmentID string
	Text         string
	Type         InputType
}

type QuestionChoice

type QuestionChoice struct {
	ID         string `json:"id"`
	QuestionID string
	Text       string `json:"text"`
	IsCorrect  bool   `json:"is_correct"`
}

Directories

Path Synopsis
cmd
exporter command
server command
stats command
db
web

Jump to

Keyboard shortcuts

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