Background
The COVID-19 pandemic and its corresponding preventive and control measures have increased the mental burden on the public. Understanding and tracking changes in public mental status can facilitate optimizing public mental health intervention and control strategies.
Objective
This study aimed to build a social media–based pipeline that tracks public mental changes and use it to understand public mental health status regarding the pandemic.
Methods
This study used COVID-19–related tweets posted from February 2020 to April 2022. The tweets were downloaded using unique identifiers through the Twitter application programming interface. We created a lexicon of 4 mental health problems (depression, anxiety, insomnia, and addiction) to identify mental health–related tweets and developed a dictionary for identifying health care workers. We analyzed temporal and geographic distributions of public mental health status during the pandemic and further compared distributions among health care workers versus the general public, supplemented by topic modeling on their underlying foci. Finally, we used interrupted time series analysis to examine the statewide impact of a lockdown policy on public mental health in 12 states.
Results
We extracted 4,213,005 tweets related to mental health and COVID-19 from 2,316,817 users. Of these tweets, 2,161,357 (51.3%) were related to “depression,” whereas 1,923,635 (45.66%), 225,205 (5.35%), and 150,006 (3.56%) were related to “anxiety,” “insomnia,” and “addiction,” respectively. Compared to the general public, health care workers had higher risks of all 4 types of problems (all P<.001), and they were more concerned about clinical topics than everyday issues (eg, “students’ pressure,” “panic buying,” and “fuel problems”) than the general public. Finally, the lockdown policy had significant associations with public mental health in 4 out of the 12 states we studied, among which Pennsylvania showed a positive association, whereas Michigan, North Carolina, and Ohio showed the opposite (all P<.05).
Conclusions
The impact of COVID-19 and the corresponding control measures on the public’s mental status is dynamic and shows variability among different cohorts regarding disease types, occupations, and regional groups. Health agencies and policy makers should primarily focus on depression (reported by 51.3% of the tweets) and insomnia (which has had an ever-increasing trend since the beginning of the pandemic), especially among health care workers. Our pipeline timely tracks and analyzes public mental health changes, especially when primary studies and large-scale surveys are difficult to conduct.