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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 55 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive