Live Action Map (LAM)
An attempt to use open source data on Twitter to map areas with active conflict. Right now it is used for the Ukraine-Russia conflict, but in the future I hope it can be used for all sorts of dangerous situations.
Report Bug · Add Feature · Website Live! · Join Discord!
Table of Contents
About The Project
There are many twitter accounts posting live tweets about locations with conflicts. However, it is difficult to keep track of the locations especially with multiple different sources pointing out different location every few minutes. To make sure people can stay safe and take care of themselves, I have aggregated all the tweets into a single map that is easily accessible.
This project is a work in progress. I am working on adding more features and improving the map.
How it works:
- Tweets are sourced using keywords, hashtags and prepositions, such as the phrase "shooting... near ... location".
- Tweets can also be sourced from known twitter accounts by passing their usernames.
- Tweets are parsed with NLP and the location is extracted from the tweet, this however is not perfect so we need to filter locations later on.
- Some tweets might talk about other countries reactions like "The US.." or "Russia.." or "Moscow..", in that case we remove all the locations that are not in Ukraine.
- Some tweets might talk about multiple locations like "Shooting near the location and the location". In that case both locations are added to the map. Multiple markers can be added to the same location.
- Finally we add markers for each tweet.
- Markers will cluster together when you zoom out.
- A single marker looks like a red pin on a map.
- A cluster appears as a circle with a number inside it, the color shifts from green to orange to red depending on the number of markers in the cluster.
- We are not taking data directly because that may be vulnerable to trolling and spamming.
- We are using the Twitter v2 API to get the tweets, however it does not support parsing location directly from tweets.
Getting Started
To get a local copy up and running follow these simple example steps.
Prerequisites
- Python
- tweepy
- spaCy
- folium
- geopy
- tqdm
- geography3 (optional, needed for experimental feature)
Installation
Python
- Get a free twitter Bearer Token from developer.twitter.com. Remember to create a new app and get the bearer token.
- Clone the repo
git clone https://github.com/kinshukdua/LiveActionMap.git
- Install all prerequisites
pip install -r requirements.txt
- Download en_core_web, for more info see --> explosion/spaCy#4577
python3 -m spacy download en_core_web_sm
- Create a
.env
file based on the.env.example
cp .env.example .env
- Set the Twitter bearer token to your own in the
.env
file created in the previous step.
Docker
- Get a Twitter Bearer Token
- Download the
docker-compose.yaml
-filewget https://raw.githubusercontent.com/kinshukdua/LiveActionMap/main/docker/docker-compose.yaml
- Create a
.env
file based on the .env.examplewget https://raw.githubusercontent.com/kinshukdua/LiveActionMap/main/.env.example -O .env
- Start the stack
docker-compose up -d
Usage
Simply edit hashtags, prepositions and keywords and run scrape.py.
python scrape.py
Roadmap
- Add tweet scraping
- Add map
- Add map clustering
- Create a server to host the generated map
- Add better filtering
- Add tweet link on map
- Use NLP to indicate danger level
- Add misinformation prevention algorithm
- Multi-language Support
- Ukranian
- Russian
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt
for more information.