drdhaval2785/SanskritVerb

Frontend Optimization

Closed this issue · 20 comments

@rramphal

For better understanding of what are my requirements for frontend optimization, I would like to jot down them with relevant references, so that you can read and then we can discuss.

  1. Serving JSON / some other format from backend.
  2. The frontend applications (Web browser, Android App, ios app etc) can read these JSON and display with javascript or other languages.

https://github.com/drdhaval2785/SanskritVerb/blob/master/panini.php#L14440 - Appends to the list of generatedforms in XML format.
https://github.com/drdhaval2785/SanskritVerb/blob/master/panini.php#L14490 - Prints HTML for tiGanta.
https://github.com/drdhaval2785/SanskritVerb/blob/master/panini.php#L14536 - Prints HTML for subanta.
https://github.com/drdhaval2785/SanskritVerb/blob/master/panini.php#L14570 - Writes to log file.

The helper functions are in https://github.com/drdhaval2785/SanskritVerb/blob/master/scripts/function.php

  1. For frontend display, I would love to have something like http://www.ashtadhyayi.com/sutraani/1/1/1.

Now that you have a REST API-like server, achieving 3 should be feasible. We have a UI for our sanskrit_parser project that can be modified for displaying data from this project. It is not as fancy as ashtadhyayi.com, but it should be a good start. Let me know if no one is working on creating a UI yet, and I can take a stab at it.

Please take a stab at it.

@avinashvarna, I reached out to @drdhaval2785 a while back to improve the frontend, but life got in the way. In the end, I wasn't really planning to add any features or anything — just a basic styling of the page. But since you already have some code that you could reuse, I'm thinking that would be much faster.

And @drdhaval2785, I'm sorry I haven't been able to do much by way of the frontend, but I'm glad that someone else is helping!

I'll keep an eye out for ways I can help after the sanskrit_parser code is implemented! :)

@rramphal We all go through cycles as life ebbs and flows. Feel free to contribute when you are free.

@drdhaval2785 Can you please enable CORS on the server? I started creating the UI, but cannot test it as your server doesn't seem to allow requests from a different origin. I will try to install the server locally for testing.

@avinashvarna
drdhaval2785/prakriya@01bb5ea I have tried to enable CORS on server.
Kindly check whether you are now able to request the server or not.

@rramphal
Great to hear from you after quite a long time.

I have a UI here - https://avinashvarna.github.io/prakriya/ served from https://github.com/avinashvarna/avinashvarna.github.io
It works when I open the index.html file locally and run it. However, since github uses https, and the API server is on http, Chrome blocks the request since it is going to a non-https page.

@drdhaval2785 Any chance of enabling https on the server? For now, you can test the UI locally and let me know if you want any changes.

Any chance of enabling https on the server?

I will ask the webmaster and see if that is a possibility.
Locally it works well.

For now, you can test the UI locally and let me know if you want any changes.

Sure. Will do that and let you know the feedback.

  1. Can we have prakriyaa 1 expanded by default?
    It is a bit clumsy to click on it to see the result.
    If users want to see prakriya2, 3 ... etc they may need to click.
    First one expanded by default.

Done. Added a line indicating no. of prakriyas found so that people know there are more results.

Seems cool.

Added a line indicating no. of prakriyas found so that people know there are more results.

Clever thought.

  1. Currently I type 'Bavati' and press enter. But as GO is not autofocused or something like that, I have to press tab thrice and reach GO and then press enter.
    The input and output preferences are less likely to change.
    So most of time people will be skipping them.

Any chance of enabling https on the server?

Now it is on https. Kindly check.

Now it is on https. Kindly check.

https works. I switched the query url to use https correctly.

I have to press tab thrice and reach GO and then press enter.

Fixed Enter key handling (it's a bit of a hack, but works...)

Also added a report issues link at the top. Let me know if you want issues reported elsewhere.

Because of feedback of @vvasuki, the code was modified to take into consideration the input and output transliteration and API moved to v0.0.2.
https://api.sanskritworld.in/#!/default/get_get_prakriya

https://api.sanskritworld.in/v0.0.2/input/slp1/output/devanagari/jagAma/prakriya is the example URI.

Based on this, the frontend will also need a bit of tweaking.
Now the transliteration stuff is taken care of at API level itself.

Let me know if you want issues reported elsewhere.

I would love it at https://github.com/drdhaval2785/prakriya/issues

I've updated the URL to v0.0.2, For now, I've kept the transliteration in the javascript, till drdhaval2785/prakriya#8 is fixed.

I would love it at https://github.com/drdhaval2785/prakriya/issues

I've updated the link in the UI. We can move this discussion there as well, since it is more related to the API exposed in that repo.

The UI looks quite good! (The nice things one can accomplish with simple tech~)

@avinashvarna - you should lint that js before it becomes a problem!

@vvasuki Will lint.

The initial expectation for having something like ashtadhyayi.com is fulfilled. ashtadhyayi.com/dhatu/ is another frontend for API.