QuantEcon / Bookshelf

Code for the site QuantEconLib
1 stars 0 forks source link

FEAT: Language detection for submitted notebooks using ipynb metadata #324

Closed AtlasMaxima-zz closed 5 years ago

AtlasMaxima-zz commented 5 years ago

Utilising the ipynb notebook meta data to automate language detection.

Expected behaviour : when user drops or submits a notebook, client side will detect the language via kernelspec and display the detected language within the section called Detected Language above Summary.

AakashGfude commented 5 years ago

@AtlasMaxima , working nicely at my end. Good job. Just one suggestion. Maybe hide the 'Detected Language' html before someone uploads a notebook, as it just looks like a line. hide_detected

Also, I guess the untracked files from the database migration branch might have been commited by mistake in this PR server/js/db/.migrate and server/js/db/migrations/1547430906567-test-migrate.js

mmcky commented 5 years ago

hey @AtlasMaxima this is great! -- my main comment is that I think we can just use Language for Detected Language but looking good. One other issue is that the drop down for language selection lists Python, Julia etc. But if we are now allowing for any kernel language specified then perhaps this needs to be a dynamic selection list?

image

I second @AakashGfude comments above.

mmcky commented 5 years ago

when I say selection list I mean the following.

image

AtlasMaxima-zz commented 5 years ago

@AakashGfude @mmcky it wasn't supposed to be just a line. I added the height to the div now and changed Detected Language to just Language

So it will look like this before uploading -

screen shot 2019-01-16 at 8 21 21 pm

And after upload, it will fill in the detected language -

screen shot 2019-01-16 at 8 21 28 pm

@mmcky I am not clear on what you mean by selection list. Are you saying change div box to a selection list and once the notebook is uploaded, the selection will automatically select the correct language ?

mmcky commented 5 years ago

thanks @AtlasMaxima.

On the front page there is the ability to filter notebooks by language. I think this dropdown needs to be dynamic (or rather the set of languages that get's submitted). That way if an Erlang notebook get's added by someone it will show up as one of the language filters. We will have to think about UI once the list grows behind 7 elements.

Also rather than Language as a blank box. What do you think about showing the language on the bottom right of the submissions pane. So that when a user drops their notebook on the submission form the inferred language shows up bottom right -- where they can see it?

image

AtlasMaxima-zz commented 5 years ago

@mmcky I like the idea of display the language on the bottom right or somewhere to make it more visible.

I just did a quick mock up but it looks a bit strange on the same line as Update Notebook and Preview buttons.

Something like this?

screen shot 2019-02-20 at 7 26 34 pm

We can also keep the placement of the language where it is now but only because visible once a notebook gets uploaded?

DrDrij commented 5 years ago

My thoughts would be that the most streamlined approach potentially being what we have live currently - a "Language" select (dropdown) element. It lists all languages that have been submitted and defaults to Python.

Once a user uploads a notebook file the select element will automatically update to match the detected language. The author has the option to choose a different language from the dropdown if they choose.

The catch here is if the language detected does not match any of the languages currently in the set it will (1) need to be added and selected as a new option in the "Language" select element (2) upon submission the new language needs to be added to the list of languages in the DB (used on the homepage for filtering, subsequent submissions).

image

DrDrij commented 5 years ago

Thinking a little more - I notice we have a disabled "Submit" button at the bottom of the update page.

Would it make more sense to move the "Update Notebook" button to the bottom? So changes to any meta information OR the notebook file are submitted in a single step.

Again this is thinking from a UX perspective - what's technically feasible/achievable might be a bit different.

image

AtlasMaxima-zz commented 5 years ago

@DrDrij this is currently what we have

screen shot 2019-02-27 at 12 10 19 am

I'm not too sure what you mean by moving the Update Notebook to the bottom when user submits a new notebook?