Skip to content

Commit 6d210a0

Browse files
committed
created wrapper column
1 parent 8bd36ed commit 6d210a0

File tree

4 files changed

+86
-38
lines changed

4 files changed

+86
-38
lines changed

repostatus.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ matplotlib
99
scienceplots
1010
cvxpy
1111
pytest
12-
tqdm
12+
tqdm
13+
pandas

utilities/repostatus.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import os
2+
import pandas as pd
3+
import json
4+
5+
# directory of the current script
6+
script_dir = os.path.dirname(os.path.abspath(__file__))
7+
8+
# path to the repository
9+
REPO_DIR = os.path.dirname(script_dir)
10+
11+
CODE_CONTRIBUTIONS_FILE = os.path.join(REPO_DIR, "doc", "code_contributions_record.csv")
12+
ALGORITHMS_FILE = os.path.join(REPO_DIR, "tests", "IVIMmodels", "unit_tests", "algorithms.json")
13+
SOURCE_FOLDER = os.path.join(REPO_DIR, "src", "original")
14+
WRAPPED_FOLDER = os.path.join(REPO_DIR, "src", "standardized")
15+
16+
# Read the CSV file
17+
df = pd.read_csv(CODE_CONTRIBUTIONS_FILE)
18+
19+
unique_subfolders = df['subfolder'].unique().tolist()
20+
21+
# Read the JSON file
22+
with open(ALGORITHMS_FILE, 'r') as f:
23+
algorithms_data = json.load(f)
24+
25+
# list of all algorithms from the JSON file
26+
all_algorithms = algorithms_data['algorithms']
27+
28+
# Check if both code_contributions_file matches with source folder
29+
for subfolder in unique_subfolders:
30+
subfolder_path = os.path.join(SOURCE_FOLDER, subfolder)
31+
if not os.path.exists(subfolder_path):
32+
print(f"Warning: Subfolder '{subfolder}' does not exist in the source folder.")
33+
34+
# Add column 'Tested' to the DataFrame if it starts with that of subfolder
35+
df['Tested'] = df.apply(lambda row: 'Yes' if any(algorithm.startswith(row['subfolder'].split('_')[0]) for algorithm in all_algorithms) else 'No', axis=1)
36+
37+
# Parse files in the WRAPPED_FOLDER
38+
wrapped_algorithms = []
39+
for root, dirs, files in os.walk(WRAPPED_FOLDER):
40+
for file in files:
41+
if file.endswith('.py'):
42+
file_path = os.path.join(root, file)
43+
with open(file_path, 'r') as f:
44+
content = f.read()
45+
for algorithm in all_algorithms:
46+
if algorithm in content:
47+
wrapped_algorithms.append(algorithm)
48+
49+
# Add a column 'Wrapped' to the DataFrame
50+
df['Wrapped'] = df.apply(lambda row: 'Yes' if any(algorithm.startswith(row['subfolder'].split('_')[0]) for algorithm in wrapped_algorithms) else 'No', axis=1)
51+
52+
# Select the desired columns
53+
df_selected = df[['Technique', 'subfolder', 'Authors', 'Tested', 'Wrapped']]
54+
df_selected.columns = ['Technique', 'Subfolder', 'Contributors', 'Tested', 'Wrapped']
55+
56+
# Convert the DataFrame to HTML
57+
html_string = df_selected.to_html(index=False)
58+
59+
# Save the HTML to a file
60+
with open(os.path.join(REPO_DIR, 'combined_report.html'), 'w') as f:
61+
f.write(html_string)
62+
63+
# Printing message that report has been successfully generated
64+
print("Combined HTML report generated successfully.")

