Bridgeconn / vachan-api

The backend server that hosts all the API logic for the Vachan Engine.
Other
7 stars 20 forks source link

Fetch chapter wise data from Bible #409

Open kavitharaju opened 2 years ago

kavitharaju commented 2 years ago

Now there are two APIs, one for fetching verses lists and the other for fetching entire book in different formats like USFM , JSON etc.

On VO, it is required to show contents of one chapter. They use the JSON representation to display verses, titles and other contents on web. Need a new API to fetch contents chapter-wise. This API should also return info on next and previous chapters for easy navigation based on versification of the Bible

joelthe1 commented 2 years ago

I wonder if it would be better to have one API that accepts query params for BCV e.g. .../?book=MRK&chapter=15&verse=1-20

And maybe it returns info on what the next or previous BCV is.

RevantCI commented 2 years ago

Query params should also work, if it can parse (bookcode chapter/chapter range:verse/verse range) 1jn 1 or jhn 1:12 etc it would also be great. Response JSON Next and previous should be fine at the chapter level ke next BC and previous BC. Also usually look at bible gateway so in the search bar these we have more flexibility. So was hoping to have something like that in the future. That is was hoping to have multiple bcv like jhn1;gen2:1-3;1pe2:3; col1-2 in one api call. That is multiple BC or bcv seperated by colon; You can try it in bible gateway. It's quite useful to me in my bible studies. Usually just copy paste the bible references from my notes pdf in the search bar and it gives me all of them in the same page. Alternative we could send them individually to the api server from the UI.

kavitharaju commented 2 years ago

For supporting fetching of verses with different patterns of BCV, ie just B, BC, BCV, BCV1-V2, we do have this API, /v2/bibles/{source_name}/verses . But this returns just the cleaned verses, not the JSON structure corresponding to USFM with the metascripture contents like section headings, footnote etc. Also, if discontinuous ranges are to be fetched, this requires multiple API calls.

But, in this requirement, it is the VO's need for a JSON structure corresponding to USFM -chapter-wise, that we are focusing to deliver. Splitting up this JSON into verses level is not going to be a very straight forward task as verse boundary is ambiguous in the underlying USFM itself. So, for this requirement, I think, it would be better to serve just the chapter-wise content in the JSON format, which serves the VO's need.

kavitharaju commented 2 years ago

Two REST APIs have been implemented that provides USFM-Grammar's features as APIs and also allow to extract just one chapter from the whole content.

To Dos: