Solutions to "Just KNIME It!" Challenge 20

I liked the use of lag columns!

2 Likes

Hi!

My first participation. This is my solution without loops and using a date dimension table.

justknimeit-20-HLezano

HL

4 Likes

1 Like

Here’s my solution.

I took on the challenge on avoiding using loop. Besides a hairy loop in a Column Expression node, the only way I could come up with to calculate Network Days, was to use a Python-node, where numpy has a nice function ‘busday_count’. I didn’t use any custom packages and hence didn’t see a need for adding the Conda Environment Propagation node (of which I’m a fan).

image

cheers

3 Likes

Hi everyone,
Here is my solution.
No loop.
Used Java Snippet and code from (Calculate number of weekdays between two dates in Java - Stack Overflow)

1 Like

Hi,

Here’s my solution to the JustKnimeIt Challenge 20. Wasn’t able to come up with a solution without Loops. Used some Nodes from a workflow I found on this thread: Calculating the number of working days between 2 dates in KNIME

1 Like

Woohoo! Super cool, @Hlezano!

Thanks for your solution, @ChloeDevine638, and welcome to our community! :smiley:

1 Like

Hi Knimers,

This

is my solution without loops.

Best Regards
Andrew

3 Likes

This is an alternative solution, without loops, not even in the Column Expressions node. Actually, if you have the starting day of the week and the number of days in the period you can compute the “network days” with a single (quite ugly) Math Formula

3 Likes

Here is my solution. This one was harder and was a lot of fun. With a loop this would be pretty easy but without! I decided to go in on Java. I had a job years ago coding c# so it was fun to dig in. I created (OK, took some code from stack overflow) my own custom Java Network Days equivalent. I tested it against some excel generated data so I think it should be pretty solid.


2 Likes

My Submission for Challenge 20

  • Miss the Loop - node in disguise
2 Likes

This is my solution.

2 Likes

Wow, I love how diverse these answers are. Some use Java, some R, some Python, and some keep it all within KNIME. My own solution is purely KNIME no-code (not even column expression; should have made using pure KNIME a mega bonus challenge :wink:).

4 Likes

Good night everyone,
here is my take on this challenge. With a bit of code in Python, I managed to manipulate the input table and calculate the business/network days between hospital visits.

This can also be done in pure KNIME, maybe using rules and date ranges, with no loops.


image

3 Likes

Yes, this one was hard. hehe Thanks for sharing your solution and experience with us!

2 Likes

@walkergv77 Thank you for sharing your solution. The logic that drives it is very elegant. In other words, I blatantly copied the code to make a 3 node Node Golf version with it. :blush:
It also allowed me to shave off 4 nodes from my pure-KNIME non-scripting version.

How it works:

  1. Groupwise-Multicolumn Lag to set up the data
  2. shift start and end dates away from weekends so we don’t have to bother with half weekends
  3. actual date difference
  4. subtract twice the number of weekends and do some corrections
  5. calculate mean

The smarter corrections in the middle branch can do without the weird start/end shifts.

3 Likes

Hello folks!

As always on Tuesdays, here’s our solution to last week’s challenge. :slight_smile:

So much variety in the solutions this time around!

6 Likes

Very cool. Glad it could be useful! Will download and poke around in your workflow.

2 Likes

@Thyme I like what you did here. I’ll admit it’s been so long since I was a pure coder I didn’t necessarily understand the logic of what I was doing and was ‘borrowing’ script from SO. I procrastinated on actual (paying) work to solve the challenge so I had to put a hard cap on my time before I could figure out what I actually did. That’s why I tested against network days using Excel. Glad you could explain the DAYS.between() part. Appreciate that.

1 Like