# idirlab/trustmap architecture

> Architecture diagram of the GitHub repository idirlab/trustmap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/idirlab/trustmap
- Repository: https://github.com/idirlab/trustmap

## Overview

TrustMap lets users filter truthfulness-stance records by claim or topic and geography, then explore them on a U.S. map and in distribution and timeline charts. Its documented data stages are fact-check and tweet collection, geolocation, stance classification, and visualization. The sampled runtime shows CSV loading and map/chart rendering; the README describes RATSD, but its implementation is not present in the supplied tree. Some app-to-data wiring is therefore represented only at the documented level.

Main entry points: [`streamlit_app.py`](https://github.com/idirlab/trustmap/blob/main/streamlit_app.py) (Streamlit dashboard), [`tweet_collection/tweet_collection_v2.py`](https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_v2.py) (Tweet search), [`data`](https://github.com/idirlab/trustmap/tree/main/data) (Tweet datasets), [`tsm_fn.py`](https://github.com/idirlab/trustmap/blob/main/tsm_fn.py) (Dataset loading and filters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_politi_data[("Fact-check data")]
  node_keyword_extract["Keyword extraction"]
  node_tweet_search["Tweet search"]
  node_geo_search["City tweet search"]
  node_tweet_data[("Tweet datasets")]
end

subgraph group_processing["Stance data"]
  node_prep_analysis["Data preparation and analysis<br/>[adhoc_fn.py]"]
  node_ratsd["RATSD classification"]
  node_stance_data[("Stance datasets")]
  node_data_access["Dataset loading and filters<br/>[tsm_fn.py]"]
end

subgraph group_presentation["Exploration interface"]
  node_dashboard["Streamlit dashboard<br/>[streamlit_app.py]"]
  node_map["Interactive U.S. map<br/>[streamlit_app.py]"]
  node_charts["Distribution and timeline<br/>[streamlit_app.py]"]
end

subgraph group_reference["Geographic reference"]
  node_geo_constants["State geography<br/>[constants.py]"]
end

node_user(("Explorer"))
node_x_service(("X service"))

node_politi_data -.->|"provides claims"| node_keyword_extract
node_keyword_extract -->|"writes keywords"| node_tweet_search
node_tweet_search -->|"searches"| node_x_service
node_tweet_search -->|"writes tweets"| node_tweet_data
node_geo_search -->|"searches by city"| node_x_service
node_geo_search -->|"writes tweets"| node_tweet_data
node_tweet_data -.->|"supplies records"| node_prep_analysis
node_prep_analysis -.->|"prepares datasets"| node_stance_data
node_ratsd -.->|"outputs labels"| node_stance_data
node_stance_data -->|"reads CSVs"| node_data_access
node_geo_constants -->|"filters states"| node_data_access
node_user -.->|"selects filters"| node_dashboard
node_dashboard -.->|"requests datasets"| node_data_access
node_dashboard -->|"renders map"| node_map
node_dashboard -->|"renders charts"| node_charts

click node_politi_data "https://github.com/idirlab/trustmap/tree/main/data"
click node_keyword_extract "https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_v2.py"
click node_tweet_search "https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_v2.py"
click node_geo_search "https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_user_geo.py"
click node_tweet_data "https://github.com/idirlab/trustmap/tree/main/data"
click node_prep_analysis "https://github.com/idirlab/trustmap/blob/main/adhoc_fn.py"
click node_stance_data "https://github.com/idirlab/trustmap/tree/main/data"
click node_data_access "https://github.com/idirlab/trustmap/blob/main/tsm_fn.py"
click node_geo_constants "https://github.com/idirlab/trustmap/blob/main/constants.py"
click node_dashboard "https://github.com/idirlab/trustmap/blob/main/streamlit_app.py"
click node_map "https://github.com/idirlab/trustmap/blob/main/streamlit_app.py"
click node_charts "https://github.com/idirlab/trustmap/blob/main/streamlit_app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_politi_data,node_keyword_extract,node_tweet_search,node_geo_search,node_tweet_data toneBlue
class node_prep_analysis,node_ratsd,node_stance_data,node_data_access toneAmber
class node_dashboard,node_map,node_charts toneMint
class node_geo_constants toneRose
class node_user,node_x_service toneIndigo
```

## Components

### Data collection

- [Fact-check data](https://github.com/idirlab/trustmap/tree/main/data): `data`
- [Keyword extraction](https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_v2.py): `tweet_collection/tweet_collection_v2.py`
- [Tweet search](https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_v2.py): `tweet_collection/tweet_collection_v2.py`
- [City tweet search](https://github.com/idirlab/trustmap/blob/main/tweet_collection/tweet_collection_user_geo.py): `tweet_collection/tweet_collection_user_geo.py`
- [Tweet datasets](https://github.com/idirlab/trustmap/tree/main/data): `data`

### Stance data

- [Data preparation and analysis](https://github.com/idirlab/trustmap/blob/main/adhoc_fn.py): `adhoc_fn.py`
- **RATSD classification**
- [Stance datasets](https://github.com/idirlab/trustmap/tree/main/data): `data`
- [Dataset loading and filters](https://github.com/idirlab/trustmap/blob/main/tsm_fn.py): `tsm_fn.py`

### Exploration interface

- [Streamlit dashboard](https://github.com/idirlab/trustmap/blob/main/streamlit_app.py): `streamlit_app.py`
- [Interactive U.S. map](https://github.com/idirlab/trustmap/blob/main/streamlit_app.py): `streamlit_app.py`
- [Distribution and timeline](https://github.com/idirlab/trustmap/blob/main/streamlit_app.py): `streamlit_app.py`

### Geographic reference

- [State geography](https://github.com/idirlab/trustmap/blob/main/constants.py): `constants.py`

### Other components

- **Explorer**
- **X service**

## Connections

- Fact-check data → Keyword extraction: provides claims (evidence: `README.md`)
- Keyword extraction → Tweet search: writes keywords (evidence: `tweet_collection/tweet_collection_v2.py`)
- Tweet search → X service: searches (evidence: `tweet_collection/tweet_collection_v2.py`)
- Tweet search → Tweet datasets: writes tweets (evidence: `tweet_collection/tweet_collection_v2.py`)
- City tweet search → X service: searches by city (evidence: `tweet_collection/tweet_collection_user_geo.py`)
- City tweet search → Tweet datasets: writes tweets (evidence: `tweet_collection/tweet_collection_user_geo.py`)
- Tweet datasets → Data preparation and analysis: supplies records
- Data preparation and analysis → Stance datasets: prepares datasets
- RATSD classification → Stance datasets: outputs labels (evidence: `README.md`)
- Stance datasets → Dataset loading and filters: reads CSVs (evidence: `tsm_fn.py`)
- State geography → Dataset loading and filters: filters states (evidence: `tsm_fn.py`)
- Explorer → Streamlit dashboard: selects filters (evidence: `README.md`)
- Streamlit dashboard → Dataset loading and filters: requests datasets (evidence: `README.md`)
- Streamlit dashboard → Interactive U.S. map: renders map (evidence: `streamlit_app.py`)
- Streamlit dashboard → Distribution and timeline: renders charts (evidence: `streamlit_app.py`)
