pysodafair 0.1.62__tar.gz → 0.1.63__tar.gz

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.
Files changed (77) hide show
  1. {pysodafair-0.1.62 → pysodafair-0.1.63}/PKG-INFO +1 -1
  2. {pysodafair-0.1.62 → pysodafair-0.1.63}/pyproject.toml +1 -1
  3. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/dataset_description.py +85 -17
  4. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/dataset_description.json +2 -2
  5. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/resources.json +5 -1
  6. {pysodafair-0.1.62 → pysodafair-0.1.63}/LICENSE +0 -0
  7. {pysodafair-0.1.62 → pysodafair-0.1.63}/README.md +0 -0
  8. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/__init__.py +0 -0
  9. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/constants.py +0 -0
  10. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/__init__.py +0 -0
  11. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/dataset_generation/__init__.py +0 -0
  12. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/dataset_generation/manifestSession/__init__.py +0 -0
  13. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/dataset_generation/manifestSession/manifest_session.py +0 -0
  14. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/dataset_generation/upload.py +0 -0
  15. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/dataset_importing/__init__.py +0 -0
  16. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/dataset_importing/import_dataset.py +0 -0
  17. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/__init__.py +0 -0
  18. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/code_description.py +0 -0
  19. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/constants.py +0 -0
  20. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/excel_utils.py +0 -0
  21. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/helpers.py +0 -0
  22. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/manifest.py +0 -0
  23. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/manifest_package/__init__.py +0 -0
  24. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/manifest_package/manifest.py +0 -0
  25. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/manifest_package/manifest_import.py +0 -0
  26. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/manifest_package/manifest_writer.py +0 -0
  27. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/performances.py +0 -0
  28. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/resources.py +0 -0
  29. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/samples.py +0 -0
  30. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/sites.py +0 -0
  31. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/subjects.py +0 -0
  32. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/submission.py +0 -0
  33. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata/text_metadata.py +0 -0
  34. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/CHANGES +0 -0
  35. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/LICENSE +0 -0
  36. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/README.md +0 -0
  37. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/__init__.py +0 -0
  38. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/code_description.xlsx +0 -0
  39. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/code_parameters.xlsx +0 -0
  40. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/dataset_description.xlsx +0 -0
  41. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/manifest.xlsx +0 -0
  42. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/performances.xlsx +0 -0
  43. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/resources.xlsx +0 -0
  44. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/samples.xlsx +0 -0
  45. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/sites.xlsx +0 -0
  46. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/subjects.xlsx +0 -0
  47. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/subjects_pools_samples_structure.xlsx +0 -0
  48. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/subjects_pools_samples_structure_example.xlsx +0 -0
  49. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/metadata_templates/submission.xlsx +0 -0
  50. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/permissions/__init__.py +0 -0
  51. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/permissions/permissions.py +0 -0
  52. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/pysoda/__init__.py +0 -0
  53. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/pysoda/soda.py +0 -0
  54. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/pysoda/soda_object.py +0 -0
  55. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/upload_manifests/__init__.py +0 -0
  56. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/core/upload_manifests/upload_manifests.py +0 -0
  57. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/__init__.py +0 -0
  58. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/code_description.json +0 -0
  59. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/manifest.json +0 -0
  60. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/performances.json +0 -0
  61. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/samples.json +0 -0
  62. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/sites.json +0 -0
  63. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/soda_schema.json +0 -0
  64. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/subjects.json +0 -0
  65. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/schema/submission_schema.json +0 -0
  66. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/__init__.py +0 -0
  67. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/authentication.py +0 -0
  68. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/config.py +0 -0
  69. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/exceptions.py +0 -0
  70. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/logger.py +0 -0
  71. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/metadata_utils.py +0 -0
  72. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/pennsieveAgentUtils.py +0 -0
  73. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/pennsieveUtils.py +0 -0
  74. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/profile.py +0 -0
  75. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/schema_validation.py +0 -0
  76. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/time_utils.py +0 -0
  77. {pysodafair-0.1.62 → pysodafair-0.1.63}/pysoda/utils/upload_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pysodafair
