service

package
v0.0.0-...-41bf266 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: CC0-1.0 Imports: 17 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 GetDataTypes

func GetDataTypes(resourceNames ...string) (map[string]DataType, bool)

GetDataTypes creates a map of the given resourceNames with their associated DataType 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"`
	// 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 CCLFNotFoundError

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

func (CCLFNotFoundError) Error

func (e CCLFNotFoundError) Error() string

type Config

type Config struct {
	SuppressionLookbackDays int `conf:"BCDA_SUPPRESSION_LOOKBACK_DAYS" conf_default:"60"`
	CutoffDurationDays      int `conf:"CCLF_CUTOFF_DATE_DAYS" conf_default:"45"`

	AlrJobSize uint `conf:"alr_job_size" conf_default:"1000"` // Number of entries to put in a single ALR job

	// 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"`

	ACOConfigs []ACOConfig `conf:"aco_config"`
	// contains filtered or unexported fields
}

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) String

func (config Config) String() string

type DataType

type DataType struct {
	Adjudicated          bool
	PartiallyAdjudicated bool
}

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

func GetDataType

func GetDataType(resourceName string) (DataType, bool)

GetDataType gets the DataType associated with the given resourceName

func (DataType) SupportsDataType

func (r DataType) SupportsDataType(dataType string) bool

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

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 (*MockService) CancelJob

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

CancelJob provides a mock function with given fields: ctx, jobID

func (*MockService) GetACOConfigForID

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

func (*MockService) GetAlrJobs

func (_m *MockService) GetAlrJobs(ctx context.Context, alrMBI *models.AlrMBIs) []*models.JobAlrEnqueueArgs

GetAlrJobs provides a mock function with given fields: ctx, alrMBI

func (*MockService) GetJobAndKeys

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

GetJobAndKeys provides a mock function with given fields: ctx, jobID

func (*MockService) GetJobKey

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

GetJobKey provides a mock function with given fields: ctx, jobID, filename

func (*MockService) GetJobPriority

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

GetJobPriority provides a mock function with given fields: acoID, resourceType, sinceParam

func (*MockService) GetJobs

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

GetJobs provides a mock function with given fields: ctx, acoID, statuses

func (*MockService) GetLatestCCLFFile

func (_m *MockService) GetLatestCCLFFile(ctx context.Context, cmsID string, fileType models.CCLFFileType) (*models.CCLFFile, error)

GetLatestCCLFFile provides a mock function with given fields: ctx, cmsID, fileType

func (*MockService) GetQueJobs

func (_m *MockService) GetQueJobs(ctx context.Context, conditions RequestConditions) ([]*models.JobEnqueueArgs, error)

GetQueJobs provides a mock function with given fields: ctx, conditions

type RequestConditions

type RequestConditions struct {
	ReqType   RequestType
	Resources []string

	CMSID string
	ACOID uuid.UUID

	JobID           uint
	Since           time.Time
	TransactionTime time.Time
	CreationTime    time.Time
	// contains filtered or unexported fields
}

type RequestType

type RequestType uint8
const (
	DefaultRequest          RequestType = iota
	RetrieveNewBeneHistData             // Allows caller to retrieve all of the data for newly attributed beneficiaries
	Runout                              // Allows caller to retrieve claims data for beneficiaries no longer attributed to the ACO
)

type RunoutConfig

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

func (RunoutConfig) String

func (config RunoutConfig) String() string

type Service

type Service interface {
	GetQueJobs(ctx context.Context, conditions RequestConditions) (queJobs []*models.JobEnqueueArgs, err error)

	GetAlrJobs(ctx context.Context, alrMBI *models.AlrMBIs) []*models.JobAlrEnqueueArgs

	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, fileType models.CCLFFileType) (*models.CCLFFile, error)

	GetACOConfigForID(cmsID string) (*ACOConfig, 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

Jump to

Keyboard shortcuts

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