pysodafair 0.1.63__py3-none-any.whl → 0.1.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysoda/core/dataset_generation/upload.py +41 -75
- {pysodafair-0.1.63.dist-info → pysodafair-0.1.64.dist-info}/METADATA +1 -1
- {pysodafair-0.1.63.dist-info → pysodafair-0.1.64.dist-info}/RECORD +5 -5
- {pysodafair-0.1.63.dist-info → pysodafair-0.1.64.dist-info}/WHEEL +0 -0
- {pysodafair-0.1.63.dist-info → pysodafair-0.1.64.dist-info}/licenses/LICENSE +0 -0
|
@@ -3830,57 +3830,39 @@ def generate_manifest_file_locally(generate_purpose, soda):
|
|
|
3830
3830
|
|
|
3831
3831
|
|
|
3832
3832
|
def generate_manifest_file_data(dataset_structure):
|
|
3833
|
-
# Define common file extensions with special handling
|
|
3834
3833
|
double_extensions = {
|
|
3835
3834
|
".ome.tiff", ".ome.tif", ".ome.tf2", ".ome.tf8", ".ome.btf", ".ome.xml",
|
|
3836
3835
|
".brukertiff.gz", ".mefd.gz", ".moberg.gz", ".nii.gz", ".mgh.gz", ".tar.gz", ".bcl.gz"
|
|
3837
3836
|
}
|
|
3838
3837
|
|
|
3839
|
-
# Helper
|
|
3838
|
+
# Helper: Determine file extension (handles double extensions)
|
|
3840
3839
|
def get_file_extension(filename):
|
|
3841
3840
|
for ext in double_extensions:
|
|
3842
3841
|
if filename.endswith(ext):
|
|
3843
3842
|
base_ext = os.path.splitext(os.path.splitext(filename)[0])[1]
|
|
3844
3843
|
return base_ext + ext
|
|
3845
3844
|
return os.path.splitext(filename)[1]
|
|
3846
|
-
|
|
3845
|
+
|
|
3846
|
+
# Helper: Create a manifest row for a folder
|
|
3847
3847
|
def create_folder_entry(folder_name, path_parts):
|
|
3848
3848
|
full_path = "/".join(path_parts + [folder_name]) + "/"
|
|
3849
|
-
|
|
3850
|
-
full_path.lstrip("/"),
|
|
3851
|
-
"",
|
|
3852
|
-
"", # Description
|
|
3853
|
-
"folder", # File type
|
|
3854
|
-
"", # Entity (empty)
|
|
3855
|
-
"", # Data modality (empty)
|
|
3856
|
-
"", # Also in dataset (empty)
|
|
3857
|
-
"", # Data dictionary path (empty)
|
|
3858
|
-
"", # Entity is transitive (empty)
|
|
3859
|
-
"", # Additional Metadata
|
|
3849
|
+
return [
|
|
3850
|
+
full_path.lstrip("/"),
|
|
3851
|
+
"", "", "folder", "", "", "", "", "", ""
|
|
3860
3852
|
]
|
|
3861
|
-
return entry
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
# Helper function: Build a single manifest entry
|
|
3866
|
-
def create_file_entry(item, folder, path_parts, timestamp, filename):
|
|
3867
|
-
full_path = "/".join(path_parts + [filename])
|
|
3868
|
-
file_info = folder["files"][item]
|
|
3869
3853
|
|
|
3854
|
+
# Helper: Create a manifest row for a file
|
|
3855
|
+
def create_file_entry(file_name, file_info, path_parts, timestamp):
|
|
3870
3856
|
entry = [
|
|
3871
|
-
|
|
3872
|
-
timestamp,
|
|
3873
|
-
file_info["description"],
|
|
3874
|
-
get_file_extension(
|
|
3875
|
-
"",
|
|
3876
|
-
"",
|
|
3877
|
-
"", # Also in dataset (empty)
|
|
3878
|
-
"", # Data dictionary path (empty)
|
|
3879
|
-
"", # Entity is transitive (empty)
|
|
3880
|
-
file_info.get("additional-metadata", "") # Additional Metadata
|
|
3857
|
+
"/".join(path_parts + [file_name]).lstrip("/"),
|
|
3858
|
+
timestamp,
|
|
3859
|
+
file_info["description"],
|
|
3860
|
+
get_file_extension(file_name),
|
|
3861
|
+
"", "", "", "", "",
|
|
3862
|
+
file_info.get("additional-metadata", "")
|
|
3881
3863
|
]
|
|
3882
3864
|
|
|
3883
|
-
#
|
|
3865
|
+
# Append any extra columns dynamically
|
|
3884
3866
|
if "extra_columns" in file_info:
|
|
3885
3867
|
for key, value in file_info["extra_columns"].items():
|
|
3886
3868
|
entry.append(value)
|
|
@@ -3889,48 +3871,36 @@ def generate_manifest_file_data(dataset_structure):
|
|
|
3889
3871
|
|
|
3890
3872
|
return entry
|
|
3891
3873
|
|
|
3892
|
-
# Recursive
|
|
3874
|
+
# Recursive traversal of folders and files
|
|
3893
3875
|
def traverse_folders(folder, path_parts):
|
|
3894
|
-
# Add header row if processing files for the first time
|
|
3895
3876
|
if not manifest_data:
|
|
3896
3877
|
manifest_data.append(header_row)
|
|
3897
|
-
|
|
3898
|
-
if "files" in folder:
|
|
3899
|
-
for item, file_info in folder["files"].items():
|
|
3900
|
-
|
|
3901
|
-
if "path" in file_info:
|
|
3902
|
-
file_path = file_info["path"]
|
|
3903
|
-
elif "pspath" in file_info:
|
|
3904
|
-
file_path = file_info["pspath"]
|
|
3905
|
-
else:
|
|
3906
|
-
continue
|
|
3907
|
-
|
|
3908
|
-
# If the file is a manifest file, skip it
|
|
3909
|
-
if item in {"manifest.xlsx", "manifest.csv"}:
|
|
3910
|
-
continue
|
|
3911
3878
|
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3879
|
+
# Process files
|
|
3880
|
+
for file_name, file_info in folder.get("files", {}).items():
|
|
3881
|
+
file_path = file_info.get("path")
|
|
3882
|
+
if not file_path:
|
|
3883
|
+
continue
|
|
3884
|
+
if file_name in {"manifest.xlsx", "manifest.csv"}:
|
|
3885
|
+
continue
|
|
3886
|
+
|
|
3887
|
+
if file_info["location"] == "ps":
|
|
3888
|
+
timestamp = file_info["timestamp"]
|
|
3889
|
+
else:
|
|
3890
|
+
local_path = pathlib.Path(file_info["path"])
|
|
3891
|
+
timestamp = datetime.fromtimestamp(
|
|
3892
|
+
local_path.stat().st_mtime, tz=local_timezone
|
|
3893
|
+
).isoformat().replace(".", ",").replace("+00:00", "Z")
|
|
3894
|
+
|
|
3895
|
+
manifest_data.append(create_file_entry(file_name, file_info, path_parts, timestamp))
|
|
3896
|
+
|
|
3897
|
+
# Process subfolders
|
|
3898
|
+
for subfolder_name, subfolder in folder.get("folders", {}).items():
|
|
3899
|
+
manifest_data.append(create_folder_entry(subfolder_name, path_parts))
|
|
3900
|
+
traverse_folders(subfolder, path_parts + [subfolder_name])
|
|
3901
|
+
|
|
3902
|
+
# Initialize manifest data and header
|
|
3903
|
+
manifest_data = []
|
|
3934
3904
|
header_row = [
|
|
3935
3905
|
"filename", "timestamp", "description", "file type", "entity",
|
|
3936
3906
|
"data modality", "also in dataset", "data dictionary path",
|
|
@@ -3938,9 +3908,6 @@ def generate_manifest_file_data(dataset_structure):
|
|
|
3938
3908
|
]
|
|
3939
3909
|
local_timezone = TZLOCAL()
|
|
3940
3910
|
|
|
3941
|
-
# Log the dataset structure
|
|
3942
|
-
|
|
3943
|
-
# Start recursive traversal from the root
|
|
3944
3911
|
traverse_folders(dataset_structure, [])
|
|
3945
3912
|
|
|
3946
3913
|
return manifest_data
|
|
@@ -3948,4 +3915,3 @@ def generate_manifest_file_data(dataset_structure):
|
|
|
3948
3915
|
|
|
3949
3916
|
|
|
3950
3917
|
|
|
3951
|
-
|
|
@@ -4,7 +4,7 @@ pysoda/core/__init__.py,sha256=bXnu4fYemJ915xId8nwh-Gy2IUEvVuoS9Hk3CXyJp8U,235
|
|
|
4
4
|
pysoda/core/dataset_generation/__init__.py,sha256=tisLmJeXLeAINXf7BdNZGi2i9vQwImWGa_S5FNwQFbs,299
|
|
5
5
|
pysoda/core/dataset_generation/manifestSession/__init__.py,sha256=kqkTAFEhluyQJ9mmMhYQTh1tgowBeJdH-Q9s5ifGkSE,51
|
|
6
6
|
pysoda/core/dataset_generation/manifestSession/manifest_session.py,sha256=TML_KOJ-1REohqSaHCZNFJrbDR1UDQ9sFcithJRx9t8,4669
|
|
7
|
-
pysoda/core/dataset_generation/upload.py,sha256=
|
|
7
|
+
pysoda/core/dataset_generation/upload.py,sha256=FtEQoyg3ly0lXmnUtKDXXHln1dLN6reb9knOdFTBFeA,172657
|
|
8
8
|
pysoda/core/dataset_importing/__init__.py,sha256=NbWs4HAqqydFLACFoVwl6g457dkYvjiZKx9NzB9wFxE,114
|
|
9
9
|
pysoda/core/dataset_importing/import_dataset.py,sha256=cx8qCQmR_BKdC2G-jzqE4dWg2JhkOS3jM8kpjLIsObk,29487
|
|
10
10
|
pysoda/core/metadata/__init__.py,sha256=Tkx6vdEQEPwAHmVSc9GfdbDZUkvuAqEgHJOxRDeX5vE,821
|
|
@@ -71,7 +71,7 @@ pysoda/utils/profile.py,sha256=di4D_IE1rGSfHl0-SRVjrJK2bCdedW4ugp0W-j1HarQ,937
|
|
|
71
71
|
pysoda/utils/schema_validation.py,sha256=3w3FRPyn4P3xMhITzItk-jYte8TTlNrgCWmY-s05x9Y,4438
|
|
72
72
|
pysoda/utils/time_utils.py,sha256=g5848bivtzWj6TDoWo6CcohF-THxShETP4qTyHTjBWw,131
|
|
73
73
|
pysoda/utils/upload_utils.py,sha256=-BCvfXsJSFqnwEZVCFQX1PLfkdeW0gyGLjLGW6Uxdf8,4607
|
|
74
|
-
pysodafair-0.1.
|
|
75
|
-
pysodafair-0.1.
|
|
76
|
-
pysodafair-0.1.
|
|
77
|
-
pysodafair-0.1.
|
|
74
|
+
pysodafair-0.1.64.dist-info/METADATA,sha256=mgUEcj-8RZdfFlMBD94Joq0bmRP4CXOF0C6S3JxYX20,7011
|
|
75
|
+
pysodafair-0.1.64.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
76
|
+
pysodafair-0.1.64.dist-info/licenses/LICENSE,sha256=Jlt0uGnx87qPRGXPQHsBkg_S7MOsYS2E9Rh1zy47bfw,1082
|
|
77
|
+
pysodafair-0.1.64.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|