3
- Version: 0.1.62
3
+ Version: 0.1.63
4
4
  Summary: Pysoda package for Fairdataihub tools
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pysodafair"
3
- version = "0.1.62"
3
+ version = "0.1.63"
4
4
  description = "Pysoda package for Fairdataihub tools"
5
5
  authors = ["Christopher Marroquin <cmarroquin@calmi2.org>"]
6
6
  license = "MIT"
@@ -3,8 +3,8 @@ from os.path import join, getsize
3
3
  from openpyxl import load_workbook
4
4
  import shutil
5
5
  from .excel_utils import rename_headers, excel_columns
6
- import itertools
7
- from openpyxl.styles import PatternFill
6
+ from copy import copy
7
+ from openpyxl.styles import PatternFill, Font, Alignment, Border, Side
8
8
  from ...utils import validate_schema
9
9
  from .helpers import upload_metadata_file, get_template_path
10
10
 
@@ -44,15 +44,24 @@ def create_excel(
44
44
 
45
45
  populate_standards_info(ws1, soda)
46
46
 
47
- keyword_array = populate_basic_info(ws1, soda)
48
-
49
- populate_study_info(ws1, soda)
50
- populate_contributor_info(ws1, soda)
51
- populate_related_resource_information(ws1, soda)
47
+ keyword_array_len = populate_basic_info(ws1, soda)
48
+ study_arr_len = populate_study_info(ws1, soda)
49
+ contributor_arr_len = populate_contributor_info(ws1, soda)
50
+ related_resource_arr_len = populate_related_resource_information(ws1, soda)
52
51
  populate_funding_info(ws1, soda)
53
52
  populate_participant_information(ws1, soda)
54
53
  data_dictionary_information(ws1, soda)
55
54
 
55
+ max_len = max(
56
+ keyword_array_len,
57
+ study_arr_len,
58
+ contributor_arr_len,
59
+ related_resource_arr_len,
60
+ )
61
+
62
+ # 3 is the first value column position
63
+ extend_value_header(ws1, max_len, start_index=3)
64
+
56
65
  wb.save(destination)
57
66
 
58
67
  size = getsize(destination)
@@ -167,22 +176,81 @@ def data_dictionary_information(workbook, soda):
167
176
  workbook["D44"] = data_dictionary_info.get("data_dictionary_type", "")
168
177
  workbook["D45"] = data_dictionary_info.get("data_dictionary_description", "")
169
178
 
170
- def grayout_subheaders(workbook, max_len, start_index):
179
+ def grayout_subheaders(workbook, col):
171
180
  """
172
- Gray out sub-header rows for values exceeding 3 (SDS2.0).
181
+ Gray out the cells at workbook[row][col] for the specified cells in
182
+ positions 2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 19, 20, 21, 22, 26, 27, 32, 37,
183
+ 38, 39, 40, 41, 42
173
184
  """
174
- headers_list = ["4", "10", "18", "23", "28"]
175
- columns_list = excel_columns(start_index=start_index)
176
-
177
- for (i, column), no in itertools.product(zip(range(2, max_len + 1), columns_list[1:]), headers_list):
178
- cell = workbook[column + no]
179
- fillColor("B2B2B2", cell)
180
-
181
-
185
+ gray_out_rows_for_column = [2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 19, 20, 21, 22, 26, 27, 32, 37,
186
+ 38, 39, 40, 41, 42]
182
187
 
188
+ for row in gray_out_rows_for_column:
189
+ cell = workbook[col + str(row)]
190
+ if row in [4, 7, 15, 19, 27, 32, 37, 42]:
191
+ fillColor("b2b2b2", cell)
192
+ else:
193
+ fillColor("cccccc", cell)
183
194
 
184
195
 
185
196
  def fillColor(color, cell):
186
197
  colorFill = PatternFill(start_color=color, end_color=color, fill_type="solid")
187
198
 
188
199
  cell.fill = colorFill
200
+
201
+
202
+ def apply_calibri_bold_12(cell):
203
+ """Apply Calibri Bold 12pt font formatting to a cell"""
204
+ calibri_bold_font = Font(name='Calibri', size=12, bold=True)
205
+ cell.font = calibri_bold_font
206
+
207
+
208
+ def set_cell_alignment(cell, horizontal='left', vertical='top', wrap_text=False):
209
+ """Set text alignment for a cell
210
+
211
+ Args:
212
+ cell: The cell to format
213
+ horizontal: 'left', 'center', 'right', 'justify', 'distributed'
214
+ vertical: 'top', 'center', 'bottom', 'justify', 'distributed'
215
+ wrap_text: Boolean to enable text wrapping
216
+ """
217
+ cell.alignment = Alignment(
218
+ horizontal=horizontal,
219
+ vertical=vertical,
220
+ wrap_text=wrap_text
221
+ )
222
+
223
+
224
+ def apply_dashed_border(cell, workbook):
225
+ """Apply border copied from cell A1 to the target cell"""
226
+ # Copy the border from cell A1
227
+ cell.border = copy(workbook["A1"].border)
228
+
229
+
230
+
231
+
232
+
233
+
234
+ def extend_value_header(workbook, max_len, start_index):
235
+ """
236
+ The headers starting at G1 are the 'Value' headers that correspond to the maximum number of entries for either the
237
+ keywords, contributor information, or data dictionary information arrays. This function extends those headers based on the max_len of the
238
+ three arrays.
239
+ """
240
+
241
+ column_list = excel_columns(start_index=start_index)
242
+
243
+ # if max len is less than 4 then no need to extend headers
244
+ if max_len < 4:
245
+ return
246
+
247
+ # replace the 4th value with header value 'Value 4' and so on for max len
248
+ for i in range(4, max_len + 1):
249
+ header_cell = workbook[column_list[i - 1] + "1"]
250
+ header_cell.value = f"Value {i}"
251
+ # make the new header blue
252
+ fillColor("9cc2e5", header_cell)
253
+ apply_calibri_bold_12(header_cell)
254
+ set_cell_alignment(header_cell, horizontal='center', vertical='center')
255
+ apply_dashed_border(header_cell, workbook)
256
+ grayout_subheaders(workbook, column_list[i - 1])
@@ -136,8 +136,8 @@
136
136
  },
