Skip to content

Commit fbf956e

Browse files
committed
Implement community review and audit system
Add GitHub Issues-based review system for validating graph analysis results: - Review buttons in dashboard linking to issue template - Python audit script to collect reviews via GitHub API - GitHub Action for nightly review aggregation - Audit tab displaying trust scores and review comments - Documentation for contributors and reviewers Enables community validation of analysis results with automated metrics display.
1 parent caf32b6 commit fbf956e

File tree

10 files changed

+723
-3
lines changed

10 files changed

+723
-3
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Analysis Review
2+
description: Review and provide feedback on graph analysis results
3+
title: "[Review] "
4+
labels: ["review"]
5+
body:
6+
- type: dropdown
7+
id: method
8+
attributes:
9+
label: Analysis Method
10+
description: Which analysis method are you reviewing?
11+
options:
12+
- coattendance
13+
- field-degree
14+
- path-structure
15+
- centrality
16+
- clustering
17+
- components
18+
default: 0
19+
validations:
20+
required: true
21+
22+
- type: radio
23+
id: rating
24+
attributes:
25+
label: Rating
26+
description: How would you rate the accuracy of this analysis?
27+
options:
28+
- label: Correct
29+
value: correct
30+
- label: Needs Review
31+
value: needs-review
32+
- label: Incorrect
33+
value: incorrect
34+
validations:
35+
required: true
36+
37+
- type: textarea
38+
id: comment
39+
attributes:
40+
label: Comments
41+
description: Please provide your feedback, observations, or concerns about this analysis
42+
placeholder: |
43+
Example:
44+
- The results look accurate based on my understanding
45+
- I noticed an issue with...
46+
- Suggestion for improvement...
47+
validations:
48+
required: true
49+
50+
- type: textarea
51+
id: suggestions
52+
attributes:
53+
label: Suggestions (Optional)
54+
description: If you have specific suggestions, patches, or JSON corrections, please provide them here
55+
placeholder: |
56+
Optional JSON/patch suggestions:
57+
- Suggested code changes
58+
- Data corrections
59+
- Algorithm improvements
60+
61+
- type: input
62+
id: file
63+
attributes:
64+
label: File Reference (Auto-filled)
65+
description: The file being reviewed (will be auto-filled from the review button)
66+
placeholder: docs/index.html
67+
value: docs/index.html

.github/workflows/review_audit.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Review Audit Collection
2+
3+
on:
4+
schedule:
5+
# Run nightly at 2 AM UTC
6+
- cron: '0 2 * * *'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
collect-reviews:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write
15+
issues: read
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.x'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install PyGithub>=2.1.0
32+
33+
- name: Run audit script
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
python scripts/audit_reviews.py
38+
39+
- name: Commit and push if changed
40+
run: |
41+
git config --local user.email "[email protected]"
42+
git config --local user.name "GitHub Action"
43+
git add docs/audit/reviews.json
44+
git diff --staged --quiet || (git commit -m "Auto-update audit reviews [skip ci]" && git push)
45+

CONTRIBUTING.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributing to Graph-Python-scripts
2+
3+
Thank you for your interest in contributing! This repository uses a community review system to validate graph analysis results.
4+
5+
## Submitting Reviews
6+
7+
Reviews help ensure the accuracy and reliability of graph analysis results. Anyone can submit a review using GitHub Issues.
8+
9+
### Quick Start
10+
11+
1. **Visit the Dashboard**
12+
- Open the HTML dashboard: https://singularitynet-archive.github.io/Graph-Python-scripts/
13+
- Or open `docs/index.html` locally in your browser
14+
15+
2. **Navigate to an Analysis**
16+
- Click on any analysis tab (e.g., "Co-attendance Degree", "Field Degree")
17+
- Review the results displayed
18+
19+
3. **Submit a Review**
20+
- Click the **"Review This Analysis"** button at the top of the section
21+
- This opens a GitHub Issue template pre-filled with the method name
22+
- Fill out the form:
23+
- **Rating**: Select "Correct", "Needs Review", or "Incorrect"
24+
- **Comments**: Provide your feedback, observations, or concerns
25+
- **Suggestions** (optional): Include specific improvements, patches, or corrections
26+
27+
4. **Submit the Issue**
28+
- Your review will be automatically tagged with the `review` label
29+
- It will be collected by the nightly audit script and displayed in the Audit tab
30+
31+
### What to Review
32+
33+
Focus on:
34+
- **Accuracy**: Do the results match your understanding of the data?
35+
- **Completeness**: Are important patterns or relationships captured?
36+
- **Clarity**: Are the visualizations and tables clear and interpretable?
37+
- **Methodology**: Are the analysis methods appropriate for the questions being answered?
38+
39+
### Review Labels
40+
41+
When you submit a review, you should select one rating label:
42+
- `correct` - The analysis results appear accurate
43+
- `needs-review` - The analysis may have issues that require investigation
44+
- `incorrect` - The analysis results appear incorrect or misleading
45+
46+
### Review Best Practices
47+
48+
- **Be Specific**: Include details about what you observed or what concerns you
49+
- **Be Constructive**: If reporting issues, suggest how they might be addressed
50+
- **Reference Data**: If possible, cite specific examples from the data
51+
- **Be Respectful**: Maintain a respectful and collaborative tone
52+
53+
### Viewing Review Statistics
54+
55+
Check the **"Audit"** tab in the dashboard to see:
56+
- Trust scores aggregated across all reviews
57+
- Distribution of ratings
58+
- All review comments from the community
59+
60+
## Code Contributions
61+
62+
If you want to contribute code improvements:
63+
64+
1. Fork the repository
65+
2. Create a feature branch
66+
3. Make your changes
67+
4. Test thoroughly
68+
5. Submit a pull request with a clear description
69+
70+
## Questions?
71+
72+
- Check [REVIEWING.md](REVIEWING.md) for details about how the audit system works
73+
- Open an issue for questions or discussions
74+

