How monapdx/inbox-archeology works
1. Overall shape
- This is a local, single-user data exploration app for Gmail Takeout exports.
- The architecture is split into a Streamlit UI, a processing pipeline, and a set of transform steps that convert an .mbox archive into searchable and visual outputs.
2. Primary user flow
- The user drops All Mail.mbox into input/.
- The app discovers available inputs, runs a selected pipeline, and writes results into a run-specific workspace under workspaces/<run-name>/.
- The UI then reads those generated artifacts to show dashboards, relationship graphs, and timeline views.
3. UI layer
- app.py is the main entry point and is launched with Streamlit.
- dashboard.py appears to own the rendered analytics/dashboard views.
- The UI boundary is important: it does not appear to process mail directly; it orchestrates and displays pipeline outputs.
4. Pipeline orchestration
- pipeline.py is the central coordinator for the processing flow.
- It likely wires together the modules in steps/, manages step order, and connects input discovery to output generation.
- This creates a clear separation between workflow control and per-step data transformations.
5. Transformation stages
- The steps/ directory is the core data-processing subsystem.
- The names indicate a staged ETL-like flow:
- extract_headers.py reads raw message metadata from the mailbox.
- extract_relationships.py derives sender/recipient relationships.
- clean_relationships.py and filter_relationships.py normalize and reduce noisy edges.
- analyze_relationships.py and reanalyze_clean_relationships.py generate higher-level network analysis.
- build_core_timeline.py constructs a timeline of important events/messages.
- plot_core_timeline.py and preview_core_timeline.py render timeline visualizations.
- The pipeline likely fans out into multiple derived artifacts from the same raw message source.
6. Data model and artifacts
- The project is centered on derived files, not a database service.
- Raw input stays in input/; generated artifacts go to output/ and, more importantly, to per-run folders in workspaces/.
- This suggests an architecture based on file-backed intermediate results rather than in-memory state or a server-side datastore.
7. Workspace boundary
- workspace_utils.py likely handles run directory creation, artifact lookup, and path consistency.
- The workspace concept is the key persistence boundary: each execution is isolated so multiple analyses can coexist.
- That design supports reproducibility and lets the UI reopen previous runs.
8. Configuration boundary
- config.py centralizes runtime settings such as folder paths, naming conventions, and possibly toggles for the pipeline/UI.
- This keeps path logic and environment-specific behavior out of the UI and step modules.
- .env suggests some settings may be overridable without changing code.
9. Input/output boundaries
- input/ is the only expected place for user-provided source data.
- output/ and workspaces/ are generated/managed by the app and should be treated as derived state.
- That separation is important for diagramming: source data enters once, then is transformed into multiple presentation-ready artifacts.
10. Distribution and runtime
- The app is Python-based and launched locally with Streamlit.
- requirements.txt defines the processing and visualization stack.
- launch_inbox_archeology.bat indicates a Windows-friendly startup path, but the core architecture is still local Python execution.
11. What to emphasize in an architecture diagram
- Show the flow from Gmail Takeout .mbox into the pipeline, then into workspace artifacts, then into the dashboard/visualization layer.
- The important subsystems are:
- user-facing Streamlit app,
- pipeline coordinator,
- stepwise extraction/analysis modules,
- workspace/file management.
- There are no obvious external network dependencies in the core architecture; the project is designed to be fully local and privacy-preserving.
12. Reusable mental model
- Think of this repo as a local analytics compiler: raw mailbox input is progressively lowered into normalized relationship data, then raised again into visual summaries and timelines.
- The architecture is intentionally file-oriented, with each run producing a self-contained archive of outputs under its workspace.
Main entry points: pipeline.py pipeline.py · extract_headers.py extract headers · clean_relationships.py clean rels · build_core_timeline.py build timeline
Components 18
UI layer
Streamlit entrypoint and rendered analytics views.
- app.py · Main local UI entrypoint launched with Streamlit.
app.py - dashboard.py · Renders analytics, graphs, and timeline views from generated artifacts.
dashboard.py
Pipeline
Workflow coordination and staged mailbox processing.
- pipeline.py · Coordinates the end-to-end processing flow and step ordering.
pipeline.py - extract headers · Reads raw message metadata from the mailbox.
steps/extract_headers.py - extract rels · Derives sender and recipient relationships from headers.
steps/extract_relationships.py - clean rels · Normalizes relationship data and removes noise.
steps/clean_relationships.py - filter rels · Reduces relationships to the more relevant edges.
steps/filter_relationships.py - analyze rels · Produces higher-level network analysis from the cleaned graph.
steps/analyze_relationships.py - reanalyze rels · Re-runs analysis on cleaned relationship data for refined outputs.
steps/reanalyze_clean_relationships.py - build timeline · Constructs a timeline of key events and messages.
steps/build_core_timeline.py - plot timeline · Generates timeline visualizations for the UI.
steps/plot_core_timeline.py - preview timeline · Creates lightweight timeline previews for rapid inspection.
steps/preview_core_timeline.py
Storage
Input, output, and run workspace boundaries.
- workspace_utils.py · Creates run directories and resolves artifact paths for each analysis.
workspace_utils.py - input/ · Drop location for Gmail Takeout mailbox input.
input - All Mail.mbox · Raw Gmail Takeout archive consumed by the pipeline.
input/file.txt - workspaces/ · Per-run isolated workspace root for generated outputs.
workspaces - output/ · General generated output area for processed artifacts.
output
Runtime
Configuration and launch support for local execution.
- config.py · Centralizes paths, naming, and runtime configuration.
config.py
Connections 20
- app.py → pipeline.py: orchestrates · The UI triggers processing through the pipeline coordinator.
- app.py → dashboard.py: renders · The app presents the dashboard views to the user.
- pipeline.py → workspace_utils.py: uses · Workflow execution relies on workspace creation and artifact lookup.
- pipeline.py → config.py: reads · The coordinator uses centralized configuration.
- input/ → All Mail.mbox: contains · User-provided mailbox lives in the input folder.
- pipeline.py → input/: discovers · The pipeline finds available source inputs.
- All Mail.mbox → extract headers: feeds · Raw mailbox data begins the transformation flow.
- extract headers → extract rels: passes · Headers are transformed into relationship candidates.
- extract rels → clean rels: refines · Relationship data is normalized and cleaned.
- clean rels → filter rels: reduces · Cleaned relationships are filtered to the important subset.
- filter rels → analyze rels: analyzes · Filtered relationships are analyzed for higher-level structure.
- clean rels → reanalyze rels: reprocesses · Cleaned relationships can be reanalyzed for alternate outputs.
- extract headers → build timeline: supports · Message metadata also feeds timeline construction.
- build timeline → plot timeline: visualizes · Timeline data is rendered into plots.
- build timeline → preview timeline: previews · Timeline data is also prepared for quick previewing.
- pipeline.py → workspaces/: writes · Each run produces isolated artifacts in a workspace.
- workspaces/ → dashboard.py: reads · The dashboard loads generated run artifacts.
- output/ → dashboard.py: supplies · Derived outputs are available for presentation.
- config.py → input/: configures · Configuration defines path conventions and boundaries.
- config.py → workspaces/: configures · Configuration controls workspace layout and naming.