Social media activity is a bellwether for mobilization before an anti-government protest, and U.S. Army-funded research explores how to use real-time social media monitoring to predict future protest activity, according to a paper reviewed by Motherboard. The publication also reviewed official documents and patent applications to paint a broad picture of the effort to predict and potentially defuse domestic “insurrection.”

Tweets were geolocated to focus on “locations where protests occurred following the [2016 presidential] election” based on user profiles. Locations were then triangulated against protest data from “online news outlets across the country.”

The millions of tweets were used to make sense of the “frequencies of the protests in 39 cities” using 18 different ways of measuring the “size, structure and geography” of a network, along with two ways of measuring how that network leads a social group to become “mobilized,” or take action.

The research is evidence of a shift under the Trump administration from applying such research to foreign hotspots to surveilling U.S. citizens critical of their government. Amendments in April to the Joint Chiefs of Staff homeland defense doctrine widen the Pentagon’s role in providing domestic intelligence in an effort to quell “emergencies” such as “insurrection.”

“If you look at the long term trajectory of Pentagon, and intelligence agency desires for this sort of profiling and surveillance, these social media monitoring projects fits a deep pattern of institutional surveillance desires,” David Price, professor of sociology and anthropology at St. Martin’s University, told Motherboard. Price said that military-funded social science tends to assume “that civil unrest or protests are not core elements of democracy that need to be protected, [rather than] undermined by surveillance—and the oppression that follows such surveillance.”