  Electronic health records (EHRs) are longitudinal records of a patient's
interactions with healthcare systems. A patient's EHR data is organized as a
three-level hierarchy from top to bottom: patient journey - all the experiences
of diagnoses and treatments over a period of time; individual visit - a set of
medical codes in a particular visit; and medical code - a specific record in
the form of medical codes. As EHRs begin to amass in millions, the potential
benefits, which these data might hold for medical research and medical outcome
prediction, are staggering - including, for example, predicting future
admissions to hospitals, diagnosing illnesses or determining the efficacy of
medical treatments. Each of these analytics tasks requires a domain knowledge
extraction method to transform the hierarchical patient journey into a vector
representation for further prediction procedure. The representations should
embed a sequence of visits and a set of medical codes with a specific
timestamp, which are crucial to any downstream prediction tasks. Hence,
expressively powerful representations are appealing to boost learning
performance. To this end, we propose a novel self-attention mechanism that
captures the contextual dependency and temporal relationships within a
patient's healthcare journey. An end-to-end bidirectional temporal encoder
network (BiteNet) then learns representations of the patient's journeys, based
solely on the proposed attention mechanism. We have evaluated the effectiveness
of our methods on two supervised prediction and two unsupervised clustering
tasks with a real-world EHR dataset. The empirical results demonstrate the
proposed BiteNet model produces higher-quality representations than
state-of-the-art baseline methods.
