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

TVB-2689: add summary_info to DataType indexes #139

Merged
merged 7 commits into from
May 8, 2020
Merged

Conversation

adrian-dordea
Copy link
Member

@adrian-dordea adrian-dordea commented May 5, 2020

After the split in multiple layers on datatypes, we no longer had "scientific Details" in a DataType overlay. We need to add something similar with the previous summary_info on DataType indexes.

@liadomide liadomide changed the title WIP TVB-2689: add summary_info to DataType so Scientific Metadata is … WIP TVB-2689: add summary_info to DataType indexes May 5, 2020
@popaula937 popaula937 changed the title WIP TVB-2689: add summary_info to DataType indexes TVB-2689: add summary_info to DataType indexes May 7, 2020
Copy link
Member

@liadomide liadomide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, so far, but see the comments on Jira task

return ret

@property
def get_base_table_columns(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use name get_... then leave it a normal method and call with self. get_base_table_columns()
if you make it a @property, then a better name would have been def base_table_columns(self):
Particularly in this case I would use neither, but a private method (so not a property) def _get_base_table_columns(self):

columns = self.__table__.columns.keys()
if type(self).__bases__[0] is DataType:
return columns
base_table_columns = type(self).__bases__[0].__table__.columns.keys()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go just one level up in inheritance, and not consider multiple inheritance.
Will this be enough for all our use-cases?

columns.extend(base_table_columns)
return columns

def get_attribute_name(self, attr_name):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general a new method is not a bad idea, but in this case, I suggest to inline the code and don't put this part in another method, because the return None convention is odd and a bit of an antipattern

@liadomide liadomide merged commit 5b158ce into master May 8, 2020
@liadomide liadomide deleted the TVB-2689 branch May 8, 2020 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants