Icon

Challenge 20 - Patient Network Days - Solution

You work for a hospital and they have data for each time a patient was seen. In this challenge, you will calculate the difference between each time a patient was seen excluding weekends (called "network days"). Once you calculate the network days, calculate the average network days per patient. For the challenge, experiment with the input and output below.


Input

Patient          Date
Aline             11/01/2022
Aline             12/02/2022
Aline             25/02/2022
Aline             15/04/2022
Victor            05/02/2022
Victor            25/02/2022
Victor            15/03/2022
Victor            30/03/2022

Output

Patient          Date              Network Days          Mean
Aline             11/01/2022    ?                              23.333
Aline             12/02/2022    24                            23.333
Aline             25/02/2022    10                            23.333
Aline             15/04/2022    36                            23.333
Victor            05/02/2022    ?                              13.333
Victor            25/02/2022    15                            13.333
Victor            15/03/2022    13                            13.333
Victor            30/03/2022    12                            13.333

Note: if you simply use the Date&Time Difference node, you will mix patient data/dates and will also end up counting weekends. Bonus Challenge: Create a solution without using loops.

Nodes

Extensions

Links