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

Background Jobs #266

Merged
merged 13 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 19 additions & 2 deletions backend/pkg/constants.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package pkg

type ResourceGraphType string
type BackgroundJobStatus string
type BackgroundJobType string
type BackgroundJobSchedule string

const (
ResourceListPageSize int = 20
Expand All @@ -10,13 +13,27 @@ const (
ContextKeyTypeLogger string = "LOGGER"
ContextKeyTypeEventBusServer string = "EVENT_BUS_SERVER"

ContextKeyTypeAuthUsername string = "AUTH_USERNAME"
ContextKeyTypeAuthToken string = "AUTH_TOKEN"
ContextKeyTypeAuthUsername string = "AUTH_USERNAME"
ContextKeyTypeAuthToken string = "AUTH_TOKEN"
ContextKeyTypeBackgroundJobID string = "BACKGROUND_JOB_ID"

FhirResourceTypeComposition string = "Composition"

ResourceGraphTypeMedicalHistory ResourceGraphType = "MedicalHistory"
ResourceGraphTypeAddressBook ResourceGraphType = "AddressBook"
ResourceGraphTypeMedications ResourceGraphType = "Medications"
ResourceGraphTypeBillingReport ResourceGraphType = "BillingReport"

BackgroundJobStatusReady BackgroundJobStatus = "STATUS_READY"
BackgroundJobStatusLocked BackgroundJobStatus = "STATUS_LOCKED"
BackgroundJobStatusFailed BackgroundJobStatus = "STATUS_FAILED"
BackgroundJobStatusDone BackgroundJobStatus = "STATUS_DONE"

BackgroundJobTypeSync BackgroundJobType = "SYNC"
BackgroundJobTypeScheduledSync BackgroundJobType = "SCHEDULED_SYNC"

BackgroundJobScheduleDaily BackgroundJobSchedule = "DAILY"
BackgroundJobScheduleWeekly BackgroundJobSchedule = "WEEKLY"
BackgroundJobScheduleBiWeekly BackgroundJobSchedule = "BIWEEKLY"
BackgroundJobScheduleMonthly BackgroundJobSchedule = "MONTHLY"
)
7 changes: 7 additions & 0 deletions backend/pkg/database/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ type DatabaseRepository interface {
CreateGlossaryEntry(ctx context.Context, glossaryEntry *models.Glossary) error
GetGlossaryEntry(ctx context.Context, code string, codeSystem string) (*models.Glossary, error)

//background jobs
CreateBackgroundJob(ctx context.Context, backgroundJob *models.BackgroundJob) error
GetBackgroundJob(ctx context.Context, backgroundJobId string) (*models.BackgroundJob, error)
UpdateBackgroundJob(ctx context.Context, backgroundJob *models.BackgroundJob) error
ListBackgroundJobs(ctx context.Context, queryOptions models.BackgroundJobQueryOptions) ([]models.BackgroundJob, error)

//settings
LoadUserSettings(ctx context.Context) (*models.UserSettings, error)
SaveUserSettings(context.Context, *models.UserSettings) error
PopulateDefaultUserSettings(ctx context.Context, userId uuid.UUID) error

//used by fasten-sources Clients
UpsertRawResource(ctx context.Context, sourceCredentials sourcePkg.SourceCredential, rawResource sourcePkg.RawResourceFhir) (bool, error)
BackgroundJobCheckpoint(ctx context.Context, checkpointData map[string]interface{}, errorData map[string]interface{})
}
68 changes: 62 additions & 6 deletions backend/pkg/database/mock/mock_database.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading