Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

Commit

Permalink
convert integer d/m/y fields to str
Browse files Browse the repository at this point in the history
  • Loading branch information
zzeppozz committed Sep 8, 2021
1 parent e2bca6c commit de9d7a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lmtrex/services/api/v1/occ.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def GET(self, occid=None, provider=None, dataset_key=None, count_only=False, **k
'017ea8f2-fc5a-4660-92ec-c203daaaa631', '018728bb-c376-4562-9ccb-8e3c3fd70df6',
'018a34a9-55da-4503-8aee-e728ba4be146', '019b547a-79c7-47b3-a5ae-f11d30c2b0de']
# This occ has 16 issues in IDB, 0 in GBIF
occids = ['2c1becd5-e641-4e83-b3f5-76a55206539a']
occids = ['2facc7a2-dd88-44af-b95a-733cc27527d4', '2c1becd5-e641-4e83-b3f5-76a55206539a']

dskeys = [TST_VALUES.DS_GUIDS_W_SPECIFY_ACCESS_RECS[0]]
svc = OccurrenceSvc()
Expand Down
8 changes: 6 additions & 2 deletions lmtrex/tools/provider/specify.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ def _standardize_sp7_record(cls, rec):
@classmethod
def _standardize_sp6_record(cls, rec):
newrec = {}
to_str_prov_fields = ['year', 'month', 'day']
mapping = S2nSchema.get_specifycache_occurrence_map()
for stdfld, provfld in mapping.items():
try:
val = rec[provfld]
except:
val = None

newrec[stdfld] = val
# Modify int date elements to string (to match iDigBio)
if val and provfld in to_str_prov_fields:
newrec[stdfld] = str(val)
else:
newrec[stdfld] = val
return newrec

# ...............................................
Expand Down

0 comments on commit de9d7a4

Please sign in to comment.