137
137
  "contributor_name": {
138
138
  "type": "string",
139
- "pattern": "^[A-Za-z]+, [A-Za-z]+( [A-Za-z]+)?$",
140
- "description": "The name of the contributor. The format should be 'Last Name, First Name'."
139
+ "pattern": "^(([Vv]an|[Vv]an [Dd]e[rn]?|[Vv]an [Tt]|[Vv]ander|[Vv]on|[Vv]on [Dd]e[rn]?|[Zz]u|[Zz]ur|[Vv]om|[Dd]e|[Dd]es|[Dd]u|[Dd]e [Ll]a|[Dd]e [Ll]es|[Dd]e [Ll]os|[Ll]e|[Ll]a|[Ll]es|[Dd]el|[Dd]e [Ll]os|[Dd]e [Ll]a|[Dd]e [Ll]as|[Dd]a|[Dd]o|[Dd]i|[Dd]ell[ao]|[Dd]ell[ei]|[Dd]ai|[Dd]al|[Dd]alle|[Oo]'|[Mm]c|[Mm]ac|[Aa]l|[Ee]l|[Aa]bd [Aa]l|[Aa]bu|[Ii]bn|[Ff]itz|[Aa]p|[Bb]en|[Bb]ar|[Bb]at) )?[^, ]+, [^,]+$",
140
+ "description": "The name of the contributor. The format should be 'Last Name, First Name'. Supports international family name prefixes (van, von, de, del, etc.)."
141
141
  },
142
142
  "contributor_role": {
143
143
  "type": "string",
@@ -8,6 +8,10 @@
8
8
  "type": "string",
9
9
  "description": "Unique identifier for the site, typically an RRID"
10
10
  },
11
+ "type": {
12
+ "type": "string",
13
+ "description": "The type of resource, e.g., 'instrument', 'software', 'reagent', etc."
14
+ },
11
15
  "name": {
12
16
  "type": "string",
13
17
  "description": "The resources name"
@@ -34,6 +38,6 @@
34
38
  "description": "Additional metadata about the resource, such as usage notes or specific details"
35
39
  }
36
40
  },
37
- "required": ["rrid", "name", "url", "vendor", "version", "id_in_protocol"]
41
+ "required": ["rrid"]
38
42
  }
39
43
  }
File without changes
File without changes