study

package
v0.0.0-...-08cdbde Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const (
	COLLECTION_NAME_STUDY_INFOS                   = "study-infos"
	COLLECTION_NAME_CONFIDENTIAL_ID_MAP           = "confidential-id-map"
	COLLECTION_NAME_STUDY_RULES                   = "studyRules"
	COLLECTION_NAME_SUFFIX_SURVEYS                = "surveys"
	COLLECTION_NAME_SUFFIX_RESPONSES              = "surveyResponses"
	COLLECTION_NAME_SUFFIX_PARTICIPANTS           = "participants"
	COLLECTION_NAME_SUFFIX_CONFIDENTIAL_RESPONSES = "confidentialResponses"
	COLLECTION_NAME_SUFFIX_REPORTS                = "reports"
	COLLECTION_NAME_SUFFIX_FILES                  = "participantFiles"
	COLLECTION_NAME_SUFFIX_RESEARCHER_MESSAGES    = "researcherMessages"
	COLLECTION_NAME_TASK_QUEUE                    = "taskQueue"
	COLLECTION_NAME_STUDY_CODE_LISTS              = "studyCodeLists"
	COLLECTION_NAME_STUDY_COUNTERS                = "studyCounters"
	COLLECTION_NAME_STUDY_VARIABLES               = "studyVariables"
)

collection names

View Source
const (
	FALLBACK_PAGE_SIZE = 10
)
View Source
const (
	REMOVE_TASK_FROM_QUEUE_AFTER = 60 * 60 * 24 * 2 // 2 days
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PaginationInfos

type PaginationInfos struct {
	TotalCount  int64 `json:"totalCount"`
	CurrentPage int64 `json:"currentPage"`
	TotalPages  int64 `json:"totalPages"`
	PageSize    int64 `json:"pageSize"`
}

type ReportKeyFilters

type ReportKeyFilters struct {
	ParticipantID string
	FromTS        int64
	ToTS          int64
}

ReportKeyFilters allows optional filtering when listing unique report keys. Use 0 values to omit a filter.

type ResponseInfo

type ResponseInfo struct {
	ID            primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Key           string             `bson:"key" json:"key"`
	ParticipantID string             `bson:"participantID" json:"participantId"`
	VersionID     string             `bson:"versionID" json:"versionId"`
	ArrivedAt     int64              `bson:"arrivedAt" json:"arrivedAt"`
}

type StudyCounter

type StudyCounter struct {
	StudyKey string `json:"studyKey" bson:"studyKey"`
	Scope    string `json:"scope" bson:"scope"`
	Value    int64  `json:"value" bson:"value"`
}

type StudyDBService

type StudyDBService struct {
	DBClient *mongo.Client

	DBNamePrefix string
	InstanceIDs  []string
	// contains filtered or unexported fields
}

func NewStudyDBService

func NewStudyDBService(configs db.DBConfig) (*StudyDBService, error)

func (*StudyDBService) AddConfidentialIDMapEntry

func (dbService *StudyDBService) AddConfidentialIDMapEntry(instanceID, confidentialID, profileID, studyKey string) error

func (*StudyDBService) AddConfidentialResponse

func (dbService *StudyDBService) AddConfidentialResponse(instanceID string, studyKey string, response studyTypes.SurveyResponse) (string, error)

func (*StudyDBService) AddStudyCodeListEntry

func (dbService *StudyDBService) AddStudyCodeListEntry(instanceID string, studyKey string, listKey string, code string) error

func (*StudyDBService) AddSurveyResponse

func (dbService *StudyDBService) AddSurveyResponse(instanceID string, studyKey string, response studyTypes.SurveyResponse) (string, error)

func (*StudyDBService) CountParticipantFileInfos

func (dbService *StudyDBService) CountParticipantFileInfos(instanceID string, studyKey string, query bson.M) (int64, error)

count by query

func (*StudyDBService) CountStudyCodeListEntries

func (dbService *StudyDBService) CountStudyCodeListEntries(instanceID string, studyKey string, listKey string) (int64, error)

func (*StudyDBService) CreateDefaultIndexes

func (dbService *StudyDBService) CreateDefaultIndexes()

CreateDefaultIndexes creates all default indexes for all instanceIDs and all collections

func (*StudyDBService) CreateDefaultIndexesForConfidentialIDMapCollection

func (dbService *StudyDBService) CreateDefaultIndexesForConfidentialIDMapCollection(instanceID string)

func (*StudyDBService) CreateDefaultIndexesForConfidentialResponsesCollection

func (dbService *StudyDBService) CreateDefaultIndexesForConfidentialResponsesCollection(instanceID string, studyKey string)

func (*StudyDBService) CreateDefaultIndexesForParticipantFilesCollection

func (dbService *StudyDBService) CreateDefaultIndexesForParticipantFilesCollection(instanceID string, studyKey string)

func (*StudyDBService) CreateDefaultIndexesForParticipantsCollection

func (dbService *StudyDBService) CreateDefaultIndexesForParticipantsCollection(instanceID string, studyKey string)

func (*StudyDBService) CreateDefaultIndexesForReportsCollection

func (dbService *StudyDBService) CreateDefaultIndexesForReportsCollection(instanceID string, studyKey string)

func (*StudyDBService) CreateDefaultIndexesForResponsesCollection

func (dbService *StudyDBService) CreateDefaultIndexesForResponsesCollection(instanceID string, studyKey string)

func (*StudyDBService) CreateDefaultIndexesForStudyCodeListsCollection

func (dbService *StudyDBService) CreateDefaultIndexesForStudyCodeListsCollection(instanceID string)

func (*StudyDBService) CreateDefaultIndexesForStudyCountersCollection

func (dbService *StudyDBService) CreateDefaultIndexesForStudyCountersCollection(instanceID string)

func (*StudyDBService) CreateDefaultIndexesForStudyInfosCollection

func (dbService *StudyDBService) CreateDefaultIndexesForStudyInfosCollection(instanceID string)

func (*StudyDBService) CreateDefaultIndexesForStudyRulesCollection

func (dbService *StudyDBService) CreateDefaultIndexesForStudyRulesCollection(instanceID string)

func (*StudyDBService) CreateDefaultIndexesForStudyVariablesCollection

func (dbService *StudyDBService) CreateDefaultIndexesForStudyVariablesCollection(instanceID string)

func (*StudyDBService) CreateDefaultIndexesForSurveysCollection

func (dbService *StudyDBService) CreateDefaultIndexesForSurveysCollection(instanceID string, studyKey string)

func (*StudyDBService) CreateDefaultIndexesForTaskQueueCollection

func (dbService *StudyDBService) CreateDefaultIndexesForTaskQueueCollection(instanceID string)

func (*StudyDBService) CreateParticipantFileInfo

func (dbService *StudyDBService) CreateParticipantFileInfo(instanceID string, studyKey string, fileInfo studytypes.FileInfo) (studytypes.FileInfo, error)

save file info

func (*StudyDBService) CreateStudy

func (dbService *StudyDBService) CreateStudy(instanceID string, study studyTypes.Study) error

func (*StudyDBService) CreateStudyVariable

func (dbService *StudyDBService) CreateStudyVariable(instanceID string, variable studytypes.StudyVariables) (string, error)

create a study variable

func (*StudyDBService) CreateTask

func (dbService *StudyDBService) CreateTask(
	instanceID string,
	createdBy string,
	targetCount int,
	fileType string,
) (task studyTypes.Task, err error)

create task

func (*StudyDBService) DeleteConfidentialResponses

func (dbService *StudyDBService) DeleteConfidentialResponses(instanceID string, studyKey string, participantID string, key string) (count int64, err error)

func (*StudyDBService) DeleteMessagesFromParticipant

func (dbService *StudyDBService) DeleteMessagesFromParticipant(instanceID string, studyKey string, participantID string, messageIDs []string) error

func (*StudyDBService) DeleteParticipantByID

func (dbService *StudyDBService) DeleteParticipantByID(instanceID string, studyKey string, participantID string) error

delete participant

func (*StudyDBService) DeleteParticipantFileInfoByID

func (dbService *StudyDBService) DeleteParticipantFileInfoByID(instanceID string, studyKey string, fileInfoID string) error

delete one by id

func (*StudyDBService) DeleteResearcherMessages

func (dbService *StudyDBService) DeleteResearcherMessages(instanceID string, studyKey string, messageIDs []string) (int64, error)

func (*StudyDBService) DeleteResponseByID

func (dbService *StudyDBService) DeleteResponseByID(instanceID string, studyKey string, responseID string) error

delete response by id

func (*StudyDBService) DeleteResponses

func (dbService *StudyDBService) DeleteResponses(instanceID string, studyKey string, filter bson.M) error

delete responses by query

func (*StudyDBService) DeleteStudy

func (dbService *StudyDBService) DeleteStudy(instanceID string, studyKey string) error

delete study by study key

func (*StudyDBService) DeleteStudyCodeListEntries

func (dbService *StudyDBService) DeleteStudyCodeListEntries(instanceID string, studyKey string, listKey string) error

func (*StudyDBService) DeleteStudyCodeListEntry

func (dbService *StudyDBService) DeleteStudyCodeListEntry(instanceID string, studyKey string, listKey string, code string) error

func (*StudyDBService) DeleteStudyCodeListsForStudy

func (dbService *StudyDBService) DeleteStudyCodeListsForStudy(instanceID string, studyKey string) error

func (*StudyDBService) DeleteStudyRulesByID

func (dbService *StudyDBService) DeleteStudyRulesByID(instanceID string, studyKey string, id string) error

func (*StudyDBService) DeleteStudyVariableByID

func (dbService *StudyDBService) DeleteStudyVariableByID(instanceID string, id string) error

remove a study variable by id

func (*StudyDBService) DeleteStudyVariableByStudyKeyAndKey

func (dbService *StudyDBService) DeleteStudyVariableByStudyKeyAndKey(instanceID string, studyKey string, key string) error

delete a study variable by studyKey and key

func (*StudyDBService) DeleteStudyVariablesByStudyKey

func (dbService *StudyDBService) DeleteStudyVariablesByStudyKey(instanceID string, studyKey string) error

remove all study variables by studyKey

func (*StudyDBService) DeleteSurveyVersion

func (dbService *StudyDBService) DeleteSurveyVersion(instanceID string, studyKey string, surveyKey string, versionID string) (err error)

func (*StudyDBService) DeleteTaskByID

func (dbService *StudyDBService) DeleteTaskByID(instanceID string, taskID string) error

delete task by id

func (*StudyDBService) DrawStudyCode

func (dbService *StudyDBService) DrawStudyCode(instanceID string, studyKey string, listKey string) (string, error)

func (*StudyDBService) DropAllIndexes

func (dbService *StudyDBService) DropAllIndexes()

DropAllIndexes drops all indexes for all instanceIDs and all collections

func (*StudyDBService) DropDefaultIndexes

func (dbService *StudyDBService) DropDefaultIndexes()

DropDefaultIndexes drops all default indexes for all instanceIDs and all collections

func (*StudyDBService) DropIndexForConfidentialIDMapCollection

func (dbService *StudyDBService) DropIndexForConfidentialIDMapCollection(instanceID string, dropAll bool)

func (*StudyDBService) DropIndexForConfidentialResponsesCollection

func (dbService *StudyDBService) DropIndexForConfidentialResponsesCollection(instanceID string, studyKey string, dropAll bool)

func (*StudyDBService) DropIndexForParticipantFilesCollection

func (dbService *StudyDBService) DropIndexForParticipantFilesCollection(instanceID string, studyKey string, dropAll bool)

func (*StudyDBService) DropIndexForParticipantsCollection

func (dbService *StudyDBService) DropIndexForParticipantsCollection(instanceID string, studyKey string, dropAll bool)

func (*StudyDBService) DropIndexForReportsCollection

func (dbService *StudyDBService) DropIndexForReportsCollection(instanceID string, studyKey string, dropAll bool)

func (*StudyDBService) DropIndexForResponsesCollection

func (dbService *StudyDBService) DropIndexForResponsesCollection(instanceID string, studyKey string, dropAll bool)

func (*StudyDBService) DropIndexForStudyCodeListsCollection

func (dbService *StudyDBService) DropIndexForStudyCodeListsCollection(instanceID string, dropAll bool)

func (*StudyDBService) DropIndexForStudyCountersCollection

func (dbService *StudyDBService) DropIndexForStudyCountersCollection(instanceID string, dropAll bool)

func (*StudyDBService) DropIndexForStudyInfosCollection

func (dbService *StudyDBService) DropIndexForStudyInfosCollection(instanceID string, dropAll bool)

func (*StudyDBService) DropIndexForStudyRulesCollection

func (dbService *StudyDBService) DropIndexForStudyRulesCollection(instanceID string, dropAll bool)

func (*StudyDBService) DropIndexForStudyVariablesCollection

func (dbService *StudyDBService) DropIndexForStudyVariablesCollection(instanceID string, dropAll bool)

func (*StudyDBService) DropIndexForSurveysCollection

func (dbService *StudyDBService) DropIndexForSurveysCollection(instanceID string, studyKey string, dropAll bool)

func (*StudyDBService) DropIndexForTaskQueueCollection

func (dbService *StudyDBService) DropIndexForTaskQueueCollection(instanceID string, dropAll bool)

func (*StudyDBService) FindAndExecuteOnConfidentialResponses

func (dbService *StudyDBService) FindAndExecuteOnConfidentialResponses(
	ctx context.Context,
	instanceID string, studyKey string,
	returnOnError bool,
	fn func(r studyTypes.SurveyResponse, args ...interface{}) error,
	args ...interface{},
) error

func (*StudyDBService) FindAndExecuteOnParticipantsStates

func (dbService *StudyDBService) FindAndExecuteOnParticipantsStates(
	ctx context.Context,
	instanceID string,
	studyKey string,
	filter bson.M,
	sort bson.M,
	returnOnErr bool,
	fn func(dbService *StudyDBService, p studyTypes.Participant, instanceID string, studyKey string, args ...interface{}) error,
	args ...interface{},
) error

execute function on participants

func (*StudyDBService) FindAndExecuteOnReports

func (dbService *StudyDBService) FindAndExecuteOnReports(
	ctx context.Context,
	instanceID string, studyKey string,
	filter bson.M,
	returnOnErr bool,
	fn func(instanceID string, studyKey string, report studyTypes.Report, args ...interface{}) error,
	args ...interface{},
) error

iterate over reports for query

func (*StudyDBService) FindAndExecuteOnResponses

func (dbService *StudyDBService) FindAndExecuteOnResponses(
	ctx context.Context,
	instanceID string, studyKey string,
	filter bson.M,
	sort bson.M,
	returnOnError bool,
	fn func(dbService *StudyDBService, r studyTypes.SurveyResponse, instanceID string, studyKey string, args ...interface{}) error,
	args ...interface{},
) error

execute on responses by query

func (*StudyDBService) FindConfidentialResponses

func (dbService *StudyDBService) FindConfidentialResponses(instanceID string, studyKey string, participantID string, key string) (responses []studyTypes.SurveyResponse, err error)

func (*StudyDBService) FindResearcherMessages

func (dbService *StudyDBService) FindResearcherMessages(instanceID string, studyKey string) (messages []studyTypes.StudyMessage, err error)

func (*StudyDBService) GetAllStudyCounterValues

func (dbService *StudyDBService) GetAllStudyCounterValues(instanceID string, studyKey string) ([]StudyCounter, error)

Get all counter values for a study

func (*StudyDBService) GetCurrentStudyCounterValue

func (dbService *StudyDBService) GetCurrentStudyCounterValue(instanceID string, studyKey string, scope string) (int64, error)

Get current counter value (without incrementing)

func (*StudyDBService) GetCurrentStudyRules

func (dbService *StudyDBService) GetCurrentStudyRules(instanceID string, studyKey string) (rules studyTypes.StudyRules, err error)

func (*StudyDBService) GetCurrentSurveyVersion

func (dbService *StudyDBService) GetCurrentSurveyVersion(instanceID string, studyKey string, surveyKey string) (survey *studyTypes.Survey, err error)

func (*StudyDBService) GetIndexes

func (dbService *StudyDBService) GetIndexes() (map[string]map[string][]bson.M, error)

func (*StudyDBService) GetNotificationSubscriptions

func (dbService *StudyDBService) GetNotificationSubscriptions(instanceID string, studyKey string) ([]studyTypes.NotificationSubscription, error)

func (*StudyDBService) GetParticipantByID

func (dbService *StudyDBService) GetParticipantByID(instanceID string, studyKey string, participantID string) (participant studyTypes.Participant, err error)

get participant by id

func (*StudyDBService) GetParticipantCount

func (dbService *StudyDBService) GetParticipantCount(instanceID string, studyKey string, filter bson.M) (int64, error)

get participant count for filter

func (*StudyDBService) GetParticipantFileInfoByID

func (dbService *StudyDBService) GetParticipantFileInfoByID(instanceID string, studyKey string, fileInfoID string) (participantFileInfo studytypes.FileInfo, err error)

get one by id

func (*StudyDBService) GetParticipantFileInfos

func (dbService *StudyDBService) GetParticipantFileInfos(instanceID string, studyKey string, query bson.M, page int64, limit int64) (fileInfos []studytypes.FileInfo, paginationInfo *PaginationInfos, err error)

func (*StudyDBService) GetParticipants

func (dbService *StudyDBService) GetParticipants(instanceID string, studyKey string, filter bson.M, sort bson.M, page int64, limit int64) (participants []studyTypes.Participant, paginationInfo *PaginationInfos, err error)

get paginated set of participants

func (*StudyDBService) GetProfileIDFromConfidentialID

func (dbService *StudyDBService) GetProfileIDFromConfidentialID(instanceID, confidentialID, studyKey string) (string, error)

func (*StudyDBService) GetReportByID

func (dbService *StudyDBService) GetReportByID(instanceID string, studyKey string, reportID string) (report studyTypes.Report, err error)

get report by id

func (*StudyDBService) GetReportCountForQuery

func (dbService *StudyDBService) GetReportCountForQuery(instanceID string, studyKey string, filter bson.M) (int64, error)

get report count for query

func (*StudyDBService) GetReports

func (dbService *StudyDBService) GetReports(instanceID string, studyKey string, filter bson.M, page int64, limit int64) (reports []studyTypes.Report, paginationInfo *PaginationInfos, err error)

get reports for query with pagination

func (*StudyDBService) GetResponseByID

func (dbService *StudyDBService) GetResponseByID(instanceID string, studyKey string, responseID string) (response studyTypes.SurveyResponse, err error)

get response by id

func (*StudyDBService) GetResponseInfos

func (dbService *StudyDBService) GetResponseInfos(instanceID string, studyKey string, filter bson.M, page int64, limit int64) (responseInfos []ResponseInfo, paginationInfo *PaginationInfos, err error)

func (*StudyDBService) GetResponses

func (dbService *StudyDBService) GetResponses(instanceID string, studyKey string, filter bson.M, sort bson.M, page int64, limit int64) (responses []studyTypes.SurveyResponse, paginationInfo *PaginationInfos, err error)

get paginated responses by query

func (*StudyDBService) GetResponsesCount

func (dbService *StudyDBService) GetResponsesCount(instanceID string, studyKey string, filter bson.M) (int64, error)

get responses count by query

func (*StudyDBService) GetStudies

func (dbService *StudyDBService) GetStudies(instanceID string, statusFilter string, onlyKeys bool) (studies []studyTypes.Study, err error)

get studies

func (*StudyDBService) GetStudy

func (dbService *StudyDBService) GetStudy(instanceID string, studyKey string) (study studyTypes.Study, err error)

get study by study key

func (*StudyDBService) GetStudyCodeListEntries

func (dbService *StudyDBService) GetStudyCodeListEntries(
	instanceID string,
	studyKey string,
	listKey string,
	page int64,
	limit int64,
) ([]studytypes.StudyCodeListEntry, *PaginationInfos, error)

func (*StudyDBService) GetStudyRulesByID

func (dbService *StudyDBService) GetStudyRulesByID(instanceID string, studyKey string, id string) (rules studyTypes.StudyRules, err error)

func (*StudyDBService) GetStudyRulesHistory

func (dbService *StudyDBService) GetStudyRulesHistory(instanceID string, studyKey string) (ruleHistory []studyTypes.StudyRules, err error)

func (*StudyDBService) GetStudyVariableByID

func (dbService *StudyDBService) GetStudyVariableByID(instanceID string, id string, onlyValue bool) (studytypes.StudyVariables, error)

get a study variable by id

func (*StudyDBService) GetStudyVariableByStudyKeyAndKey

func (dbService *StudyDBService) GetStudyVariableByStudyKeyAndKey(instanceID string, studyKey string, key string, onlyValue bool) (studytypes.StudyVariables, error)

get a study variable by studyKey and key

func (*StudyDBService) GetStudyVariablesByStudyKey

func (dbService *StudyDBService) GetStudyVariablesByStudyKey(instanceID string, studyKey string, onlyValue bool) ([]studytypes.StudyVariables, error)

get all study variables by studyKey (optionally only core fields)

func (*StudyDBService) GetSurveyKeysForStudy

func (dbService *StudyDBService) GetSurveyKeysForStudy(instanceID string, studyKey string, includeUnpublished bool) (surveyKeys []string, err error)

func (*StudyDBService) GetSurveyVersion

func (dbService *StudyDBService) GetSurveyVersion(instanceID string, studyKey string, surveyKey string, versionID string) (survey *studyTypes.Survey, err error)

func (*StudyDBService) GetSurveyVersions

func (dbService *StudyDBService) GetSurveyVersions(instanceID string, studyKey string, surveyKey string) (surveys []*studyTypes.Survey, err error)

func (*StudyDBService) GetTaskByFilename

func (dbService *StudyDBService) GetTaskByFilename(instanceID string, filename string) (studyTypes.Task, error)

func (*StudyDBService) GetTaskByID

func (dbService *StudyDBService) GetTaskByID(instanceID string, taskID string) (task studyTypes.Task, err error)

get task by id

func (*StudyDBService) GetUniqueReportKeysForStudy

func (dbService *StudyDBService) GetUniqueReportKeysForStudy(
	instanceID string,
	studyKey string,
	filters *ReportKeyFilters,
) ([]string, error)

GetUniqueReportKeysForStudy returns the distinct report keys within a study. Optional filters: - participantID: if non-empty, limits to reports from the specified participant - fromTS/toTS: if >0, applies inclusive timestamp range filters (unix seconds)

func (*StudyDBService) GetUniqueStudyCodeListKeysForStudy

func (dbService *StudyDBService) GetUniqueStudyCodeListKeysForStudy(instanceID string, studyKey string) ([]string, error)

func (*StudyDBService) IncrementAndGetStudyCounterValue

func (dbService *StudyDBService) IncrementAndGetStudyCounterValue(instanceID string, studyKey string, scope string) (int64, error)

Increment counter value (atomical find and update)

func (*StudyDBService) RemoveAllStudyCounters

func (dbService *StudyDBService) RemoveAllStudyCounters(instanceID string, studyKey string) error

Remove all study counters for a study

func (*StudyDBService) RemoveConfidentialIDMapEntriesForProfile

func (dbService *StudyDBService) RemoveConfidentialIDMapEntriesForProfile(instanceID, profileID, studyKey string) error

func (*StudyDBService) RemoveConfidentialIDMapEntriesForStudy

func (dbService *StudyDBService) RemoveConfidentialIDMapEntriesForStudy(instanceID, studyKey string) error

func (*StudyDBService) RemoveStudyCounterValue

func (dbService *StudyDBService) RemoveStudyCounterValue(instanceID string, studyKey string, scope string) error

Remove study counter value (reset to 0)

func (*StudyDBService) ReplaceConfidentialResponse

func (dbService *StudyDBService) ReplaceConfidentialResponse(instanceID string, studyKey string, response studyTypes.SurveyResponse) error

func (*StudyDBService) SaveParticipantState

func (dbService *StudyDBService) SaveParticipantState(instanceID string, studyKey string, pState studyTypes.Participant) (studyTypes.Participant, error)

func (*StudyDBService) SaveReport

func (dbService *StudyDBService) SaveReport(instanceID string, studyKey string, report studyTypes.Report) error

func (*StudyDBService) SaveResearcherMessage

func (dbService *StudyDBService) SaveResearcherMessage(instanceID string, studyKey string, message studyTypes.StudyMessage) error

func (*StudyDBService) SaveStudyCounterValue

func (dbService *StudyDBService) SaveStudyCounterValue(instanceID string, studyKey string, scope string, value int64) (int64, error)

Save counter value (upsert: update if exists, insert if not)

func (*StudyDBService) SaveStudyRules

func (dbService *StudyDBService) SaveStudyRules(instanceID string, studyKey string, rules studyTypes.StudyRules) error

func (*StudyDBService) SaveSurveyVersion

func (dbService *StudyDBService) SaveSurveyVersion(instanceID string, studyKey string, survey *studyTypes.Survey) (err error)

func (*StudyDBService) StudyCodeListEntryExists

func (dbService *StudyDBService) StudyCodeListEntryExists(instanceID string, studyKey string, listKey string, code string) (bool, error)

func (*StudyDBService) UnpublishSurvey

func (dbService *StudyDBService) UnpublishSurvey(instanceID string, studyKey string, surveyKey string) error

func (*StudyDBService) UpdateParticipantFileInfoPathAndStatus

func (dbService *StudyDBService) UpdateParticipantFileInfoPathAndStatus(instanceID string, studyKey string, fileInfoID string, path string, status string) error

update file info path and status

func (*StudyDBService) UpdateParticipantIDonConfidentialResponses

func (dbService *StudyDBService) UpdateParticipantIDonConfidentialResponses(instanceID string, studyKey string, oldID string, newID string) (count int64, err error)

func (*StudyDBService) UpdateParticipantIDonReports

func (dbService *StudyDBService) UpdateParticipantIDonReports(instanceID string, studyKey string, oldID string, newID string) (count int64, err error)

func (*StudyDBService) UpdateParticipantIDonResponses

func (dbService *StudyDBService) UpdateParticipantIDonResponses(instanceID string, studyKey string, oldID string, newID string) (count int64, err error)

func (*StudyDBService) UpdateParticipantIfNotModified

func (dbService *StudyDBService) UpdateParticipantIfNotModified(instanceID string, studyKey string, pState studyTypes.Participant) (studyTypes.Participant, error)

func (*StudyDBService) UpdateReportData

func (dbService *StudyDBService) UpdateReportData(
	instanceID string,
	studyKey string,
	reportID string,
	participantID string,
	data []studyTypes.ReportData,
	mode UpdateParticipantReportMode,
) error

update report data

func (*StudyDBService) UpdateStudyDisplayProps

func (dbService *StudyDBService) UpdateStudyDisplayProps(instanceID string, studyKey string, name []studyTypes.LocalisedObject, description []studyTypes.LocalisedObject, tags []studyTypes.Tag) error

func (*StudyDBService) UpdateStudyFileUploadRule

func (dbService *StudyDBService) UpdateStudyFileUploadRule(instanceID string, studyKey string, fileUploadRule *studyTypes.Expression) error

func (*StudyDBService) UpdateStudyIsDefault

func (dbService *StudyDBService) UpdateStudyIsDefault(instanceID string, studyKey string, isDefault bool) error

update study is default

func (*StudyDBService) UpdateStudyNotificationSubscriptions

func (dbService *StudyDBService) UpdateStudyNotificationSubscriptions(instanceID string, studyKey string, subscriptions []studyTypes.NotificationSubscription) error

func (*StudyDBService) UpdateStudyStats

func (dbService *StudyDBService) UpdateStudyStats(instanceID string, studyKey string, stats studyTypes.StudyStats) error

func (*StudyDBService) UpdateStudyStatus

func (dbService *StudyDBService) UpdateStudyStatus(instanceID string, studyKey string, status string) error

update study status

func (*StudyDBService) UpdateStudyVariableConfig

func (dbService *StudyDBService) UpdateStudyVariableConfig(
	instanceID string,
	studyKey string,
	key string,
	label string,
	description string,
	uiType string,
	uiPriority int,
	configs any) (studytypes.StudyVariables, error)

update a study variable's config by id

func (*StudyDBService) UpdateStudyVariableValue

func (dbService *StudyDBService) UpdateStudyVariableValue(
	instanceID string,
	studyKey string,
	key string,
	value any) (studytypes.StudyVariables, error)

update a study variable's value by id

func (*StudyDBService) UpdateTaskCompleted

func (dbService *StudyDBService) UpdateTaskCompleted(
	instanceID string,
	taskID string,
	status string,
	processedCount int,
	errMsg string,
	resultFile string,
) error

func (*StudyDBService) UpdateTaskProgress

func (dbService *StudyDBService) UpdateTaskProgress(instanceID string, taskID string, processedCount int) error

update task processed count

func (*StudyDBService) UpdateTaskTotalCount

func (dbService *StudyDBService) UpdateTaskTotalCount(instanceID string, taskID string, totalCount int) error

type UpdateParticipantReportMode

type UpdateParticipantReportMode string
const (
	UpdateParticipantReportModeAppend  UpdateParticipantReportMode = "append"
	UpdateParticipantReportModeReplace UpdateParticipantReportMode = "replace"
)

Jump to

Keyboard shortcuts

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