Skip to content

Commit 5223efa

Browse files
committed
Implement plan to organise repo
1 parent 0b239e2 commit 5223efa

File tree

7 files changed

+180
-81
lines changed

7 files changed

+180
-81
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Path Analysis
2+
3+
Analyze JSON structure and field relationships.
4+
5+
## JSON Path Structure
6+
- Script: `path_analysis_report.py`
7+
- Output: `reports/path_analysis_report.md`
8+
- Run:
9+
```bash
10+
python "Graph Analysis/Path_Analysis/path_analysis_report.py"
11+
```
12+
13+
## Field Centrality (Co-occurrence)
14+
- Script: `Centrality_Analysis/json_centrality_analysis.py`
15+
- Output: `reports/centrality_analysis_report.md`
16+
- Run:
17+
```bash
18+
python "Graph Analysis/Path_Analysis/Centrality_Analysis/json_centrality_analysis.py"
19+
```
20+
21+
Reports are written to the `reports/` directory.

Graph Analysis/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Graph Analysis
2+
3+
Analysis tools operating on meeting JSON data to derive structure and relationships.
4+
5+
## Degree Analysis (Co-attendance)
6+
Script: `Degree_Analysis/degree_analysis_to_md.py`
7+
- Finds participant string lists recursively and builds an undirected co-attendance graph.
8+
- Computes degree per node and distribution, and writes a Markdown report.
9+
- Output: `Graph Analysis/Degree_Analysis/degree_analysis_report.md`
10+
- Run:
11+
```bash
12+
python "Graph Analysis/Degree_Analysis/degree_analysis_to_md.py"
13+
```
14+
15+
## Path Analysis
16+
Script: `Path_Analysis/path_analysis_report.py`
17+
- Extracts all JSON paths (dot/array notation), computes depth statistics, and writes a report.
18+
- Output: `reports/path_analysis_report.md`
19+
- Run:
20+
```bash
21+
python "Graph Analysis/Path_Analysis/path_analysis_report.py"
22+
```
23+
24+
## Centrality (Field Co-occurrence)
25+
Script: `Path_Analysis/Centrality_Analysis/json_centrality_analysis.py`
26+
- Builds a field co-occurrence graph and computes degree/betweenness/closeness/eigenvector centralities.
27+
- Output: `reports/centrality_analysis_report.md`
28+
- Run:
29+
```bash
30+
python "Graph Analysis/Path_Analysis/Centrality_Analysis/json_centrality_analysis.py"
31+
```
32+
33+
See `reports/README.md` for example outputs.

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
PY=python
2+
3+
setup:
4+
python3 -m venv .venv
5+
. .venv/bin/activate && $(PY) -m pip install --upgrade pip && pip install -r requirements.txt
6+
7+
graphs:
8+
$(PY) Scripts/Nodes-Edges.py
9+
$(PY) Scripts/Nodes-Edges2.py
10+
11+
gexf:
12+
$(PY) Scripts/GEXF-export.py
13+
14+
summary:
15+
$(PY) Scripts/Import-JSON.py
16+
17+
degree-analysis:
18+
$(PY) "Graph Analysis/Degree_Analysis/degree_analysis_to_md.py"
19+
20+
path-report:
21+
$(PY) "Graph Analysis/Path_Analysis/path_analysis_report.py"
22+
23+
centrality-report:
24+
$(PY) "Graph Analysis/Path_Analysis/Centrality_Analysis/json_centrality_analysis.py"

README.md

Lines changed: 35 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,58 @@
11
# Graph-Python-scripts
22

3-
This repository contains Python scripts for parsing meeting summaries and visualizing them as directed graphs using NetworkX and Matplotlib, plus exporting to GEXF for use in Gephi.
4-
5-
## Contents
6-
- `Scripts/Nodes-Edges.py`: Build a directed graph from a single meeting summary and save `graph.png`.
7-
- `Scripts/Nodes-Edges2.py`: Build a directed graph from multiple meeting summaries and save `graph2.png`.
8-
- `Scripts/GEXF-export.py`: Build a comprehensive directed graph and export `all_workgroups_graph_sanitized.gexf`.
9-
- `Scripts/count.py`: Print top-level workgroup names from the remote JSON.
10-
- `Scripts/Import-JSON.py`: Generate `workgroup_meetings_summary.txt` with counts and meeting listings per workgroup.
11-
- `graph.png`, `graph2.png`: Example rendered graphs.
12-
- `Scripts/all_workgroups_graph_sanitized.gexf`: Example GEXF export ready for Gephi.
13-
14-
## Prerequisites
15-
- Python 3.9+
16-
- Packages:
17-
- `requests`
18-
- `networkx`
19-
- `matplotlib`
20-
21-
Install packages:
3+
Scripts to fetch meeting summaries, generate graphs, and produce analysis reports.
224

