Tagging Customers on Services
Hi Community, excited to see what you think up!
BLUF: How can I analyze what nurse saw a patient prior to a surgery or a non-surgery?
See my simplified dataset below. My hope is to be able to see which nurses saw which patients/customers that led to a surgery (or not).
- My current thought is a CASE WHEN to create a label for "surgical patients", but this doesn't capture pre-operative testing and evaluations. For instance:
CASE
WHEN Treatment = 'Surgery' THEN 'Surgical Patient'
ELSE 'Non-surgical Patient'
This logic missed the Consult, the testing, the evals, etc. that lead up to the surgery.
2. If I take all Patients that had a surgery and then do a large "CASE WHEN" on them, then I get duplicates downstream, which also isn't ideal. For instance:
CASE
WHEN Patient = 1, 2, OR 4 THEN 'Surgical Patient'
ELSE 'Non surgical patient'
This fails because then it shows FIVE "Surgical Patients" for Patient 1, even though only 1 surgery was performed.
I feel as though I'm very close but just need someone to get me across the finish line 😊🏁🏁
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
Best Answers
-
Here is the solution to your BLUF:
1. Use Group By tile in Magic ETL and the following formula: GROUP_CONCAT(DISTINCT CASE WHENTreatment
IN('Consult','Testing','Evals','Preop') THENName
END)You don't have a nurse identifier in your sample data so I added one called "Name"
Results:
This will show which nurses saw each patient. Let me know if this isn't what you're looking for.
For the patient count piece, you need to use COUNT(DISTINCT ) with a CASE statement:
COUNT(DISTINCT CASE WHEN
Treatment
IN('Consult','Testing','Evals','Preop') THENPatient
END)For analyzing which nurses saw patients that led to surgery vs. no surgery, you could add a flag to every patient that led to surgery in Magic ETL as shown below:
Then create some kind of card in analyzer using this beastmode:
COUNT(DISTINCT CASE WHENHad Surgery
= 'true' THENPatient
END) / COUNT(DISTINCTPatient
)Result:
75% of patients John saw ended up in surgery, 67% of patients Jacob saw ended up in surgery.
If I solved your problem, please select "yes" above
1 -
Wow!! Thanks a ton for all that. I think we are super close but I must've missed something somewhere.
You can see my raw data at far left. Then, I did a "Group By" per your instruction. The output was all the non-surgical appointments. I then joined this back to the original dataset because I will need the actually surgeries so I can compare to the whole.
Along the bottom line of the ETL, I filtered down to "Surgical Patients" as you instructed, added the constants, and then joined it back up with the original dataset.
Finally, I added the
IFNULL()
Unfortunately, there were duplicates created somewhere in my joins, so the output dataset no longer matches the original dataset. I.e.:
Count(Surgeries) != Count(Surgeries)
Any ideas??
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
0
Answers
-
Here is the solution to your BLUF:
1. Use Group By tile in Magic ETL and the following formula: GROUP_CONCAT(DISTINCT CASE WHENTreatment
IN('Consult','Testing','Evals','Preop') THENName
END)You don't have a nurse identifier in your sample data so I added one called "Name"
Results:
This will show which nurses saw each patient. Let me know if this isn't what you're looking for.
For the patient count piece, you need to use COUNT(DISTINCT ) with a CASE statement:
COUNT(DISTINCT CASE WHEN
Treatment
IN('Consult','Testing','Evals','Preop') THENPatient
END)For analyzing which nurses saw patients that led to surgery vs. no surgery, you could add a flag to every patient that led to surgery in Magic ETL as shown below:
Then create some kind of card in analyzer using this beastmode:
COUNT(DISTINCT CASE WHENHad Surgery
= 'true' THENPatient
END) / COUNT(DISTINCTPatient
)Result:
75% of patients John saw ended up in surgery, 67% of patients Jacob saw ended up in surgery.
If I solved your problem, please select "yes" above
1 -
Wow!! Thanks a ton for all that. I think we are super close but I must've missed something somewhere.
You can see my raw data at far left. Then, I did a "Group By" per your instruction. The output was all the non-surgical appointments. I then joined this back to the original dataset because I will need the actually surgeries so I can compare to the whole.
Along the bottom line of the ETL, I filtered down to "Surgical Patients" as you instructed, added the constants, and then joined it back up with the original dataset.
Finally, I added the
IFNULL()
Unfortunately, there were duplicates created somewhere in my joins, so the output dataset no longer matches the original dataset. I.e.:
Count(Surgeries) != Count(Surgeries)
Any ideas??
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
0 -
I just had to add additional join keys on the final join to alleviate the duplications that were happening.
This is good to go! Thanks a ton @ColemenWilson for your help.
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive