Imagine an app or wearable device that could tell a day in advance that an at-risk individual would experience suicidal thoughts — and alert the person and their trusted contacts. That might soon be a reality, thanks to the nascent field of mood forecasting.

We've become used to fitness trackers and other electronic devices that monitor our physical activity, and now scientists say similar technology can be used to track our psychological health in ways never before possible.

By spotting early signs of emotional distress, the new apps and wearables could soon help preserve our mental well-being.

“We rely on patients to tell us how they feel, and we are beholden to that in making our decisions,” says Ipsit Vahia, a psychiatrist at McLean Hospital in Belmont, Massachusetts. But because it isn’t subject to the vagaries of our mood and our ability to assess our psychological state, technology could give doctors more reliable information.

Mood forecasting exploits the connection between the mind and the body. Research has shown that changes in our mental state, including bouts of sadness or anxiety, affect our bodies in discernible ways.

The heart rate is the best known of these emotional biomarkers — our pulse tends to quicken when we’re stressed. But our bodies respond to emotional distress in other ways too. “We know that reduced movement and sleep are markers of depression,” Vahia says. Perspiration increases with stress. And skin temperature often rises with what Harvard psychologist Matthew Nock calls “emotional arousal."

At least theoretically, any wearable that has sensors for pulse, skin temperature and movement can help track our mood. But even something as simple as the way we use our smartphones can reveal useful information about our mental state.

The pace at which we text, call and post on social media are all markers of what experts call our “digital phenotype.” And these markers change with our moods — posting more photos when we’re happy, for example, or posting fewer when we’re feeling blue.

As Sharath Guntuku, a research scientist at the University of Pennsylvania’s Center for Digital Health in Philadelphia, puts it, “Based on how we use technology, our mental state can be predicted."

Detecting and interpreting biomarkers

To exploit all this valuable data, academic researchers and private companies are working to develop devices and programs that not only detect and interpret our biomarkers but also respond with helpful advice.

Get the mach newsletter. This site is protected by recaptcha

For example, a mood-forecasting device or app might urge someone to call a friend when they have cut back on texting, or take a walk when the device hasn’t registered motion for several hours. Alternatively, shifting biomarkers or digital behavior could be communicated directly to an individual’s doctor, who could then intervene as necessary.

“By making these microadjustments day by day, maybe you would stop sliding toward depression and bounce back,” says Rosalind Picard, a computer scientist at the MIT Media Lab in Cambridge, Massachusetts.

What the research shows

Early studies give a glimpse of the potential of mood forecasting.

A team led by Picard reported last June that an experimental wrist sensor could pinpoint stress. The team followed 201 college students for five semesters. Each wore an experimental sensor, developed by Picard, that monitored body temperature, phone activity and skin conductance (how well skin conducts electricity). The research, published last year in the Journal of Medical Internet Research, showed that the sensor was 80 percent accurate in determining when students were feeling stressed.

In unpublished research conducted from 2015 to 2018, Nock found that a wristband that tracked psychiatric patients’ movement, skin conductance and body temperature could predict suicidal thoughts about one day before they arose. The prediction was about 75 percent accurate.

And researchers at the University of Chicago and the University of Michigan conducted an eight-week study of nine people diagnosed with bipolar disorder and found that changes in phone use predicted symptoms of both depression and mania. “Mood states in bipolar disorder appear to correlate with specific changes in mobile phone usage,” the authors wrote in their 2018 publication in the Journal of Internet Medical Research.

Such research is preliminary, and the results aren’t perfect. But mental health professionals are taking notice.

Last year, when the family of one of his female patients contacted Vahia, the McLean hospital psychiatrist, to alert him to her rising anxiety, he convinced her to start wearing a fitness tracker. Three weeks later, the data it collected showed something that the patient's family had missed: her nightly sleep duration had dropped by almost an hour.

When a change in medication failed to ease that problem, Vahia had the patient hospitalized for psychotherapy and a thorough adjustment of her medication — sparing her “at least a couple of weeks” of anxiety-ridden misery.

For his next study, Nock plans to test the bio-sensing wristband on psychiatric patients after they’ve left the hospital following a suicidal episode. In this case, information from smartphones and wristbands goes to a database. If the research team spots a cause for concern, they’ll contact patients to encourage them to reach out for help, whether by calling 911 or a crisis service center or their doctor.

Moving forward despite privacy concerns

If mood forecasting shows great promise, some see peril in the collection and transmission of such intimate personal data — and that includes some of the scientists working to develop the technology.

Picard worries that employers might gain access to the data and discriminate against employees or job seekers. And Jukka-Pekka Onnela, director of the health data science program at Harvard's T.H. Chan School of Public Health, cautions that more research is needed to tell the difference between a normal digital phenotype and one that's cause for concern.

Despite these and other concerns, mood-forecasting products are coming — or, in some cases, are already here.

Mindstrong, a firm in Palo Alto, California, is developing an app designed to track mental health by monitoring smartphone activity. Another company, San Francisco-based SpireHealth, has developed a biomarker-reading wearable that can be tucked into a sock or a bra. On the fashion-futuristic side, the Ger Mood sweater features a collar that changes color according to changes in the skin.

Many other products are in development. Picard hopes to adapt for mood forecasting a wristband she originally developed for predicting epileptic seizures. A United Kingdom-based software developer hopes to bring his “MindYourself” mood-forecasting wearable to market.

But even if mood forecasting lives up to its promise, experts are under no illusion that mood-tracking apps and devices will replace mental health professionals.

“The essence of psychiatry remains between a person and a provider,” Vahia says, adding that the technology provides only “an extra layer of meaningful information.”

But Picard says mood forecasting could be the difference between feeling good and suffering. “We’d love to get to you before you get depressed,” she says, “and help you put things back in your life before you get in trouble.”

Want more stories about technology?

FOLLOW NBC NEWS MACH ON TWITTER, FACEBOOK, AND INSTAGRAM.