Skip to content

Commit 6a4cd32

Browse files
committed
Initial commit: EFECT repository
0 parents  commit 6a4cd32

97 files changed

Lines changed: 6048 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Generate coverage report HTML and update README.md
4+
"""
5+
import os
6+
import re
7+
import csv
8+
from pathlib import Path
9+
from collections import defaultdict
10+
11+
def count_rule_cards():
12+
"""Count total rule cards and unverified ones"""
13+
rule_cards_dir = Path("rule_cards")
14+
total = 0
15+
unverified = 0
16+
17+
for mdc_file in rule_cards_dir.glob("*.mdc"):
18+
# Skip the spec file
19+
if mdc_file.name == "SPEC_RuleCard_v1.mdc":
20+
continue
21+
22+
total += 1
23+
24+
# Read file and check research_verified
25+
try:
26+
content = mdc_file.read_text(encoding='utf-8')
27+
# Look for research_verified: no (case-insensitive)
28+
if re.search(r'research_verified:\s*no', content, re.IGNORECASE):
29+
unverified += 1
30+
except Exception as e:
31+
print(f"Error reading {mdc_file}: {e}")
32+
33+
return total, unverified
34+
35+
def count_research_by_module():
36+
"""Count research techniques by module_title from CSV"""
37+
csv_path = Path("research/research_all_techniques.csv")
38+
module_counts = defaultdict(int)
39+
40+
if not csv_path.exists():
41+
print(f"Warning: {csv_path} not found")
42+
return module_counts
43+
44+
try:
45+
with open(csv_path, 'r', encoding='utf-8') as f:
46+
reader = csv.DictReader(f)
47+
for row in reader:
48+
module_title = row.get('module_title', '').strip()
49+
if module_title:
50+
module_counts[module_title] += 1
51+
except Exception as e:
52+
print(f"Error reading CSV: {e}")
53+
54+
return module_counts
55+
56+
def generate_html(total_rules, unverified_rules, module_counts):
57+
"""Generate HTML coverage report"""
58+
verified_rules = total_rules - unverified_rules
59+
60+
# Calculate coverage percentage (placeholder for now)
61+
coverage_pct = 0
62+
63+
html = f"""<!-- COVERAGE:START -->
64+
65+
Coverage: {coverage_pct}%
66+
67+
<h3>Manually verified:</h3>
68+
69+
<p><strong>Rules:</strong> {verified_rules}/{total_rules} (based on yaml research_verified: no)</p>
70+
71+
<p><strong>Research:</strong> (based on research_all_techniques.csv)</p>
72+
<ul>
73+
"""
74+
75+
# Sort modules by title for consistent output
76+
for module_title in sorted(module_counts.keys()):
77+
count = module_counts[module_title]
78+
html += f" <li>{module_title}: 0/{count}</li>\n"
79+
80+
html += """</ul>
81+
82+
<!-- COVERAGE:END -->"""
83+
84+
return html
85+
86+
def update_readme(html_content):
87+
"""Update README.md with coverage report"""
88+
readme_path = Path("README.md")
89+
90+
if not readme_path.exists():
91+
print("Warning: README.md not found, creating it")
92+
readme_path.write_text(f"# EFECT\n\n{html_content}\n", encoding='utf-8')
93+
return
94+
95+
content = readme_path.read_text(encoding='utf-8')
96+
97+
# Pattern to match the coverage section
98+
pattern = r'<!-- COVERAGE:START -->.*?<!-- COVERAGE:END -->'
99+
100+
if re.search(pattern, content, re.DOTALL):
101+
# Replace existing coverage section
102+
content = re.sub(pattern, html_content, content, flags=re.DOTALL)
103+
else:
104+
# Append to end of file
105+
content += f"\n\n{html_content}\n"
106+
107+
readme_path.write_text(content, encoding='utf-8')
108+
print("Updated README.md with coverage report")
109+
110+
def main():
111+
print("Generating coverage report...")
112+
113+
# Count rule cards
114+
total_rules, unverified_rules = count_rule_cards()
115+
print(f"Total rules: {total_rules}, Unverified: {unverified_rules}")
116+
117+
# Count research by module
118+
module_counts = count_research_by_module()
119+
print(f"Found {len(module_counts)} modules in research CSV")
120+
121+
# Generate HTML
122+
html = generate_html(total_rules, unverified_rules, module_counts)
123+
124+
# Update README
125+
update_readme(html)
126+
127+
print("Coverage report generated successfully")
128+
129+
if __name__ == "__main__":
130+
main()
131+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Generate Coverage Report
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
coverage:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Generate Coverage Report
23+
run: |
24+
python .github/scripts/generate_coverage.py
25+
26+
- name: Commit coverage report
27+
run: |
28+
git config --local user.email "action@github.com"
29+
git config --local user.name "GitHub Action"
30+
git add README.md
31+
if ! git diff --staged --quiet; then
32+
git commit -m "Update coverage report [skip ci]"
33+
git push
34+
else
35+
echo "No changes to commit"
36+
fi
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# OS files
2+
.DS_Store
3+
.DS_Store?
4+
._*
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db
9+
desktop.ini
10+
11+
# Editor files
12+
.vscode/
13+
.idea/
14+
*.swp
15+
*.swo
16+
*~
17+
.project
18+
.classpath
19+
.settings/
20+
21+
# Temporary files
22+
*.tmp
23+
*.log
24+
*.bak
25+
*.cache
26+
27+
# Study logs
28+
# study_logs/logs/*.md
29+
# study_logs/logs/*.json
30+
31+
# Python
32+
__pycache__/
33+
*.py[cod]
34+
*$py.class
35+
*.so
36+
.Python
37+
venv/
38+
env/
39+
ENV/
40+
41+
# Node
42+
node_modules/
43+
npm-debug.log
44+
yarn-error.log
45+
46+
# Environment variables
47+
.env
48+
.env.local
49+
.env.*.local
50+

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributing
2+
3+
Contributions are welcome! This is an experimental project, so feel free to:
4+
5+
- **Check sources** or improve existing content
6+
- **Improve documentation** or examples
7+
- **Report issues** or suggest improvements
8+
- **Share your experiments** and findings
9+
- **Raise issues** if you spot problems, errors, or inconsistencies
10+
11+
## Special Requests
12+
13+
- **Format Migration**: We're planning to migrate from `.mdc` to `.yaml`/`.json` and are open to better system/spec suggestions
14+
- **Research Fact-Checking**: We're looking for researchers and interested to fact-check files! If you have expertise in ADHD interventions, please help verify the research content.
15+
16+
## How to Contribute
17+
18+
1. Fork the repo
19+
2. Make your changes
20+
3. Verify your sources (especially for research content)
21+
4. Submit a pull request
22+
23+
## Guidelines
24+
25+
- **Verify sources**: If you add research content, make sure sources are traceable
26+
- **Keep it friendly and respectful**
27+
- **Test things**: If you add code or scripts, test them
28+
- **Be clear**: Documentation should be clear and helpful
29+
30+
No formal process - just be respectful and helpful. Questions? Write me or better open an issue.
31+
32+

0 commit comments

Comments
 (0)