combined_report.html renamed to website/combined_report.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<th>Subfolder</th>
66
<th>Contributors</th>
77
<th>Tested</th>
8+
<th>Wrapped</th>
89
</tr>
910
</thead>
1011
<tbody>
@@ -13,114 +14,133 @@
1314
<td>OGC_AmsterdamUMC</td>
1415
<td>Oliver Gurney-Champion</td>
1516
<td>Yes</td>
17+
<td>Yes</td>
1618
</tr>
1719
<tr>
1820
<td>IVIM</td>
1921
<td>OGC_AmsterdamUMC</td>
2022
<td>Oliver Gurney-Champion</td>
2123
<td>Yes</td>
24+
<td>Yes</td>
2225
</tr>
2326
<tr>
2427
<td>Tri-exponential</td>
2528
<td>OGC_AmsterdamUMC</td>
2629
<td>Oliver Gurney-Champion</td>
2730
<td>Yes</td>
31+
<td>Yes</td>
2832
</tr>
2933
<tr>
3034
<td>Tri-exponential</td>
3135
<td>OGC_AmsterdamUMC</td>
3236
<td>Oliver Gurney-Champion</td>
3337
<td>Yes</td>
38+
<td>Yes</td>
3439
</tr>
3540
<tr>
3641
<td>IVIM</td>
3742
<td>OGC_AmsterdamUMC</td>
3843
<td>Oliver Gurney-Champion/Sebastiano Barbieri</td>
3944
<td>Yes</td>
45+
<td>Yes</td>
4046
</tr>
4147
<tr>
4248
<td>IVIM</td>
4349
<td>PvH_KB_NKI</td>
4450
<td>Petra van Houdt/Stefan Zijlema/Koen Baas</td>
4551
<td>Yes</td>
52+
<td>Yes</td>
4653
</tr>
4754
<tr>
4855
<td>IVIM</td>
4956
<td>PV_MUMC</td>
5057
<td>Paulien Voorter</td>
5158
<td>Yes</td>
59+
<td>Yes</td>
5260
</tr>
5361
<tr>
5462
<td>IVIM</td>
5563
<td>IAR_LundUniversity</td>
5664
<td>Ivan A. Rashid</td>
5765
<td>Yes</td>
66+
<td>Yes</td>
5867
</tr>
5968
<tr>
6069
<td>IVIM</td>
6170
<td>IAR_LundUniversity</td>
6271
<td>Ivan A. Rashid</td>
6372
<td>Yes</td>
73+
<td>Yes</td>
6474
</tr>
6575
<tr>
6676
<td>IVIM</td>
6777
<td>IAR_LundUniversity</td>
6878
<td>Ivan A. Rashid</td>
6979
<td>Yes</td>
80+
<td>Yes</td>
7081
</tr>
7182
<tr>
7283
<td>IVIM</td>
7384
<td>IAR_LundUniversity</td>
7485
<td>Ivan A. Rashid</td>
7586
<td>Yes</td>
87+
<td>Yes</td>
7688
</tr>
7789
<tr>
7890
<td>IVIM</td>
7991
<td>IAR_LundUniversity</td>
8092
<td>Farooq et al. Modified by Ivan A. Rashid</td>
8193
<td>Yes</td>
94+
<td>Yes</td>
8295
</tr>
8396
<tr>
8497
<td>IVIM</td>
8598
<td>IAR_LundUniversity</td>
8699
<td>Fadnavis et al. Modified by Ivan A. Rashid</td>
87100
<td>Yes</td>
101+
<td>Yes</td>
88102
</tr>
89103
<tr>
90104
<td>IVIM</td>
91105
<td>IAR_LundUniversity</td>
92106
<td>Modified by Ivan A. Rashid</td>
93107
<td>Yes</td>
108+
<td>Yes</td>
94109
</tr>
95110
<tr>
96111
<td>IVIM</td>
97112
<td>IAR_LundUniversity</td>
98113
<td>Modified by Ivan A. Rashid</td>
99114
<td>Yes</td>
115+
<td>Yes</td>
100116
</tr>
101117
<tr>
102118
<td>IVIM</td>
103119
<td>OJ_GU</td>
104120
<td>Oscar Jalnefjord</td>
105121
<td>No</td>
122+
<td>No</td>
106123
</tr>
107124
<tr>
108125
<td>IVIM</td>
109126
<td>OJ_GU</td>
110127
<td>Oscar Jalnefjord</td>
111128
<td>No</td>
129+
<td>No</td>
112130
</tr>
113131
<tr>
114132
<td>IVIM</td>
115133
<td>OJ_GU</td>
116134
<td>Oscar Jalnefjord</td>
117135
<td>No</td>
136+
<td>No</td>
118137
</tr>
119138
<tr>
120139
<td>IVIM</td>
121140
<td>ETP_SRI</td>
122141
<td>Eric Peterson</td>
123142
<td>Yes</td>
143+
<td>Yes</td>
124144
</tr>
125145
</tbody>
126146
</table>

0 commit comments

Comments
 (0)