-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from apriltuesday/EVA-3624
EVA-3624: Metadata checks on existing BioSamples
- Loading branch information
Showing
5 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import datetime | ||
|
||
# Values coming from https://www.ebi.ac.uk/ena/browser/view/ERC000011 | ||
not_provided_check_list = ['not provided', 'not collected', 'restricted access', 'missing: control sample', | ||
'missing: sample group', 'missing: synthetic construct', 'missing: lab stock', | ||
'missing: third party data', 'missing: data agreement established pre-2023', | ||
'missing: endangered species', 'missing: human-identifiable'] | ||
|
||
|
||
def check_date(date): | ||
return isinstance(date, datetime.date) or \ | ||
isinstance(date, datetime.datetime) or \ | ||
check_date_str_format(date) or \ | ||
str(date).lower() in not_provided_check_list | ||
|
||
|
||
def check_date_str_format(d): | ||
try: | ||
datetime.datetime.strptime(d, "%Y-%m-%d") | ||
return True | ||
except ValueError: | ||
pass | ||
try: | ||
datetime.datetime.strptime(d, "%Y-%m") | ||
return True | ||
except ValueError: | ||
pass | ||
try: | ||
datetime.datetime.strptime(d, "%Y") | ||
return True | ||
except ValueError: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ebi_eva_common_pyutils==0.6.3 | ||
ebi_eva_common_pyutils==0.6.8 | ||
jinja2 | ||
jsonschema | ||
minify_html==0.11.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters