Skip to content

Fix getresultvalues #136

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

Merged
merged 3 commits into from
Jan 5, 2018
Merged

Conversation

lsetiawan
Copy link
Member

Overview

This PR addresses #127. It changes the lowercase dataframe columns to the same cases as the model colump properties.

@emiliom
Copy link
Member

emiliom commented Jan 5, 2018

@lsetiawan I have a broad question: this is a PR on master. But there is a bunch of commits on a dev branch that @Elijahwalkerwest will merge into master soon, hopefully early next week, right?

Given that, is it better to wait until Eli has merged his accumulated commits into master? Or are you ok with merging this PR now and possibly needing to spend time resolving conflicts later?

@@ -120,10 +120,23 @@ def assignRelatedFeatures(self, relatedfeatures):
self.related_features = related


class ReadODM2(serviceBase):
def _get_columns(self, model):
Copy link
Member

Choose a reason for hiding this comment

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

Nice! 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks 😄


"""
type = self._session.query(Results).filter_by(ResultID=resultids[0]).first().ResultTypeCV
restype = self._session.query(Results).filter_by(ResultID=resultids[0]).first().ResultTypeCV
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for using this opportunity to eliminate the use of reserved words (type), specially in a case like this one where it'll have no impact at all to code using this function.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, come to think of it, there's already a variable below called ResultType. restype and ResultType seem too similar, and that's confusing. How about renaming ResultType to ResultValues, assuming that doesn't lead to other conflicts or confusion?

Copy link
Member Author

Choose a reason for hiding this comment

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

I needed to refresh to see this comment, I'll make that change. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

That was fast. Great.

@@ -1310,6 +1331,7 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
con=self._session_factory.engine,
params=query.params
)
df.columns = [self._get_columns(ResultType)[c] for c in df.columns]
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@emiliom emiliom left a comment

Choose a reason for hiding this comment

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

Looks great, other than my suggested change regarding variable naming.

@lsetiawan
Copy link
Member Author

@lsetiawan I have a broad question: this is a PR on master. But there is a bunch of commits on a dev branch that @Elijahwalkerwest will merge into master soon, hopefully early next week, right?

This is a PR to the dev branch that we have been merging into. This dev branch will then merge into master soon.

my suggested change regarding variable naming

Unlesss I'm missing something, I don't see comment in regard to variable naming.

@emiliom
Copy link
Member

emiliom commented Jan 5, 2018

@lsetiawan I'll hold off on approving and merging, until I hear back from you about my broader comment plus my suggestion to rename a variable. But nice job!

Also, let's make sure Jeff et al are very aware of this change. Correct me if I'm wrong, but all existing code that uses output from this function will need to be upgraded to the case-sensitive dataframe column names, right?

@emiliom
Copy link
Member

emiliom commented Jan 5, 2018

This is a PR to the dev branch that we have been merging into. This dev branch will then merge into master soon.

Great. My bad! I thought I checked for that, but obviously I didn't! My excuse is that this is my first PR review in a month, and ... also ... this year 😜

@emiliom
Copy link
Member

emiliom commented Jan 5, 2018

Ok, I'll merge once the CI's are done.

@lsetiawan
Copy link
Member Author

Correct me if I'm wrong, but all existing code that uses output from this function will need to be upgraded to the case-sensitive dataframe column names, right?

Yes, if a code is doing df['datavalue'] for example, it won't work anymore.

@emiliom
Copy link
Member

emiliom commented Jan 5, 2018

I'm assuming we can ignore the AppVeyor failures. So, going ahead and merging the PR.

@emiliom emiliom merged commit cb30fbe into ODM2:development Jan 5, 2018
@lsetiawan lsetiawan deleted the fix_getresultvalues branch January 5, 2018 21:06
@lsetiawan
Copy link
Member Author

Awesome! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants