Spaces:
Sleeping
Sleeping
| title: New Graph Visualization | |
| emoji: πΈοΈ | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: docker | |
| app_port: 7860 | |
| startup_duration_timeout: 1h | |
| pinned: false | |
| # New Graph Visualization | |
| Interactive clinical graph explorer (Dash + Cytoscape). **FalkorDB** and the Dash app run in one Docker container β same pattern as [UMLS Graph Explorer](https://huggingface.co/spaces/Raapid/umls-graph-explorer-falkordb). | |
| On each cold start the container loads **1.28M nodes** and **7.6M edges** from staging parquet via GRAPH.BULK (~2β5 min), then serves the UI on port **7860**. | |
| **Live Space:** [Raapid/new-graph-visualization](https://huggingface.co/spaces/Raapid/new-graph-visualization) | |
| Default seed: `A27828238` Β· Default hop depth: **2** | |
| ## Features | |
| - Explore by AUI or CUI with hop depth 1β15 (HIER_ISA + MRREL) | |
| - Toggle MRHIER, semantic (MRREL), AUIβCUI, same-CUI edges | |
| - Path finder between two AUIs | |
| - SAB / TUI / TTY / **category** filters (category from `graph_nodes.parquet`) | |
| - Layout controls (cose-bilkent recommended) | |
| ## Hugging Face Space (Docker) | |
| | Variable | Default | Description | | |
| |----------|---------|-------------| | |
| | `PORT` | `7860` | Dash listen port | | |
| | `FALKORDB_GRAPH` | `clinical_graph` | Graph name | | |
| | `REBUILD_GRAPH` | `1` | Reload graph on container start | | |
| | `SKIP_GRAPH_BUILD` | `0` | Set `1` to skip load (debug) | | |
| | `STAGING_DIR` | `/home/user/app/falkor_staging` | Staging parquet directory | | |
| | `REDIS_ARGS` | `--maxmemory 9gb β¦` | Embedded redis-server memory | | |
| Set Space hardware to **CPU basic** (16 GB RAM) or higher. | |
| ### One-time data upload (not in git β ~235 MB total) | |
| ```bash | |
| SPACE=Raapid/new-graph-visualization | |
| BASE="/media/anurag/Hard Disk/Graph New" | |
| hf upload $SPACE \ | |
| "$BASE/falkor_staging/concepts.parquet" falkor_staging/concepts.parquet \ | |
| "$BASE/falkor_staging/mrrel_edges.parquet" falkor_staging/mrrel_edges.parquet \ | |
| "$BASE/falkor_staging/hier_edges.parquet" falkor_staging/hier_edges.parquet \ | |
| "$BASE/graph_nodes.parquet" graph_nodes.parquet \ | |
| --repo-type space \ | |
| --commit-message "Add graph staging parquets" | |
| ``` | |
| ## Local Docker | |
| ```bash | |
| cd "/media/anurag/Hard Disk/Graph New" | |
| docker build -t new-graph-viz . | |
| docker run --rm --memory=16g -p 7860:7860 new-graph-viz | |
| ``` | |
| Open [http://localhost:7860](http://localhost:7860). | |
| Requires `falkor_staging/*.parquet` and `graph_nodes.parquet` in the build context (included if present; `bulk_csv/` is excluded via `.dockerignore`). | |
| ## Local dev (FalkorDB in separate container) | |
| ```bash | |
| docker run -d --name clinical-falkordb -p 6380:6379 --memory 10g falkordb/falkordb:latest | |
| export FALKORDB_PORT=6380 FALKORDB_GRAPH=clinical_graph | |
| python3 build_falkor_graph.py --skip-prepare --rebuild --falkor-port 6380 | |
| export PORT=8050 | |
| python3 app.py | |
| ``` | |
| ## Data | |
| | File | Role | | |
| |------|------| | |
| | `falkor_staging/concepts.parquet` | FalkorDB Concept nodes | | |
| | `falkor_staging/mrrel_edges.parquet` | MRREL semantic edges | | |
| | `falkor_staging/hier_edges.parquet` | HIER_ISA (from MRHIER) | | |
| | `graph_nodes.parquet` | Category metadata for sidebar filter | | |
| FalkorDB node count (**1,278,278**) matches edge-connected nodes in parquet (orphan nodes excluded at load time). | |
| ## Project layout | |
| ``` | |
| Graph New/ | |
| βββ app.py | |
| βββ graph_backend.py | |
| βββ Dockerfile | |
| βββ scripts/entrypoint.sh | |
| βββ falkor_load/ # GRAPH.BULK loader (container startup) | |
| βββ falkor_staging/ # staging parquet (upload to HF separately) | |
| βββ prepare_falkor_staging.py | |
| βββ build_falkor_graph.py # local load helper | |
| βββ graph_nodes.parquet | |
| βββ assets/ | |
| βββ requirements.txt | |
| ``` | |
| ## Commands | |
| ```bash | |
| # Setup | |
| uv venv .venv && source .venv/bin/activate | |
| uv pip install -r requirements.txt | |
| # Rebuild staging from raw parquet | |
| python3 prepare_falkor_staging.py --connected-only | |
| # Load FalkorDB locally | |
| FALKORDB_BULK_SOCKET_TIMEOUT_S=0 python3 build_falkor_graph.py --skip-prepare --rebuild --falkor-port 6380 | |
| # Run app | |
| FALKORDB_PORT=6380 FALKORDB_GRAPH=clinical_graph python3 app.py | |
| ``` | |