February 14, 2016

Web recommendation systems attempt to predict rating behavior using various classes of algorithms:

Content-based algorithms use product characteristics to recommend other items with similar characteristics.

Collaborative filtering algorithms evaluate past behavior and similar product choices made by other users.

Other algorithms build a model from a user's past behavior such as items previously purchased or selected and/or numerical ratings given to those items as well as similar decisions made by other users.

Popular Apps like Amazon, Netflix and Apple Music seem to incorporate a blend of both systems which translates to a better user experience.

A purely collaborative method seems frequently off the mark for me. These algorithms seem to incorporate demographic profiling, ageism, gender, and ethnicity factors that skew the product choice analytics resulting in stereotypical recommendations.

January 10, 2016

Create function dbo.fn_TimeZones
(@StartDateIn datetime
,@EndDateIn datetime
,@State varchar(10)
)
returns numeric(17,2) as
/*
Timezone tables are updated with data for many decades so they will have to be undated once a century and are maintained by the Human Resources Department:
dbo.TimeZoneStates
dbo.TimeZoneOffset

(1) The day of the act, event, or default from which the designated time period begins to run is not included.
(2) If the last day of the designated time period is a Saturday, Sunday, Federal legal holiday (as enumerated in Rule 6(1) of the Federal Rules of Civil Procedure), or a day on which the reviewing entity is unable to conduct business in the usual manner, the deadline becomes the next day that is not one of the aforementioned days.

1) The start date is always the received date.
2) The start date is a weekday. Start counting on the immediate next week day.
3) When start counting, count 10 hours for each contiguous full business day.

-- if the start date falls during daylight savings time use that offset

select @StartDateIn BETWEEN @DTbegin and @DTend

BEGIN

select @StartDate = DateADD(Hour,@EDToffset, @StartDateIn)

END

-- if the start date falls during standard time use that offset

select @StartDateIn BETWEEN @STbegin and @STend

BEGIN

select @StartDate = DateADD(Hour,@ESToffset, @StartDateIn)

END

-- if the end date falls during daylight savings time use that offset

select @EndDateIn BETWEEN @DTbegin and @DTend

BEGIN

select @EndDate = DateADD(Hour,@EDToffset, @EndDateIn)

END

-- if the end date falls during standard time use that offset

select @EndDateIn BETWEEN @STbegin and @STend

BEGIN

select @EndDate = DateADD(Hour,@ESToffset, @EndDateIn)

END

--< Business hours/days are custom by company. Place your algorithms here. For example:

-- if StartDate falls before the first business hour, set it to the start hour of that day
select @StartDate = CASE

-- if StartDate falls before the last business hour, set it to the start hour of the next day
WHEN datepart(hour,@StartDate) <= @StartHour
THEN dateadd(hour,@StartHour,dateadd(day,1,convert(char(8),@StartDate,112)))

-- if StartDate falls after the last business hour, set it to the start hour of the next day
WHEN datepart(hour,@StartDate) >= @EndHour
THEN dateadd(hour,@StartHour,dateadd(day,2,convert(char(8),@StartDate,112)))

-- if StartDate falls within the 10 business hour, set it to the start hour of the next day
WHEN datepart(hour,@StartDate) <= @EndHour
THEN dateadd(hour,@StartHour,dateadd(day,1,convert(char(8),@StartDate,112)))