Skip to content

Commit 00e3916

Browse files
committed
Replace GitHub Issues with in-dashboard review system
Replace unreliable GitHub Issue templates with an in-dashboard review form system. Reviews are stored in browser localStorage and displayed immediately in each analysis tab, with aggregated statistics in the Audit tab. - Add review forms to each analysis tab - Store reviews in localStorage (persistent across sessions) - Display reviews immediately after submission - Add Audit tab with review statistics - Add JSON download for sharing reviews No external dependencies required - works entirely client-side.
1 parent 0577548 commit 00e3916

File tree

3 files changed

+530
-70
lines changed

3 files changed

+530
-70
lines changed

Graph Analysis/unified_analysis.py

Lines changed: 43 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,44 @@ def ensure_iterable_records(data: Any) -> List[Any]:
341341

342342
# ---------------- HTML Report Writer ----------------
343343

344-
def _review_button(method_name: str) -> str:
345-
"""Generate HTML for a review button linking to GitHub Issues."""
346-
# Use Markdown template - more reliable than YAML forms
347-
# Pre-fill method in body text so it appears in the template
348-
body_text = f"**Method:** {method_name}\n\n**File:** docs/index.html"
349-
# URL encode the body text properly
350-
encoded_body = urllib.parse.quote(body_text)
351-
352-
# Use Markdown template - GitHub handles these more reliably
353-
# For markdown templates, use filename WITHOUT extension
354-
url = f"https://github.com/SingularityNET-Archive/Graph-Python-scripts/issues/new?template=analysis_review&body={encoded_body}"
355-
356-
return f'<a href="{url}" class="review-button" target="_blank" title="Opens GitHub Issue with review form">Review This Analysis</a>'
344+
def _review_form(method_name: str) -> str:
345+
"""Generate HTML for an in-dashboard review form."""
346+
return f"""
347+
<div class="review-section">
348+
<h3>Review This Analysis</h3>
349+
<form id="review-form-{method_name}" class="review-form" onsubmit="submitReview(event, '{method_name}')">
350+
<div class="form-group">
351+
<label for="rating-{method_name}">Rating:</label>
352+
<select id="rating-{method_name}" name="rating" required>
353+
<option value="">Select a rating...</option>
354+
<option value="correct">Correct - The analysis results appear accurate</option>
355+
<option value="needs-review">Needs Review - The analysis may have issues</option>
356+
<option value="incorrect">Incorrect - The analysis results appear wrong</option>
357+
</select>
358+
</div>
359+
<div class="form-group">
360+
<label for="comment-{method_name}">Comments:</label>
361+
<textarea id="comment-{method_name}" name="comment" rows="4" placeholder="Provide your feedback, observations, or concerns about this analysis..." required></textarea>
362+
</div>
363+
<div class="form-group">
364+
<label for="reviewer-{method_name}">Your Name (optional):</label>
365+
<input type="text" id="reviewer-{method_name}" name="reviewer" placeholder="Anonymous">
366+
</div>
367+
<div class="form-group">
368+
<label for="suggestions-{method_name}">Suggestions (optional):</label>
369+
<textarea id="suggestions-{method_name}" name="suggestions" rows="3" placeholder="Optional: Suggested improvements, patches, or corrections..."></textarea>
370+
</div>
371+
<input type="hidden" name="method" value="{method_name}">
372+
<input type="hidden" name="file" value="docs/index.html">
373+
<button type="submit" class="submit-review-btn">Submit Review</button>
374+
</form>
375+
<div id="review-success-{method_name}" class="review-success" style="display: none;">
376+
<p>✓ Review submitted successfully! It will appear in the Audit tab.</p>
377+
<button onclick="downloadReviewJSON('{method_name}')" class="download-btn">Download Review as JSON</button>
378+
</div>
379+
<div id="reviews-list-{method_name}" class="reviews-list"></div>
380+
</div>
381+
"""
357382

358383

359384
def write_html_report(
@@ -428,7 +453,7 @@ def write_html_report(
428453
<!-- Co-attendance Degree Tab -->
429454
<div id="coattendance" class="tab-pane">
430455
<h2>Degree (Co-attendance) Analysis</h2>
431-
""" + _review_button("coattendance") + """
456+
""" + _review_form("coattendance") + """
432457
<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>
433458
434459
<h3>Interactive Network Visualization</h3>
@@ -608,50 +633,10 @@ def write_html_report(
608633
<!-- Audit Tab -->
609634
<div id="audit" class="tab-pane">
610635
<h2>Review Audit</h2>
611-
<p class="explanation">Community review scores and feedback for each analysis method.</p>
612-
613-
<div id="audit-loading" style="text-align: center; padding: 20px;">
614-
<p>Loading audit data...</p>
615-
</div>
616-
617-
<div id="audit-content" style="display: none;">
618-
<p id="audit-last-updated" class="explanation" style="font-weight: bold; margin-bottom: 20px;"></p>
619-
620-
<h3>Trust Scores by Method</h3>
621-
<p class="explanation">Percentage of reviews rated as "Correct" for each analysis method.</p>
622-
<table id="trust-scores-table">
623-
<thead>
624-
<tr><th>Method</th><th>Trust Score</th><th>Total Reviews</th><th>Correct</th><th>Incorrect</th><th>Needs Review</th></tr>
625-
</thead>
626-
<tbody id="trust-scores-body">
627-
</tbody>
628-
</table>
629-
630-
<h3>Rating Distribution</h3>
631-
<p class="explanation">Overall distribution of review ratings across all methods.</p>
632-
<div id="rating-chart-container" style="margin: 20px 0; text-align: center;">
633-
<canvas id="rating-chart" width="400" height="400"></canvas>
634-
</div>
635-
636-
<h3>Review Comments</h3>
637-
<p class="explanation">All review comments submitted by the community.</p>
638-
<table id="review-comments-table">
639-
<thead>
640-
<tr><th>Method</th><th>Rating</th><th>Comment</th><th>Author</th><th>Date</th><th>Issue</th></tr>
641-
</thead>
642-
<tbody id="review-comments-body">
643-
</tbody>
644-
</table>
645-
646-
<p style="margin-top: 20px;">
647-
<a href="audit/reviews.json" target="_blank" class="review-button">View Raw JSON Data</a>
648-
</p>
649-
</div>
650-
651-
<div id="audit-error" style="display: none; color: #d73a49; padding: 20px; background-color: #ffeef0; border-radius: 6px;">
652-
<p><strong>Error loading audit data:</strong> <span id="audit-error-message"></span></p>
653-
<p>This may be because no reviews have been submitted yet, or the data file doesn't exist.</p>
654-
</div>
636+
<p class="explanation">Community review scores and feedback for each analysis method. Reviews are stored locally in your browser and can also be loaded from the JSON file.</p>
637+
<p class="explanation" style="color: #586069; font-size: 0.9em; margin-top: 10px;">
638+
<strong>Note:</strong> Reviews are stored in your browser's localStorage. To share reviews or make them permanent, use the "Download Review as JSON" button and submit the JSON file to the repository.
639+
</p>
655640
</div>
656641
</div>
657642
</div>

0 commit comments

Comments
 (0)