service

package
v0.0.0-...-25998fa Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: CC0-1.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJobNotCancelled   = goerrors.New("job was not cancelled due to internal server error")
	ErrJobNotCancellable = goerrors.New("job was not cancelled because it is not Pending or In Progress")
)

Functions

func GetClaimTypesMap

func GetClaimTypesMap(fhirResource ...string) (map[string]ClaimType, bool)

GetClaimTypesMap creates a map of the given fhir resources with their associated claim type objects It returns the resource map and a status flag, with true meaning all resources were found and mapped.

func IsSupportedACO

func IsSupportedACO(cmsID string) bool

IsSupportedACO determines if the particular ACO is supported by checking its CMS_ID against the supported formats.

Types

type ACOConfig

type ACOConfig struct {
	Model              string
	Pattern            string          `conf:"name_pattern"`
	PerfYearTransition string          `conf:"performance_year_transition"`
	LookbackYears      int             `conf:"lookback_period"`
	Disabled           bool            `conf:"disabled" conf_default:"false"`
	Data               []string        `conf:"data"`
	IgnoreSuppressions bool            `conf:"ignore_suppressions" conf_default:"false"`
	AttributionFile    AttributionFile `conf:"attribution_file"`
	// contains filtered or unexported fields
}

func (*ACOConfig) LookbackTime

func (config *ACOConfig) LookbackTime() time.Time

LookbackTime returns the timestamp that we should use as the lookback time associated with the ACO. We compute lookback time by evaluating the performance year transition and the number of lookback years.

func (*ACOConfig) String

func (config *ACOConfig) String() string

type AttributionFile

type AttributionFile struct {
	FileType        string `conf:"file_type"`
	NamePattern     string `conf:"name_pattern" `
	MetadataMatches int    `conf:"metadata_matches" `
	ModelIdentifier string `conf:"model_identifier"`
	PerformanceYear int    `conf:"file_performance_year"`
	FileDate        int    `conf:"file_date"`
}

type CCLFNotFoundError

type CCLFNotFoundError struct {
	FileNumber int
	CMSID      string
	FileType   models.CCLFFileType
	CutoffTime time.Time
}

func (CCLFNotFoundError) Error

func (e CCLFNotFoundError) Error() string

type ClaimType

type ClaimType struct {
	Adjudicated          bool
	PartiallyAdjudicated bool
}

ClaimType is used to identify the type of data returned by each resource

func GetClaimType

func GetClaimType(fhirResource string) (ClaimType, bool)

GetClaimType gets the claim type associated with the given fhir resource

func (ClaimType) SupportsClaimType

func (r ClaimType) SupportsClaimType(claimType string) bool

SupportsClaimType checks if the dataType is supported by the instanced DataType object

type Config

type Config struct {
	SuppressionLookbackDays int         `conf:"BCDA_SUPPRESSION_LOOKBACK_DAYS" conf_default:"60"`
	CutoffDurationDays      int         `conf:"CCLF_CUTOFF_DATE_DAYS" conf_default:"50"`
	ACOConfigs              []ACOConfig `conf:"aco_config"`
	V3EnabledACOs           []string    `conf:"v3_enabled_acos"` // Simple list of ACOs with v3 access
	CutoffDuration          time.Duration
	RateLimitConfig         RateLimitConfig `conf:"rate_limit_config"`
	V1V2DenyRegexes         []string        `conf:"v1_v2_deny_regexes"`
	V3NoPartialClaimsModels []string        `conf:"v3_no_partial_claims_models"`
	// Use the squash tag to allow the RunoutConfigs to avoid requiring the parameters
	// to be defined as a child of RunoutConfig.
	// Ex: Without the ,squash, we would have to have RunoutConfig.RUNOUT_CUTOFF_DATE_DAYS
	// With the ,squash, we would have RUNOUT_CUTOFF_DATE_DAYS.
	RunoutConfig RunoutConfig `conf:",squash"`
}

func LoadConfig

func LoadConfig() (cfg *Config, err error)

func (*Config) ComputeFields

func (cfg *Config) ComputeFields() (err error)