5+
## Quickstart
6+
1. Create a virtual environment and install dependencies:
237
```bash
24-
pip install requests networkx matplotlib
8+
python3 -m venv .venv
9+
source .venv/bin/activate
10+
python -m pip install --upgrade pip
11+
pip install -r requirements.txt
2512
```
2613

27-
## Data Source
28-
All scripts fetch JSON from a public URL:
29-
30-
- `https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json`
31-
32-
The scripts handle both top-level list and dict JSON structures.
33-
34-
## Usage
35-
Run scripts from the project root or the `Scripts/` directory.
36-
37-
### 1) Build a graph from a single meeting: `Scripts/Nodes-Edges.py`
38-
- Purpose: Parse one meeting object and produce a directed graph of relationships among workgroup, meeting, people, documents, agenda items, action items, decision items, tags, and emotions.
39-
- Output: Saves an image `graph.png` in the project root.
40-
41-
Command:
14+
2. Run common tasks:
15+
- Single-meeting graph → saves `graph.png`:
4216
```bash
4317
python Scripts/Nodes-Edges.py
4418
```
45-
46-
### 2) Build a graph from multiple meetings: `Scripts/Nodes-Edges2.py`
47-
- Purpose: Iterate all meetings/workgroups and build a combined directed graph.
48-
- Output: Saves `graph2.png` in the project root.
49-
50-
Command:
19+
- Multi-meeting graph → saves `graph2.png`:
5120
```bash
5221
python Scripts/Nodes-Edges2.py
5322
```
54-
55-
### 3) Export a GEXF for Gephi: `Scripts/GEXF-export.py`
56-
- Purpose: Build a comprehensive, sanitized directed graph across all workgroups and export to GEXF.
57-
- Output: Writes `Scripts/all_workgroups_graph_sanitized.gexf`.
58-
59-
Notes:
60-
- Ensures node IDs are strings and unique.
61-
- Sanitizes node/edge attributes to primitive types for GEXF compatibility.
62-
- Emits diagnostics (counts, sample nodes) before/after sanitization.
63-
64-
Command:
23+
- Export Gephi file → writes `Scripts/all_workgroups_graph_sanitized.gexf`:
6524
```bash
6625
python Scripts/GEXF-export.py
6726
```
68-
69-
Open the GEXF in Gephi to explore the network.
70-
71-
### 4) Quick inspection of workgroups: `Scripts/count.py`
72-
- Purpose: Print the `workgroup` field for each top-level item in the JSON (list or dict).
73-
74-
Command:
27+
- Workgroup summary → writes `Scripts/workgroup_meetings_summary.txt`:
7528
```bash
76-
python Scripts/count.py
29+
python Scripts/Import-JSON.py
7730
```
78-
79-
### 5) Generate a text summary: `Scripts/Import-JSON.py`
80-
- Purpose: Create `workgroup_meetings_summary.txt` listing counts per workgroup and meeting info (date + title/type).
81-
- Output: `Scripts/workgroup_meetings_summary.txt`.
82-
83-
Command:
31+
- Degree (co-attendance) analysis → writes `Graph Analysis/Degree_Analysis/degree_analysis_report.md`:
8432
```bash
85-
python Scripts/Import-JSON.py
33+
python "Graph Analysis/Degree_Analysis/degree_analysis_to_md.py"
34+
```
35+
- JSON path structure report → writes `reports/path_analysis_report.md`:
36+
```bash
37+
python "Graph Analysis/Path_Analysis/path_analysis_report.py"
38+
```
39+
- Field centrality report → writes `reports/centrality_analysis_report.md`:
40+
```bash
41+
python "Graph Analysis/Path_Analysis/Centrality_Analysis/json_centrality_analysis.py"
8642
```
8743

88-
## Outputs
89-
- `graph.png`: Single-meeting graph.
90-
- `graph2.png`: Multi-meeting graph.
91-
- `Scripts/all_workgroups_graph_sanitized.gexf`: GEXF for Gephi.
92-
- `Scripts/workgroup_meetings_summary.txt`: Human-readable summary.
44+
## Repository Map
45+
- `Scripts/` — data fetching and basic graph generation. See `Scripts/README.md`.
46+
- `Graph Analysis/` — analysis utilities (degree, path, centrality). See `Graph Analysis/README.md`.
47+
- `reports/` — generated Markdown reports. See `reports/README.md`.
9348

94-
To preview generated images on macOS/Linux:
49+
## Data Source
50+
All scripts read from a shared public JSON:
51+
`https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json`
9552

96-
```bash
97-
$BROWSER graph.png
98-
$BROWSER graph2.png
99-
```
53+
## Outputs
54+
- `graph.png`, `graph2.png` — rendered graphs
55+
- `Scripts/all_workgroups_graph_sanitized.gexf` — Gephi import
56+
- Markdown reports in `reports/`
10057

101-
## Notes
102-
- All scripts are designed to run headlessly; graphs are saved to files instead of opening GUI windows.
103-
- The code uses defensive accessors and type checks to tolerate missing or differently shaped fields.
104-
- For reproducible layouts, the drawing functions use a fixed seed for `spring_layout` where applicable.
58+
Notes: Scripts run headlessly and save files to disk; images can be opened via your OS default viewer.

Scripts/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Scripts
2+
3+
Utilities for fetching meeting data and generating graphs/exports.
4+
5+
## Nodes-Edges.py
6+
- Purpose: Build a directed graph from a single meeting entry and save an image.
7+
- Output: `graph.png`
8+
- Run:
9+
```bash
10+
python Scripts/Nodes-Edges.py
11+
```
12+
13+
## Nodes-Edges2.py
14+
- Purpose: Build a combined directed graph across all meetings and save an image.
15+
- Output: `graph2.png`
16+
- Run:
17+
```bash
18+
python Scripts/Nodes-Edges2.py
19+
```
20+
21+
## GEXF-export.py
22+
- Purpose: Build a comprehensive directed graph and export to GEXF (Gephi).
23+
- Output: `Scripts/all_workgroups_graph_sanitized.gexf`
24+
- Run:
25+
```bash
26+
python Scripts/GEXF-export.py
27+
```
28+
29+
## Import-JSON.py
30+
- Purpose: Generate a text summary of workgroups and meetings.
31+
- Output: `Scripts/workgroup_meetings_summary.txt`
32+
- Run:
33+
```bash
34+
python Scripts/Import-JSON.py
35+
```
36+
37+
## count.py
38+
- Purpose: Print the `workgroup` value for each top-level JSON item.
39+
- Run:
40+
```bash
41+
python Scripts/count.py
42+
```
43+
44+
All scripts fetch JSON from the shared data source referenced in the top-level README.

reports/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Reports
2+
3+
Generated Markdown reports and their sources.
4+
5+
- `workgroup_analysis_report.md`
6+
- Source: `Scripts/Import-JSON.py` (summary of workgroups and meetings)
7+
8+
- `path_analysis_report.md`
9+
- Source: `Graph Analysis/Path_Analysis/path_analysis_report.py`
10+
11+
- `centrality_analysis_report.md`
12+
- Source: `Graph Analysis/Path_Analysis/Centrality_Analysis/json_centrality_analysis.py`
13+
14+
- `degree_analysis_by_field_with_interpretation.md`
15+
- Source: Analysis variants under `Graph Analysis/`
16+
17+
- `Graph Analysis/Degree_Analysis/degree_analysis_report.md`
18+
- Source: `Graph Analysis/Degree_Analysis/degree_analysis_to_md.py`
19+
20+
Re-run the corresponding scripts to regenerate any report.

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
requests>=2.32
2+
networkx>=3.2
3+
matplotlib>=3.8

0 commit comments

Comments
 (0)