Hi,
I am looking for some help as I am not an expert. I have a patient db of 100000 observations, each one representing a Doctors visit. There are different kind of Doctors in the list (GP, cardiologist, urologist etc), which refer the patients to each other. Each patients has his/her own ID and usually has more than one consultation.
I am very lost on trying to figure out how to calculate how many distinct patients a Doctor refers to a colleague but the patient does not show up (= the patient is referred, but the specialist never sees the patient, so there is no line for that ID regarding the specialist). I would love it if I could sort this by year and see how many GP referrals actually worked efficiently
For example:
In this table, I can see that patient 1 was correctly referred to the cardiologist (= the patient has seen the cardiologist). Patient 2 was referred but did not show up at the appointment with the urologist. Patient 3 did not show up with the urologist in 2021 but did show up in 2022.
So this should give me something like this :
2021
patients referred from GP to specialist: 1
patients that showed up with the specialist: 0
2022
patients referred from GP to specialist: 1
patients that showed up with the specialist: 1
2023
patients referred from GP to specialist: 2
patients that showed up with the specialist: 1
2024
patients referred from GP to specialist: 0
Is there any way this can be done in a simple manner ?
Thanks, any help is appreciated...
C
I am looking for some help as I am not an expert. I have a patient db of 100000 observations, each one representing a Doctors visit. There are different kind of Doctors in the list (GP, cardiologist, urologist etc), which refer the patients to each other. Each patients has his/her own ID and usually has more than one consultation.
I am very lost on trying to figure out how to calculate how many distinct patients a Doctor refers to a colleague but the patient does not show up (= the patient is referred, but the specialist never sees the patient, so there is no line for that ID regarding the specialist). I would love it if I could sort this by year and see how many GP referrals actually worked efficiently

For example:
patient ID | Date (year) | Doctor type | Doctor referrel |
1 | 2023 | GP | cardiologist |
1 | 2023 | cardiologist | |
1 | 2024 | GP | |
2 | 2023 | GP | urologist |
3 | 2021 | GP | urologist |
3 | 2022 | GP | urologist |
3 | 2022 | urologist | |
So this should give me something like this :
2021
patients referred from GP to specialist: 1
patients that showed up with the specialist: 0
2022
patients referred from GP to specialist: 1
patients that showed up with the specialist: 1
2023
patients referred from GP to specialist: 2
patients that showed up with the specialist: 1
2024
patients referred from GP to specialist: 0
Is there any way this can be done in a simple manner ?
Thanks, any help is appreciated...
C
Comment