Parse un-exported fields using the fields loaded via the config

func (*Config) IsACODisabled

func (config *Config) IsACODisabled(CMSID string) bool

func (*Config) IsACOV3Enabled

func (config *Config) IsACOV3Enabled(ACOID string) bool

func (Config) String

func (config Config) String() string

type JobsNotFoundError

type JobsNotFoundError struct {
	ACOID       uuid.UUID
	StatusTypes []models.JobStatus
}

func (JobsNotFoundError) Error

func (e JobsNotFoundError) Error() string

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockService) CancelJob

func (_mock *MockService) CancelJob(ctx context.Context, jobID uint) (uint, error)

CancelJob provides a mock function for the type MockService

func (*MockService) EXPECT

func (_m *MockService) EXPECT() *MockService_Expecter

func (*MockService) FindOldCCLFFile

func (_mock *MockService) FindOldCCLFFile(ctx context.Context, cmsID string, since time.Time, cclfTimestamp time.Time) (uint, error)

FindOldCCLFFile provides a mock function for the type MockService

func (*MockService) GetACOConfigForID

func (_mock *MockService) GetACOConfigForID(cmsID string) (*ACOConfig, bool)

GetACOConfigForID provides a mock function for the type MockService

func (*MockService) GetCutoffTime

func (_mock *MockService) GetCutoffTime(ctx context.Context, reqType constants.DataRequestType, since time.Time, timeConstraints TimeConstraints, fileType models.CCLFFileType) (time.Time, string)

GetCutoffTime provides a mock function for the type MockService

func (*MockService) GetJobAndKeys

func (_mock *MockService) GetJobAndKeys(ctx context.Context, jobID uint) (*models.Job, []*models.JobKey, error)

GetJobAndKeys provides a mock function for the type MockService

func (*MockService) GetJobKey

func (_mock *MockService) GetJobKey(ctx context.Context, jobID uint, filename string) (*models.JobKey, error)

GetJobKey provides a mock function for the type MockService

func (*MockService) GetJobPriority

func (_mock *MockService) GetJobPriority(acoID string, resourceType string, sinceParam bool) int16

GetJobPriority provides a mock function for the type MockService

func (*MockService) GetJobs

func (_mock *MockService) GetJobs(ctx context.Context, acoID uuid.UUID, statuses ...models.JobStatus) ([]*models.Job, error)

GetJobs provides a mock function for the type MockService

func (*MockService) GetLatestCCLFFile

func (_mock *MockService) GetLatestCCLFFile(ctx context.Context, cmsID string, lowerBound time.Time, upperBound time.Time, fileType models.CCLFFileType) (*models.CCLFFile, error)

GetLatestCCLFFile provides a mock function for the type MockService

func (*MockService) GetQueJobs

GetQueJobs provides a mock function for the type MockService

func (*MockService) GetTimeConstraints

func (_mock *MockService) GetTimeConstraints(ctx context.Context, cmsID string) (TimeConstraints, error)

GetTimeConstraints provides a mock function for the type MockService

func (*MockService) IsV3NoPartialClaimsModel

func (_mock *MockService) IsV3NoPartialClaimsModel(model string) bool

IsV3NoPartialClaimsModel provides a mock function for the type MockService

type MockService_CancelJob_Call

type MockService_CancelJob_Call struct {
	*mock.Call
}

MockService_CancelJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelJob'

func (*MockService_CancelJob_Call) Return

func (*MockService_CancelJob_Call) Run

func (*MockService_CancelJob_Call) RunAndReturn

func (_c *MockService_CancelJob_Call) RunAndReturn(run func(ctx context.Context, jobID uint) (uint, error)) *MockService_CancelJob_Call

type MockService_Expecter

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

func (*MockService_Expecter) CancelJob

func (_e *MockService_Expecter) CancelJob(ctx interface{}, jobID interface{}) *MockService_CancelJob_Call

CancelJob is a helper method to define mock.On call

  • ctx context.Context
  • jobID uint

func (*MockService_Expecter) FindOldCCLFFile

