Based on FHIR spec, I know I can do a search on patients and ask that all RiskAssessments be included for each patient (using _revinclude) -- but what if I'm interested only in the most recent RiskAssessment? Or better yet, the most recent RiskAssessment for a specific RiskAssessment.method. Is there a way to accomplish this with a single query?
Asked
Active
Viewed 290 times
1 Answers
0
You could query on RiskAssessment and do a forward include of Patient. If you do that, you can then filter on method. (And via chaining, also filter on what patients to include). There's no way to do "most recent" and get back multiple patients. (For a single patient, sort by descending date and restrict to only 1 instance). However, you could define your own search parameter to assert that filter. (You can also submit a change request to propose such a parameter be defined in general - I'd recommend making the parameter an integer so that you can retrieve the N most recent.)

Lloyd McKenzie
- 6,345
- 1
- 13
- 10
-
Thanks, Lloyd. I suspected there wasn't an easy built-in way to do exactly this. I'll think about what a generalized mechanism might look like -- and if I can come up with something good, I'll submit it as a change request. – Chris M Dec 11 '15 at 21:00