Skip to content

Commit

Permalink
Merge pull request #36 from 4dn-dcic/expand_es_metadata_tweaks
Browse files Browse the repository at this point in the history
0.6.2 -- hotfixes to expand_es_metadata
  • Loading branch information
Carl Vitzthum authored Feb 14, 2019
2 parents 9201389 + 086d32f commit 719390b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dcicutils/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Version information."""

# The following line *must* be the last in the module, exactly as formatted:
__version__ = "0.6.1"
__version__ = "0.6.2"
1 change: 1 addition & 0 deletions dcicutils/ff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ def remove_keys(my_dict, remove_list):
frame_resp = remove_keys(es_item['object'], ignore_field)
else:
frame_resp = remove_keys(es_item['properties'], ignore_field)
frame_resp['uuid'] = uuid # uuid is not in properties, so add it
store[obj_key].append(frame_resp)
item_uuids.add(uuid)
else: # this case should not happen
Expand Down
23 changes: 15 additions & 8 deletions test/test_ff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,11 @@ def test_expand_es_metadata(integrated_ff):
test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f']
key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env']
store, uuids = ff_utils.expand_es_metadata(test_list, key=key, ff_env=ff_env)
assert len(uuids) == 10
assert 'file_processed' in store
for pos_case in ['file_processed', 'user', 'file_format', 'award', 'lab']:
assert pos_case in store
for neg_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg',
'quality_metric_pairsqc', 'quality_metric_fastqc']:
assert neg_case not in store
# make sure the frame is raw (default)
test_item = store['file_processed'][0]
assert test_item['lab'].startswith('828cd4fe')
Expand All @@ -521,9 +524,7 @@ def test_expand_es_metadata_frame_object(integrated_ff):
test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f']
key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env']
store, uuids = ff_utils.expand_es_metadata(test_list, store_frame='object', key=key, ff_env=ff_env)
assert len(uuids) == 10
assert 'file_processed' in store
# make sure the frame is raw (default)
# make sure the frame is object (default)
test_item = store['file_processed'][0]
assert test_item['lab'].startswith('/labs/')

Expand All @@ -533,16 +534,22 @@ def test_expand_es_metadata_add_wfrs(integrated_ff):
test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f']
key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env']
store, uuids = ff_utils.expand_es_metadata(test_list, add_pc_wfr=True, key=key, ff_env=ff_env)
assert len(uuids) == 73
for pos_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg',
'quality_metric_pairsqc', 'quality_metric_fastqc']:
assert pos_case in store


@pytest.mark.integrated
def test_expand_es_metadata_ignore_fields(integrated_ff):
test_list = ['7f9eb396-5c1a-4c5e-aebf-28ea39d6a50f']
key, ff_env = integrated_ff['ff_key'], integrated_ff['ff_env']
store, uuids = ff_utils.expand_es_metadata(test_list, add_pc_wfr=True, ignore_field=['quality_metric'],
store, uuids = ff_utils.expand_es_metadata(test_list, add_pc_wfr=True, ignore_field=['quality_metric',
'output_quality_metrics'],
key=key, ff_env=ff_env)
assert len(uuids) == 71
for pos_case in ['workflow_run_awsem', 'workflow', 'file_reference', 'software', 'workflow_run_sbg']:
assert pos_case in store
for neg_case in ['quality_metric_pairsqc', 'quality_metric_fastqc']:
neg_case not in store


@pytest.mark.file_operation
Expand Down

0 comments on commit 719390b

Please sign in to comment.