Skip to content

Commit a79ef16

Browse files
committed
Replace YAML issue form with Markdown template
GitHub Issue Forms (YAML) not loading reliably. Replace with Markdown template that loads consistently via URL parameter. - Add markdown template with checkboxes for ratings - Update review button to use markdown template - Update audit script to parse markdown format - Maintain backwards compatibility with YAML format Markdown templates are more reliable and simpler to maintain.
1 parent 2f3b8a7 commit a79ef16

File tree

3 files changed

+72
-13
lines changed

3 files changed

+72
-13
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Analysis Review
3+
about: Review and provide feedback on graph analysis results
4+
title: "[Review] "
5+
labels: review
6+
---
7+
8+
## Analysis Method
9+
10+
**Method:** <!-- Replace with: coattendance, field-degree, path-structure, centrality, clustering, or components -->
11+
12+
**File:** docs/index.html
13+
14+
---
15+
16+
## Rating
17+
18+
Please select your rating:
19+
20+
- [ ] Correct - The analysis results appear accurate
21+
- [ ] Needs Review - The analysis may have issues that require investigation
22+
- [ ] Incorrect - The analysis results appear incorrect or misleading
23+
24+
## Comments
25+
26+
<!-- Provide your feedback, observations, or concerns about this analysis -->
27+
28+
Please include:
29+
- What you observed
30+
- Any concerns or issues
31+
- What aspects you're reviewing
32+
33+
---
34+
35+
## Suggestions (Optional)
36+
37+
<!-- If you have specific suggestions, patches, or corrections, please provide them here -->
38+
39+
Optional improvements:
40+
- Suggested code changes
41+
- Data corrections
42+
- Algorithm improvements
43+

Graph Analysis/unified_analysis.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,17 @@ def ensure_iterable_records(data: Any) -> List[Any]:
343343

344344
def _review_button(method_name: str) -> str:
345345
"""Generate HTML for a review button linking to GitHub Issues."""
346-
# GitHub Issue Forms: link to issues/new page
347-
# If template parameter works, it will load automatically
348-
# Otherwise, users will see template chooser and can select "Analysis Review"
349-
# Include method info in body as pre-fill for reference
350-
body_text = f"**Method:** {method_name}\n\n**File:** docs/index.html\n\n---\n\n"
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"
351349
# URL encode the body text properly
352350
encoded_body = urllib.parse.quote(body_text)
353351

354-
# Use template parameter (GitHub's documented format for Issue Forms)
355-
# Template name without .yml extension
352+
# Use Markdown template - GitHub handles these more reliably
353+
# For markdown templates, use filename WITHOUT extension
356354
url = f"https://github.com/SingularityNET-Archive/Graph-Python-scripts/issues/new?template=analysis_review&body={encoded_body}"
357355

358-
return f'<a href="{url}" class="review-button" target="_blank" title="Opens GitHub Issue template. If template doesn\'t load automatically, select \'Analysis Review\' from the template chooser.">Review This Analysis</a>'
356+
return f'<a href="{url}" class="review-button" target="_blank" title="Opens GitHub Issue with review form">Review This Analysis</a>'
359357

360358

361359
def write_html_report(

Scripts/audit_reviews.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,24 @@
4646

4747

4848
def extract_method_from_body(body: str) -> Optional[str]:
49-
"""Extract method name from issue body (template field or query param)."""
49+
"""Extract method name from issue body (markdown template or query param)."""
5050
if not body:
5151
return None
5252

53-
# Try to find method from template field (dropdown)
53+
# Try to find method from markdown template format: **Method:** method_name
54+
method_match = re.search(r'\*\*Method:\*\*\s*([^\n]+)', body, re.IGNORECASE)
55+
if method_match:
56+
method = method_match.group(1).strip().lower()
57+
# Remove markdown code blocks and normalize
58+
method = method.replace("`", "").replace("<!--", "").replace("-->", "").strip()
59+
method = method.replace(" ", "-").replace("_", "-")
60+
if method in METHODS:
61+
return method
62+
63+
# Try to find from template field format (old YAML form): ### Analysis Method
5464
method_match = re.search(r'###\s*Analysis Method\s*\n\s*([^\n]+)', body, re.IGNORECASE)
5565
if method_match:
5666
method = method_match.group(1).strip().lower()
57-
# Normalize common variations
5867
method = method.replace(" ", "-").replace("_", "-")
5968
if method in METHODS:
6069
return method
@@ -82,11 +91,20 @@ def extract_rating_from_labels(labels: List[Any]) -> Optional[str]:
8291

8392

8493
def extract_rating_from_body(body: str) -> Optional[str]:
85-
"""Extract rating from issue body (template dropdown field)."""
94+
"""Extract rating from issue body (markdown template checkboxes)."""
8695
if not body:
8796
return None
8897

89-
# Try to find rating from template field (dropdown)
98+
# Try to find rating from markdown template checkboxes
99+
# Format: - [x] Correct or - [x] Needs Review or - [x] Incorrect
100+
if re.search(r'-\s*\[x\]\s*Correct', body, re.IGNORECASE):
101+
return "correct"
102+
elif re.search(r'-\s*\[x\]\s*Incorrect', body, re.IGNORECASE):
103+
return "incorrect"
104+
elif re.search(r'-\s*\[x\]\s*Needs Review', body, re.IGNORECASE):
105+
return "needs-review"
106+
107+
# Fallback: Try to find rating from old template field (dropdown)
90108
rating_match = re.search(r'###\s*Rating\s*\n\s*([^\n]+)', body, re.IGNORECASE)
91109
if rating_match:
92110
rating = rating_match.group(1).strip()

0 commit comments

Comments
 (0)