# EHR screen switching during patient visits

GROUPS:
 Alan Calvitti 4 Votes Attached is a (low rez PNG) poster based on mouse clickstream showing patterns of Electronic Health Record screen switching during visits. Data was collected as part of an ongoing study at VA San Diego. Note how often D03 in visit Q069 goes back and forth between Notes and Meds - and in general how Notes are the central hub of activity for most EHR work. When you consider that most information in progress notes is already present (in some form) elsewhere the EHR, you should consider systems to minimize redundant documentation - e.g. hyperlink and #hashtags. Although I can't share the entire codebase or underlying data, I'd like to stress the compactness, reusability and flexibility of functional query patterns.starting with the end product, here's a 2-3 line query quick[cprsTabSwitchingPoster] = quick[data]["VisitData", "EHR", "HumanCodedMouseActivity", "VASD", "Flat", "Coder1", All, splitMouseByTask ][All, Query[All, "Task" /* First] /* Split /* Map[First /* Replace[quick[cprsTabColors]]]][ SortBy[Length] /* keyGroupBy[quick@patient2doc] /* Query[All, nc /* fr, {Row, Length}]][ keyGroupBy[quick@doc2siteAndSpecGroup] /* Map[fr]] // n Where I use shortcuts like n = Normal, fr = Framed, nc = Normal /* Framed etc. as well as 1-liner helper functions discussed elsehwere like keyGroupBy. The data schema for each visit looks like this - note the TimeObject Keys that index this clickstream, as well as nested Associations - NoSQL.The key structuring query is this: splitMouseByTask = GroupBy[MOUSE_EVENT] /* Button /* Query[All, {TASK -> Values}] /* Query[{Keys /* AssociationMap[Association[VISIT_TIME -> #1] &], Identity}] /* Query[Merge[Apply[Join]]] /* Values /* splitBy[Query[TASK]] /* Query[All, <|Length -> Length, Time -> Query[{First, Last}, VISIT_TIME], Task -> Query[First, TASK]|>] Which looks more complicated than it is to actually develop interactively - by seeing the output at each step. If we could only extend Operator form to the entire language, it would make it so much easier to write from left to right like natural language.