func (_e *MockService_Expecter) FindOldCCLFFile(ctx interface{}, cmsID interface{}, since interface{}, cclfTimestamp interface{}) *MockService_FindOldCCLFFile_Call

FindOldCCLFFile is a helper method to define mock.On call

  • ctx context.Context
  • cmsID string
  • since time.Time
  • cclfTimestamp time.Time

func (*MockService_Expecter) GetACOConfigForID

func (_e *MockService_Expecter) GetACOConfigForID(cmsID interface{}) *MockService_GetACOConfigForID_Call

GetACOConfigForID is a helper method to define mock.On call

  • cmsID string

func (*MockService_Expecter) GetCutoffTime

func (_e *MockService_Expecter) GetCutoffTime(ctx interface{}, reqType interface{}, since interface{}, timeConstraints interface{}, fileType interface{}) *MockService_GetCutoffTime_Call

GetCutoffTime is a helper method to define mock.On call

  • ctx context.Context
  • reqType constants.DataRequestType
  • since time.Time
  • timeConstraints TimeConstraints
  • fileType models.CCLFFileType

func (*MockService_Expecter) GetJobAndKeys

func (_e *MockService_Expecter) GetJobAndKeys(ctx interface{}, jobID interface{}) *MockService_GetJobAndKeys_Call

GetJobAndKeys is a helper method to define mock.On call

  • ctx context.Context
  • jobID uint

func (*MockService_Expecter) GetJobKey

func (_e *MockService_Expecter) GetJobKey(ctx interface{}, jobID interface{}, filename interface{}) *MockService_GetJobKey_Call

GetJobKey is a helper method to define mock.On call

  • ctx context.Context
  • jobID uint
  • filename string

func (*MockService_Expecter) GetJobPriority

func (_e *MockService_Expecter) GetJobPriority(acoID interface{}, resourceType interface{}, sinceParam interface{}) *MockService_GetJobPriority_Call

GetJobPriority is a helper method to define mock.On call

  • acoID string
  • resourceType string
  • sinceParam bool

func (*MockService_Expecter) GetJobs

func (_e *MockService_Expecter) GetJobs(ctx interface{}, acoID interface{}, statuses ...interface{}) *MockService_GetJobs_Call

GetJobs is a helper method to define mock.On call

  • ctx context.Context
  • acoID uuid.UUID
  • statuses ...models.JobStatus

func (*MockService_Expecter) GetLatestCCLFFile

func (_e *MockService_Expecter) GetLatestCCLFFile(ctx interface{}, cmsID interface{}, lowerBound interface{}, upperBound interface{}, fileType interface{}) *MockService_GetLatestCCLFFile_Call

GetLatestCCLFFile is a helper method to define mock.On call

  • ctx context.Context
  • cmsID string
  • lowerBound time.Time
  • upperBound time.Time
  • fileType models.CCLFFileType

func (*MockService_Expecter) GetQueJobs

func (_e *MockService_Expecter) GetQueJobs(ctx interface{}, args interface{}) *MockService_GetQueJobs_Call

GetQueJobs is a helper method to define mock.On call

  • ctx context.Context
  • args worker_types.PrepareJobArgs

func (*MockService_Expecter) GetTimeConstraints

func (_e *MockService_Expecter) GetTimeConstraints(ctx interface{}, cmsID interface{}) *MockService_GetTimeConstraints_Call

GetTimeConstraints is a helper method to define mock.On call

  • ctx context.Context
  • cmsID string

func (*MockService_Expecter) IsV3NoPartialClaimsModel

func (_e *MockService_Expecter) IsV3NoPartialClaimsModel(model interface{}) *MockService_IsV3NoPartialClaimsModel_Call

IsV3NoPartialClaimsModel is a helper method to define mock.On call

  • model string

type MockService_FindOldCCLFFile_Call

type MockService_FindOldCCLFFile_Call struct {
	*mock.Call
}

MockService_FindOldCCLFFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOldCCLFFile'

func (*MockService_FindOldCCLFFile_Call) Return

func (*MockService_FindOldCCLFFile_Call) Run

