Skip to content

Commit 0dffd3c

Browse files
Merge pull request ModelSEED#91 from ModelSEED/fix_empty_strings
Update Validate_Compounds_JSON.py
2 parents 97eb186 + 35a85eb commit 0dffd3c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Scripts/Validation/Validate_Compounds_JSON.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ def check_dups(_compounds, verbose, unique_fields=('id', 'abbreviation',
2626
if comp['is_obsolete']:
2727
continue
2828
for key in unique_values:
29+
if not comp.get(key) or comp[key] == 'null':
30+
continue
2931
unique_values[key][comp[key]].append(id)
3032

3133
# if the unique_values dict for a field has more than one id, it's not unique
3234
duplicated = defaultdict(int)
3335
for value_type in unique_values:
3436
for key, ids in unique_values[value_type].items():
35-
if len(ids) > 1 and key != 'null':
37+
if len(ids) > 1:
3638
if verbose:
3739
print("Duplicate {}: {} in {}".format(value_type, key, ids))
3840
duplicated["duplicated_"+value_type] += len(ids)-1

0 commit comments

Comments
 (0)