Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report on repo #56

Merged
merged 13 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bvals.txt
nosetests.xml
coverage.xml
*.pyc
local.env
126 changes: 126 additions & 0 deletions combined_report.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into the website folder. Another PR is also creating files there.

Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>Technique</th>
<th>Subfolder</th>
<th>Contributors</th>
<th>Tested</th>
</tr>
</thead>
<tbody>
<tr>
<td>IVIM</td>
<td>OGC_AmsterdamUMC</td>
<td>Oliver Gurney-Champion</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>OGC_AmsterdamUMC</td>
<td>Oliver Gurney-Champion</td>
<td>Yes</td>
</tr>
<tr>
<td>Tri-exponential</td>
<td>OGC_AmsterdamUMC</td>
<td>Oliver Gurney-Champion</td>
<td>Yes</td>
</tr>
<tr>
<td>Tri-exponential</td>
<td>OGC_AmsterdamUMC</td>
<td>Oliver Gurney-Champion</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>OGC_AmsterdamUMC</td>
<td>Oliver Gurney-Champion/Sebastiano Barbieri</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>PvH_KB_NKI</td>
<td>Petra van Houdt/Stefan Zijlema/Koen Baas</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>PV_MUMC</td>
<td>Paulien Voorter</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Farooq et al. Modified by Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Fadnavis et al. Modified by Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Modified by Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>IAR_LundUniversity</td>
<td>Modified by Ivan A. Rashid</td>
<td>Yes</td>
</tr>
<tr>
<td>IVIM</td>
<td>OJ_GU</td>
<td>Oscar Jalnefjord</td>
<td>No</td>
</tr>
<tr>
<td>IVIM</td>
<td>OJ_GU</td>
<td>Oscar Jalnefjord</td>
<td>No</td>
</tr>
<tr>
<td>IVIM</td>
<td>OJ_GU</td>
<td>Oscar Jalnefjord</td>
<td>No</td>
</tr>
<tr>
<td>IVIM</td>
<td>ETP_SRI</td>
<td>Eric Peterson</td>
<td>Yes</td>
</tr>
</tbody>
</table>
3 changes: 3 additions & 0 deletions local.env.example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the idea behind setting these variables? You should be able to get the repository location from the location of the file, e.g. using the __file__ variable.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REPO_DIR=/path/to/your/repo
CODE_CONTRIBUTIONS_FILE=/path/to/your/code_contributions_record.csv
ALGORITHMS_FILE=/path/to/your/algorithms.json
37 changes: 37 additions & 0 deletions repostatus.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should move somewhere else. Probably utilities/repository or something.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import pandas as pd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pandas caused the test failure. It should be in the requirements.

from dotenv import load_dotenv
import json

# Load environment variables
load_dotenv(r'C:\Users\home\tf2.4\TF2.4_IVIM-MRI_CodeCollection\local.env')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to get around hard coding paths. This won't work for me, for example.


# Read the CSV file
csv_file_path = os.getenv('CODE_CONTRIBUTIONS_FILE')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the code I realize that your table is missing a column, wrapped. In the issue thread I mentioned parsing the files in the folders which isn't being done here, and that's what is missing. It should parse the wrapper folder to find which algorithms are wrapped.

And there I also mentioned double checking the code contributions against what is in the source folder.

So the source code folder and code contribution file should match. If not it would be nice to note that. That should be a superset of the wrapped code list. And that should be a superset of the tested code list. If anything doesn't match that logic then we should note it in the html or printing a message.

df = pd.read_csv(csv_file_path)

unique_subfolders = df['subfolder'].unique().tolist()

# Read the JSON file
algorithms_file_path = os.getenv('ALGORITHMS_FILE')
with open(algorithms_file_path, 'r') as f:
algorithms_data = json.load(f)

# Get a list of all algorithms from the JSON file
all_algorithms = algorithms_data['algorithms']

# Add a new column 'Tested' to the DataFrame if it starts with that of subfolder
df['Tested'] = df.apply(lambda row: 'Yes' if any(algorithm.startswith(row['subfolder'].split('_')[0]) for algorithm in all_algorithms) else 'No', axis=1)

# Select the desired columns
df_selected = df[['Technique', 'subfolder', 'Authors', 'Tested']]
df_selected.columns = ['Technique', 'Subfolder', 'Contributors', 'Tested']

# Convert the DataFrame to HTML
html_string = df_selected.to_html(index=False)

# Save the HTML to a file
with open('combined_report.html', 'w') as f:
f.write(html_string)
# printing message that report have been succesfully generated
print("Combined HTML report generated successfully.")
Loading