5353
5454
5555def _most_recent_template_path (template ):
56+ """Obtain the most recent available template filepath"""
5657 filepaths = template .get_filepaths ()
5758
5859 # the test dataset shows that a prep can exist without a prep template
@@ -67,26 +68,31 @@ def _most_recent_template_path(template):
6768
6869
6970def _set_study (payload , study ):
71+ """Set study level information"""
7072 filepath = _most_recent_template_path (study .sample_template )
7173
7274 payload [STUDY_ID ] = study .id
7375 payload [STUDY_SAMPLE_METADATA_FILEPATH ] = filepath
7476
7577
7678def _set_prep_templates (payload , study ):
79+ """Set prep template level information"""
7780 template_data = []
7881 for pt in study .prep_templates ():
7982 _set_prep_template (template_data , pt )
8083 payload [PREP_TEMPLATES ] = template_data
8184
8285
8386def _get_human_filtering (prep_template ):
87+ """Obtain the human filtering if applied"""
8488 # .current_human_filtering does not describe what the human filter is
89+ # so we will examine the first artifact off the prep
8590 if prep_template .artifact is not None :
8691 return prep_template .artifact .human_reads_filter_method
8792
8893
8994def _set_prep_template (template_payload , prep_template ):
95+ """Set an individual prep template information"""
9096 filepath = _most_recent_template_path (prep_template )
9197
9298 current_template = {}
@@ -102,6 +108,7 @@ def _set_prep_template(template_payload, prep_template):
102108
103109
104110def _get_artifacts (prep_template ):
111+ """Get artifact information associated with a prep"""
105112 pending_artifact_objects = [prep_template .artifact , ]
106113 all_artifact_objects = set (pending_artifact_objects [:])
107114
@@ -114,6 +121,7 @@ def _get_artifacts(prep_template):
114121
115122
116123def _set_artifacts (template_payload , prep_template ):
124+ """Set artifact information specific to a prep"""
117125 prep_artifacts = []
118126
119127 if prep_template .artifact is None :
@@ -127,6 +135,7 @@ def _set_artifacts(template_payload, prep_template):
127135
128136
129137def _set_artifact (prep_artifacts , artifact , basal_id ):
138+ """Set artifact specific information"""
130139 artifact_payload = {}
131140 artifact_payload [ARTIFACT_ID ] = artifact .id
132141
@@ -145,6 +154,7 @@ def _set_artifact(prep_artifacts, artifact, basal_id):
145154
146155
147156def _set_artifact_processing (artifact_payload , artifact ):
157+ """Set processing parameter information associated with an artifact"""
148158 processing_parameters = artifact .processing_parameters
149159 if processing_parameters is None :
150160 artifact_processing_id = None
@@ -162,6 +172,7 @@ def _set_artifact_processing(artifact_payload, artifact):
162172
163173
164174def _set_artifact_filepaths (artifact_payload , artifact ):
175+ """Set filepath information associated with an artifact"""
165176 artifact_filepaths = []
166177 for filepath_data in artifact .filepaths :
167178 local_payload = {}
@@ -184,12 +195,30 @@ def get(self, study_id):
184195 if study is None :
185196 return
186197
198+ # schema:
199+ # STUDY_ID: <int>,
200+ # STUDY_SAMPLE_METADATA_FILEPATH: <path>,
201+ # PREP_TEMPLATES: None | list[dict]
202+ # PREP_ID: <int>,
203+ # PREP_STATUS: <str>,
204+ # PREP_SAMPLE_METADATA_FILEPATH: <path>,
205+ # PREP_DATA_TYPE: <str>,
206+ # PREP_HUMAN_FILTERING: None | <str>,
207+ # PREP_ARTIFACTS: None | list[dict]
208+ # ARTIFACT_ID: <int>,
209+ # ARTIFACT_STATUS: <str>,
210+ # ARTIFACT_PARENT_IDS: None | list[int],
211+ # ARTIFACT_BASAL_ID: None | <int>,
212+ # ARTIFACT_PROCESSING_ID: None | <int>,
213+ # ARTIFACT_PROCESSING_NAME: None | <str,
214+ # ARTIFACT_PROCESSING_ARGUMENTS: None | dict[noschema]
215+ # ARTIFACT_FILEPATHS: None | list[dict]
216+ # ARTIFACT_FILEPATH_ID: <int>,
217+ # ARTIFACT_FILEPATH: <path>,
218+ # ARTIFACT_FILEPATH_TYPE': <str>
219+ #
187220 payload = {}
188221 _set_study (payload , study )
189222 _set_prep_templates (payload , study )
190223 self .write (payload )
191224 self .finish ()
192-
193-
194- # get all the things
195-
0 commit comments