Giter VIP home page Giter VIP logo

Comments (3)

christopherthompson81 avatar christopherthompson81 commented on June 28, 2024

Thank you for the feedback! I'll try to make a fix shortly. I'm also able to review pull requests to patch the package.

from pgsql_holidays.

christopherthompson81 avatar christopherthompson81 commented on June 28, 2024

Since I'm naively porting the code from python, it's hard for me to know if it was implemented correctly upstream. Date shifting wasn't implemented in the python lib for Bulgaria, so thank-you for letting me know that it should be there.

I've made some changes to a new branch of the code ("complex_return_experiment"). I'm looking into a more complex return type so that it would be easier to filter data on parameters that aren't directly knowable from the datestamp. This is partially how I want to address your issue. Could you look at the output below and let me know if it would better suit what you would need?

datestamp description authority day_off observation_shifted
2020-01-01 Нова година national true false
2020-03-03 Ден на Освобождението на България от османско иго national true false
2020-04-17 Велики петък national true false
2020-04-18 Велика събота religious false false
2020-04-19 Великден religious false false
2020-04-20 Велики понеделник national true false
2020-05-01 Ден на труда и на международната работническа солидарност national true false
2020-05-06 Гергьовден, Ден на храбростта и Българската армия national true false
2020-05-24 Ден на българската просвета и култура и на славянската писменост national true false
2020-05-25 Ден на българската просвета и култура и на славянската писменост (Observed) national true true
2020-09-06 Ден на Съединението national true false
2020-09-07 Ден на Съединението (Observed) national true true
2020-09-22 Ден на Независимостта на България national true false
2020-11-01 Ден на народните будители national false false
2020-12-24 Бъдни вечер national true false
2020-12-25 Рождество Христово national true false
2020-12-28 Рождество Христово national true true

I'm not fully sure if I should drop the English "(Observed)" tags if I use this format, so I'd be curious about your thoughts on that too.

from pgsql_holidays.

stefanov-sm avatar stefanov-sm commented on June 28, 2024

I think that the new return format is excellent and suites both business use and general information cases.

About the English "(Observed)" tags - well, it's good to have of course.
What about declaring something like
OBSERVED constant text := '(компенсация)'; -- Bulgarian
in country functions and then use the constant instead of the literal?

One more thought. Holiday lists and rules are changed every now and then in countries around the world and this may go unnoticed. Maybe local people are the best opportunity for updating.
A more declarative approach could help them do so, something like this HOLIDAY_DEFINITIONS "table" in country functions.

create type holidays.holiday_def as
(
 month_value integer,
 day_value integer,
 description text,
 day_off boolean,
 authority holidays.jurisdictional_authority,
 observation_shift boolean
);

-- declare
HOLIDAY_DEFINITIONS constant holidays.holiday_def[] := array
[
-- MONTH_VALUE DAY_VALUE  DESCRIPTION                     OFF_DAY AUTHORITY   SHIFT
   (JANUARY,           1, 'Нова година',                  true,   'national', true),
   (MARCH,             3, 'Освобождение от османско иго', true,   'national', true),
   (MAY,               1, 'Ден на труда',                 true,   'national', true),
   (MAY,               6, 'Гергьовден',                   true,   'national', true),
   (MAY,              24, 'Ден на писмеността',           true,   'national', true),
   (SEPTEMBER,         6, 'Ден на Съединението',          true,   'national', true),
   (SEPTEMBER,        22, 'Ден на Независимостта',        true,   'national', true),
   (NOVEMBER,          1, 'Ден на народните будители',    false,  'national', false)
];
running_holiday holidays.holiday_def;

-- begin 
foreach running_holiday in array HOLIDAY_DEFINITIONS loop
	-- generic country-independent business logic here 
end loop;

Cheers!

from pgsql_holidays.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.