func (_c *MockService_FindOldCCLFFile_Call) Run(run func(ctx context.Context, cmsID string, since time.Time, cclfTimestamp time.Time)) *MockService_FindOldCCLFFile_Call

func (*MockService_FindOldCCLFFile_Call) RunAndReturn

func (_c *MockService_FindOldCCLFFile_Call) RunAndReturn(run func(ctx context.Context, cmsID string, since time.Time, cclfTimestamp time.Time) (uint, error)) *MockService_FindOldCCLFFile_Call

type MockService_GetACOConfigForID_Call

type MockService_GetACOConfigForID_Call struct {
	*mock.Call
}

MockService_GetACOConfigForID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetACOConfigForID'

func (*MockService_GetACOConfigForID_Call) Return

func (*MockService_GetACOConfigForID_Call) Run

func (*MockService_GetACOConfigForID_Call) RunAndReturn

type MockService_GetCutoffTime_Call

type MockService_GetCutoffTime_Call struct {
	*mock.Call
}

MockService_GetCutoffTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCutoffTime'

func (*MockService_GetCutoffTime_Call) Return

func (*MockService_GetCutoffTime_Call) Run

func (*MockService_GetCutoffTime_Call) RunAndReturn

type MockService_GetJobAndKeys_Call

type MockService_GetJobAndKeys_Call struct {
	*mock.Call
}

MockService_GetJobAndKeys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobAndKeys'

func (*MockService_GetJobAndKeys_Call) Return

func (*MockService_GetJobAndKeys_Call) Run

func (*MockService_GetJobAndKeys_Call) RunAndReturn

type MockService_GetJobKey_Call

type MockService_GetJobKey_Call struct {
	*mock.Call
}

MockService_GetJobKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobKey'

func (*MockService_GetJobKey_Call) Return

func (*MockService_GetJobKey_Call) Run

func (_c *MockService_GetJobKey_Call) Run(run func(ctx context.Context, jobID uint, filename string)) *MockService_GetJobKey_Call

func (*MockService_GetJobKey_Call) RunAndReturn

func (_c *MockService_GetJobKey_Call) RunAndReturn(run func(ctx context.Context, jobID uint, filename string) (*models.JobKey, error)) *MockService_GetJobKey_Call

type MockService_GetJobPriority_Call

type MockService_GetJobPriority_Call struct {
	*mock.Call
}

MockService_GetJobPriority_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobPriority'

func (*MockService_GetJobPriority_Call) Return

func (*MockService_GetJobPriority_Call) Run

func (_c *MockService_GetJobPriority_Call) Run(run func(acoID string, resourceType string, sinceParam bool)) *MockService_GetJobPriority_Call

func (*MockService_GetJobPriority_Call) RunAndReturn

func (_c *MockService_GetJobPriority_Call) RunAndReturn(run func(acoID string, resourceType string, sinceParam bool) int16) *MockService_GetJobPriority_Call

type MockService_GetJobs_Call

type MockService_GetJobs_Call struct {
	*mock.Call
}

MockService_GetJobs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetJobs'

func (*MockService_GetJobs_Call) Return

func (*MockService_GetJobs_Call) Run

func (_c *MockService_GetJobs_Call) Run(run func(ctx context.Context, acoID uuid.UUID, statuses ...models.JobStatus)) *MockService_GetJobs_Call

func (*MockService_GetJobs_Call) RunAndReturn

func (_c *MockService_GetJobs_Call) RunAndReturn(run func(ctx context.Context, acoID uuid.UUID, statuses ...models.JobStatus) ([]*models.Job, error)) *MockService_GetJobs_Call

type MockService_GetLatestCCLFFile_Call

type MockService_GetLatestCCLFFile_Call struct {
	*mock.Call
}

MockService_GetLatestCCLFFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestCCLFFile'

func (*MockService_GetLatestCCLFFile_Call) Return

func (*MockService_GetLatestCCLFFile_Call) Run

func (_c *MockService_GetLatestCCLFFile_Call) Run(run func(ctx context.Context, cmsID string, lowerBound time.Time, upperBound time.Time, fileType models.CCLFFileType)) *MockService_GetLatestCCLFFile_Call

