Skip to content

Commit 38c39ee

Browse files
committed
making report one object
1 parent b913e9e commit 38c39ee

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

bids2openminds/report.py

+19-11
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33

44
def create_report(dataset, dataset_version, collection, dataset_description, input_path):
5-
print(f"Dataset title : {dataset.full_name}")
6-
print("Authors : ")
7-
for author in dataset_version.authors:
8-
print(f"{author.given_name} {author.family_name}")
9-
105
subject_number = 0
116
file_bundle_number = 0
127
files_number = 0
@@ -21,20 +16,33 @@ def create_report(dataset, dataset_version, collection, dataset_description, inp
2116
case "https://openminds.ebrains.eu/core/File":
2217

2318
files_number += 1
19+
2420
# TODO to be activated after merging the FileBundle pull request
2521
# case "https://openminds.ebrains.eu/core/FileBundle":
2622
#
2723
# file_bundle_number += 1
2824

29-
print("This dataset contains following items:")
30-
print(f"Number of subjects : {subject_number}")
31-
print(f"Number of files : {files_number}")
32-
# print(f"Number of file bundles : {file_bundle_number}")
25+
report = f"""Conversion Report
26+
=================
27+
28+
Dataset title : {dataset.full_name}
3329
30+
The following elements were converted:
31+
--------------------------------------
32+
+ number of converted subjects: {subject_number}
33+
+ number of state for each subject: XX-YY
34+
+ number of files: {files_number}
35+
+ number of files: {file_bundle_number}
36+
37+
The following elements were not converted:
38+
------------------------------------------
39+
"""
3440
if "GeneratedBy" in dataset_description:
35-
print("This dataset is derivative. The derivative section of BIDS specification is not final yet, so conversion is not complete. The generated openMINDS file should be treated carefully.")
41+
report = report+"\n"+"+ Dataset is derivative, derivative data are ignored for now\n"
3642

3743
derivatives_path = os.path.join(
3844
input_path, "derivatives")
3945
if os.path.isdir(derivatives_path):
40-
print("This dataset contains derivative. The derivative section of BIDS specification is not final yet, so conversion is not complete. The generated openMINDS file should be treated carefully.")
46+
report = report+"\n"+"+ Dataset contains derivative, derivative data are ignored for now\n"
47+
48+
print(report)

0 commit comments

Comments
 (0)