diff --git a/requirements.txt b/requirements.txt index 57ab56bb4..08b6cdfb6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,11 +11,11 @@ fuzzywuzzy==0.6.1 gen3authz==0.2.1 graphene==2.0.1 jsonschema==3.2 -lxml==4.4.2 +lxml==4.6.3 pbr==2.0.0 psycopg2==2.8.4 python-keystoneclient==1.8.1 -PyYAML==5.1 +PyYAML==5.4 requests==2.22.0 setuptools==40.3.0 six==1.12.0 @@ -33,6 +33,6 @@ cdiserrors==0.1.2 cdislogging==1.0.0 git+https://git@github.com/NCI-GDC/cdisutils.git@f54e393c89939b2200dfae45c6235cbe2bae1206#egg=cdisutils gen3dictionary==2.0.1 -gen3datamodel==3.0.2 +gen3datamodel==3.0.3 git+https://git@github.com/uc-cdis/indexclient.git@2.0.0#egg=indexclient git+https://git@github.com/uc-cdis/storage-client.git@1.0.0#egg=storageclient diff --git a/sheepdog/utils/transforms/__init__.py b/sheepdog/utils/transforms/__init__.py index 5c536353d..b14b2d2fa 100644 --- a/sheepdog/utils/transforms/__init__.py +++ b/sheepdog/utils/transforms/__init__.py @@ -33,11 +33,18 @@ def parse_bool_from_string(value): def parse_list_from_string(value): """ Handle array fields by converting them to a list. + Try to cast to float to handle arrays of numbers. Example: - 1,2,3 -> ['1','2','3'] + a,b,c -> ['a','b','c'] + 1,2,3 -> [1,2,3] """ - return [x.strip() for x in value.split(",")] + items = [x.strip() for x in value.split(",")] + try: + items = [float(x) for x in items] + except ValueError: + pass # not an array of numbers + return items def set_row_type(row): diff --git a/sheepdog/utils/transforms/graph_to_doc.py b/sheepdog/utils/transforms/graph_to_doc.py index 70aa468c7..1bc5dd75c 100644 --- a/sheepdog/utils/transforms/graph_to_doc.py +++ b/sheepdog/utils/transforms/graph_to_doc.py @@ -153,13 +153,13 @@ def list_to_comma_string(val, file_format): """ if val is None: - """ If a field is empty we must replace it with an empty string for tsv/csv exports and leave it as None for json exports """ + """If a field is empty we must replace it with an empty string for tsv/csv exports and leave it as None for json exports""" if file_format == "json": return val return "" if isinstance(val, list): - val = ",".join(val) + val = ",".join((str(x) for x in val)) return val