func (*MockService_GetLatestCCLFFile_Call) RunAndReturn

func (_c *MockService_GetLatestCCLFFile_Call) RunAndReturn(run func(ctx context.Context, cmsID string, lowerBound time.Time, upperBound time.Time, fileType models.CCLFFileType) (*models.CCLFFile, error)) *MockService_GetLatestCCLFFile_Call

type MockService_GetQueJobs_Call

type MockService_GetQueJobs_Call struct {
	*mock.Call
}

MockService_GetQueJobs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetQueJobs'

func (*MockService_GetQueJobs_Call) Return

func (*MockService_GetQueJobs_Call) Run

func (*MockService_GetQueJobs_Call) RunAndReturn

type MockService_GetTimeConstraints_Call

type MockService_GetTimeConstraints_Call struct {
	*mock.Call
}

MockService_GetTimeConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTimeConstraints'

func (*MockService_GetTimeConstraints_Call) Return

func (*MockService_GetTimeConstraints_Call) Run

func (*MockService_GetTimeConstraints_Call) RunAndReturn

type MockService_IsV3NoPartialClaimsModel_Call

type MockService_IsV3NoPartialClaimsModel_Call struct {
	*mock.Call
}

MockService_IsV3NoPartialClaimsModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsV3NoPartialClaimsModel'

func (*MockService_IsV3NoPartialClaimsModel_Call) Return

func (*MockService_IsV3NoPartialClaimsModel_Call) Run

func (*MockService_IsV3NoPartialClaimsModel_Call) RunAndReturn

type RateLimitConfig

type RateLimitConfig struct {
	All  bool     `conf:"all"`  // rate-limit requests for all ACOs
	ACOs []string `conf:"acos"` // rate-limit requests for specific ACOs
}

func (RateLimitConfig) String

func (config RateLimitConfig) String() string

type RunoutConfig

type RunoutConfig struct {
	CutoffDurationDays int    `conf:"RUNOUT_CUTOFF_DATE_DAYS" conf_default:"180"`
	ClaimThruDate      string `conf:"RUNOUT_CLAIM_THRU_DATE" conf_default:"2025-12-31"`
	CutoffDuration     time.Duration
	// contains filtered or unexported fields
}

func (RunoutConfig) String

func (config RunoutConfig) String() string

type Service

type Service interface {
	GetCutoffTime(ctx context.Context, reqType constants.DataRequestType, since time.Time, timeConstraints TimeConstraints, fileType models.CCLFFileType) (time.Time, string)
	FindOldCCLFFile(ctx context.Context, cmsID string, since time.Time, cclfTimestamp time.Time) (uint, error)
	GetQueJobs(ctx context.Context, args worker_types.PrepareJobArgs) (queJobs []*worker_types.JobEnqueueArgs, err error)
	GetJobAndKeys(ctx context.Context, jobID uint) (*models.Job, []*models.JobKey, error)
	GetJobKey(ctx context.Context, jobID uint, filename string) (*models.JobKey, error)
	GetJobs(ctx context.Context, acoID uuid.UUID, statuses ...models.JobStatus) ([]*models.Job, error)
	CancelJob(ctx context.Context, jobID uint) (uint, error)
	GetJobPriority(acoID string, resourceType string, sinceParam bool) int16
	GetLatestCCLFFile(ctx context.Context, cmsID string, lowerBound time.Time, upperBound time.Time, fileType models.CCLFFileType) (*models.CCLFFile, error)
	GetACOConfigForID(cmsID string) (*ACOConfig, bool)
	GetTimeConstraints(ctx context.Context, cmsID string) (TimeConstraints, error)
	IsV3NoPartialClaimsModel(model string) bool
}

Service contains all of the methods needed to interact with the data represented in the models package

func NewService

func NewService(r models.Repository, cfg *Config, basePath string) Service

type TimeConstraints

type TimeConstraints struct {
	AttributionDate time.Time
	OptOutDate      time.Time
	ClaimsDate      time.Time
}

Jump to

Keyboard shortcuts

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