Skip to content

Analysis cart creation #1025

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

Closed
wants to merge 24 commits into from

Conversation

squirrelo
Copy link
Contributor

This pull request creates the carts for each user and the cart viewing page. Major pieces are:

  • Default user analyses added to act as carts
  • Analysis.get_user_default(User) function added to get the default analysis for a user
  • processed_data.processing_info added to get processing information needed for cart display.
  • Cart viewing page added at http://localhost:21174/analysis/selected/ Logging in as test@foo.bar using the test database will prepopulate it with a few samples selected so you can view the page. Currently the page can only be accessed through direct URL.

This is the final piece needed before tying everything together from the last few pull requests into a single unified sample selection system.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.02% when pulling 68488c7 on squirrelo:cart-analysis-changes into 54f63e9 on biocore:master.

@squirrelo
Copy link
Contributor Author

Ready for review/merge

@antgonza
Copy link
Member

antgonza commented Apr 1, 2015

Note that #1006 also has a 20.sql. My guess is that this should be 21.sql, right?

@squirrelo
Copy link
Contributor Author

If that pull request is merged first, yes. I'll update once it's merged.

@squirrelo
Copy link
Contributor Author

Neither pull request depends on the other, so feel free to review and merge this one first as well.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.06% when pulling 90b3de2 on squirrelo:cart-analysis-changes into 9350269 on biocore:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling bd3d513 on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@@ -79,6 +79,26 @@ def _status_setter_checks(self, conn_handler):
raise QiitaDBStatusError("Can't set status away from public!")

@classmethod
def get_user_default(cls, user):
Copy link
Contributor

Choose a reason for hiding this comment

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

Uhm... from my point of view, is usually better to ask the user: give me your default cart. It will be a instance method rather than a classmethod, which is already a signal of better design...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows you to return the actual object already instantiated, as opposed to just the ID and instantiating, saving a DB call. Do we care about the extra DB call?

Copy link
Contributor

Choose a reason for hiding this comment

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

You are not saving any DB call...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The check if ID exists on Analysis instantiation isn't needed in this case. That's the DB call I'm referring to.

Copy link
Contributor

Choose a reason for hiding this comment

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

That call is executed when you are doing cls(aid) (It is calling the init)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, didn't realize that. Sure, can make that change then.

@squirrelo
Copy link
Contributor Author

ready for review/merge

static_info = conn_handler.execute_fetchone(sql, (self.id,))

# Get the info from the dynamic table, including reference used
sql = """SELECT * from qiita.{0}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting confused in this SQL query, it looks like it is enough to do:

SELECT * FROM qiita.{0}
  JOIN qiita.reference USING (reference_id)
WHERE processed_params_id = {1}

I think this SQL query can return only a single value, since there will be only one row with the given processed_params_id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, was being way to protective about the join screwing up. Changed.

@josenavas
Copy link
Contributor

Few comments @squirrelo
I will pull it down and test it locally once these issues are solved.

Thanks!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling 1dc1440 on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling 1dc1440 on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@squirrelo
Copy link
Contributor Author

All comments addressed, ready for another round of review.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling cf1123f on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@squirrelo
Copy link
Contributor Author

Can this get a quick final review? It's holding up the remaining work needed to create the cart.

@josenavas
Copy link
Contributor

@squirrelo code looks good but the /study/description page is broken. Just log in with the default user and try to see the description of the test study. The page doesn't render. It works on master so it is something on this PR...

@josenavas
Copy link
Contributor

@squirrelo I just saw the traceback on the CLI:

ERROR:tornado.application:Future exception was never retrieved: Traceback (most recent call last):
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/gen.py", line 197, in wrapper
    result = func(*args, **kwargs)
  File "/Users/jose/qiime_software/QiiTa/qiita_pet/handlers/study_handlers/description_handlers.py", line 641, in display_template
    prep_tab=prep_tab)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 664, in render
    html = self.render_string(template_name, **kwargs)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 771, in render_string
    return t.generate(**namespace)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/template.py", line 278, in generate
    return execute()
  File "study_description_html.generated.py", line 198, in _tt_execute
    _tt_tmp = _tt_modules.ProcessedDataTab(study, full_access)  # study_description.html:518 (via sitebase.html:192)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 1429, in render
    rendered = self._active_modules[name].render(*args, **kwargs)
  File "/Users/jose/qiime_software/QiiTa/qiita_pet/uimodules/processed_data_tab.py", line 24, in render
    study_id=study.id)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 2691, in render_string
    return self.handler.render_string(path, **kwargs)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 771, in render_string
    return t.generate(**namespace)
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/template.py", line 278, in generate
    return execute()
  File "study_description_templates/processed_data_tab_html.generated.py", line 49, in _tt_execute
    _tt_tmp = _tt_modules.ProcessedDataInfoTab(study_id, pd)  # study_description_templates/processed_data_tab.html:23
  File "/Users/jose/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 1429, in render
    rendered = self._active_modules[name].render(*args, **kwargs)
  File "/Users/jose/qiime_software/QiiTa/qiita_pet/uimodules/processed_data_tab.py", line 56, in render
    process_date = processed_data.processed_date

Probably useful to do a search over processed_date in the entire codebase

@squirrelo
Copy link
Contributor Author

Did, just missed that one. Good catch.

<h2><a href="/study/description/{{sid}}">{{study.title}}</a></h2>
<table class='table table-striped' id='study{{sid}}-table'>
<tr>
<th></th><th>id</th><th>Datatype</th><th>Processed Date</th><th>Algorithm</th><th>Reference</th><th></th>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change the id by Processed data id? The issue is that in the actual page we don't know what is that id for, is not completely clear...

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, is it possible to add a modal that will show the full list of parameters used to process data processed data? I can see this really useful to further samples/processed data filtering

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the show/hide samples at the end of the table, is more natural IMOO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had it there, but the samples come up on the very left so it's more natural to hit the link and then immediately scroll down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add the rest of the changes though

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to disagree about your previous statement. What about this layout?
screen shot 2015-04-03 at 10 50 01 am

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling 15c71dc on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@squirrelo
Copy link
Contributor Author

Interface changes made, ready for another review.

@josenavas
Copy link
Contributor

I think you did not see my comment. Posting the layout here again:

screen shot 2015-04-03 at 10 50 01 am

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling 8e129e6 on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling d7b4778 on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 79.15% when pulling d7b4778 on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@squirrelo
Copy link
Contributor Author

All set for another round.

@josenavas
Copy link
Contributor

Thanks @squirrelo one more comment. Instead of adding the info gif that you used, can you use glyphicon glyphicon-info-sign? I think it will be more consistent with other icons on the system

@squirrelo
Copy link
Contributor Author

Oh, yeah that makes sense.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.13%) to 79.09% when pulling ba42c6a on squirrelo:cart-analysis-changes into 9068d4c on biocore:master.

@squirrelo
Copy link
Contributor Author

Closing to open as a pull request on a separate branch.

@squirrelo squirrelo closed this Apr 3, 2015
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.

6 participants