  Diabetes mellitus is a global concern, and early detection can prevent
serious complications. 50% of people with diabetes live undiagnosed,
disproportionately afflicting low-income groups. Non-invasive methods have
emerged for timely detection; however, their limited accuracy constrains
clinical usage. In this research, we present a novel Higher-Dimensional
Transformer (HDformer), the first Transformer-based architecture which utilizes
long-range photoplethysmography (PPG) to detect diabetes. The long-range PPG
maximizes the signal contextual information when compared to the less-than 30
second signals commonly used in existing research. To increase the
computational efficiency of HDformer long-range processing, a new attention
module, Time Square Attention (TSA), is invented to reduce the volume of tokens
by more than 10x, while retaining the local/global dependencies. TSA converts
the 1D inputs into 2D representations, grouping the adjacent points into a
single 2D token. It then generates dynamic patches and feeds them into a gated
mixture-of-experts (MoE) network, optimizing the learning on different
attention areas. HDformer achieves state-of-the-art results (sensitivity 98.4,
accuracy 97.3, specificity 92.8, AUC 0.929) on the standard MIMIC-III dataset,
surpassing existing research. Furthermore, we develop an end-to-end solution
where a low-cost wearable is prototyped to connect with the HDformer in the
Cloud via a mobile app. This scalable, convenient, and affordable approach
provides instantaneous detection and continuous monitoring for individuals. It
aids doctors in easily screening for diabetes and safeguards underprivileged
communities. The enhanced versatility of HDformer allows for efficient
processing and learning of long-range signals in general one-dimensional
time-series sequences, particularly for all biomedical waveforms.
