Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from PGScatalog:master #146

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions curation/parsers/demographic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@

class DemographicData(GenericData):

def __init__(self,type,value,spreadsheet_name):
def __init__(self,type:str,value:str|int|float,spreadsheet_name:str) -> None:
GenericData.__init__(self,spreadsheet_name)
self.type = type.strip()
self.value = value


def update_demographic_data(self) -> None:
""" Change the default estimate_type value if no estimate is provided """
demographic_keys = self.data.keys()
if not 'estimate' in demographic_keys and 'range' in demographic_keys:
self.data['estimate_type'] = 'range'


@transaction.atomic
def create_demographic_model(self):
def create_demographic_model(self) -> Demographic:
'''
Create an instance of the Demographic model.
Return type: Demographic model
Expand Down
1 change: 1 addition & 0 deletions curation/parsers/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def str2demographic(self, field, val):
else:
variability = value
current_demographic.add_data('variability', variability)
current_demographic.update_demographic_data()
return current_demographic


Expand Down
Loading