Graph Analysis/unified_analysis.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ def ensure_iterable_records(data: Any) -> List[Any]:
340340

341341
# ---------------- HTML Report Writer ----------------
342342

343+
def _review_button(method_name: str) -> str:
344+
"""Generate HTML for a review button linking to GitHub Issues."""
345+
url = f"https://github.com/SingularityNET-Archive/Graph-Python-scripts/issues/new?template=analysis_review.yml&method={method_name}&file=docs/index.html"
346+
return f'<a href="{url}" class="review-button" target="_blank">Review This Analysis</a>'
347+
348+
343349
def write_html_report(
344350
output_file: str,
345351
timestamp: str,
@@ -394,6 +400,7 @@ def write_html_report(
394400
<button class="tab-button" onclick="showTab('centrality')">Centrality</button>
395401
<button class="tab-button" onclick="showTab('clustering')">Clustering</button>
396402
<button class="tab-button" onclick="showTab('components')">Components</button>
403+
<button class="tab-button" onclick="showTab('audit')">Audit</button>
397404
</div>
398405
399406
<div class="tab-content">
@@ -411,6 +418,7 @@ def write_html_report(
411418
<!-- Co-attendance Degree Tab -->
412419
<div id="coattendance" class="tab-pane">
413420
<h2>Degree (Co-attendance) Analysis</h2>
421+
""" + _review_button("coattendance") + """
414422
<p class="explanation">People are connected if they attend the same meeting; a person's degree is how many unique people they co-attended with.</p>
415423
416424
<h3>Interactive Network Visualization</h3>
@@ -452,6 +460,7 @@ def write_html_report(
452460
<!-- Field Degree Tab -->
453461
<div id="field-degree" class="tab-pane">
454462
<h2>JSON Field Degree Analysis</h2>
463+
""" + _review_button("field-degree") + """
455464
<p class="explanation">Fields are connected when they appear together inside the same JSON object; a field's degree is the number of distinct fields it co-occurs with.</p>
456465
457466
<h3>Top Fields by Degree</h3>
@@ -485,6 +494,7 @@ def write_html_report(
485494
<!-- Path Structure Tab -->
486495
<div id="path-structure" class="tab-pane">
487496
<h2>JSON Path Structure Analysis</h2>
497+
""" + _review_button("path-structure") + """
488498
<p class="explanation">Each JSON path represents a unique nested route (keys/array indices); depth shows how deeply information is nested.</p>
489499
490500
<ul class="summary-list">
@@ -518,6 +528,7 @@ def write_html_report(
518528
<!-- Centrality Tab -->
519529
<div id="centrality" class="tab-pane">
520530
<h2>Field Centrality (Co-occurrence)</h2>
531+
""" + _review_button("centrality") + """
521532
<p class="explanation">Centrality scores highlight fields that are well-connected (degree), act as bridges (betweenness), are close to others (closeness), or connect to other influential fields (eigenvector).</p>
522533
523534
<table>
@@ -543,6 +554,7 @@ def write_html_report(
543554
<!-- Clustering Tab -->
544555
<div id="clustering" class="tab-pane">
545556
<h2>Clustering (Field Co-occurrence Graph)</h2>
557+
""" + _review_button("clustering") + """
546558
<p class="explanation">Clustering measures how tightly a field's neighbors are connected to each other (higher means more triads).</p>
547559
548560
<p><strong>Average Clustering Coefficient:</strong> """)
@@ -567,6 +579,7 @@ def write_html_report(
567579
<!-- Connected Components Tab -->
568580
<div id="components" class="tab-pane">
569581
<h2>Connected Components (Field Co-occurrence Graph)</h2>
582+
""" + _review_button("components") + """
570583
<p class="explanation">Components are groups of fields that are all reachable from each other; multiple components suggest separate substructures.</p>
571584
572585
<ul class="summary-list">
@@ -581,6 +594,55 @@ def write_html_report(
581594
f.write(f" <li>{n}</li>\n")
582595
f.write(""" </ul>
583596
</div>
597+
598+
<!-- Audit Tab -->
599+
<div id="audit" class="tab-pane">
600+
<h2>Review Audit</h2>
601+
<p class="explanation">Community review scores and feedback for each analysis method.</p>
602+
603+
<div id="audit-loading" style="text-align: center; padding: 20px;">
604+
<p>Loading audit data...</p>
605+
</div>
606+
607+
<div id="audit-content" style="display: none;">
608+
<p id="audit-last-updated" class="explanation" style="font-weight: bold; margin-bottom: 20px;"></p>
609+
610+
<h3>Trust Scores by Method</h3>
611+
<p class="explanation">Percentage of reviews rated as "Correct" for each analysis method.</p>
612+
<table id="trust-scores-table">
613+
<thead>
614+
<tr><th>Method</th><th>Trust Score</th><th>Total Reviews</th><th>Correct</th><th>Incorrect</th><th>Needs Review</th></tr>
615+
</thead>
616+
<tbody id="trust-scores-body">
617+
</tbody>
618+
</table>
619+
620+
<h3>Rating Distribution</h3>
621+
<p class="explanation">Overall distribution of review ratings across all methods.</p>
622+
<div id="rating-chart-container" style="margin: 20px 0; text-align: center;">
623+
<canvas id="rating-chart" width="400" height="400"></canvas>
624+
</div>
625+
626+
<h3>Review Comments</h3>
627+
<p class="explanation">All review comments submitted by the community.</p>
628+
<table id="review-comments-table">
629+
<thead>
630+
<tr><th>Method</th><th>Rating</th><th>Comment</th><th>Author</th><th>Date</th><th>Issue</th></tr>
631+
</thead>
632+
<tbody id="review-comments-body">
633+
</tbody>
634+
</table>
635+
636+
<p style="margin-top: 20px;">
637+
<a href="audit/reviews.json" target="_blank" class="review-button">View Raw JSON Data</a>
638+
</p>
639+
</div>
640+
641+
<div id="audit-error" style="display: none; color: #d73a49; padding: 20px; background-color: #ffeef0; border-radius: 6px;">
642+
<p><strong>Error loading audit data:</strong> <span id="audit-error-message"></span></p>
643+
<p>This may be because no reviews have been submitted yet, or the data file doesn't exist.</p>
644+
</div>
645+
</div>
584646
</div>
585647
</div>
586648
@@ -607,6 +669,7 @@ def write_html_report(
607669
], ensure_ascii=False) + """
608670
};
609671
</script>
672+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script>
610673
<script src="script.js"></script>
611674
</body>
612675
</html>

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,30 @@ All scripts read from a shared public JSON:
5858
- `graph.png`, `graph2.png` — rendered graphs
5959
- `Scripts/all_workgroups_graph_sanitized.gexf` — Gephi import
6060
- Markdown reports in `reports/`
61+
- HTML dashboard at `docs/index.html` (GitHub Pages)
6162

6263
Notes: Scripts run headlessly and save files to disk; images can be opened via your OS default viewer.
64+
65+
## Community Review System
66+
67+
This repository includes a community review system to validate graph analysis results. You can review analysis results and provide feedback through GitHub Issues.
68+
69+
### How to Review
70+
71+
1. Visit the [HTML dashboard](https://singularitynet-archive.github.io/Graph-Python-scripts/) (or open `docs/index.html` locally)
72+
2. Navigate to any analysis tab (Co-attendance Degree, Field Degree, Path Structure, etc.)
73+
3. Click the **"Review This Analysis"** button at the top of the section
74+
4. Fill out the review form with:
75+
- Your rating (Correct / Needs Review / Incorrect)
76+
- Comments and feedback
77+
- Optional suggestions for improvements
78+
5. Submit the issue - it will be automatically tagged with the `review` label
79+
80+
### View Review Results
81+
82+
- Click on the **"Audit"** tab in the dashboard to see:
83+
- Trust scores for each analysis method
84+
- Rating distribution charts
85+
- All review comments from the community
86+
87+
Reviews are collected nightly via GitHub Actions and displayed in the audit dashboard. See [CONTRIBUTING.md](CONTRIBUTING.md) and [REVIEWING.md](REVIEWING.md) for more details.

0 commit comments

Comments
 (0)