Gosh I need to get off my toushy and make this happen.
The good news is I'm kind of being forced to do roughly the same thing in another context, so I'm getting valuable experience that will make the last bits come together easier.
But until then....
Quick question for you @curiousdannii. I've got a giant pile of data in a JSON array. Each entry has assorted keys that go with it, one of which is an OSIS format reference. I need to sort the entire array using the first verse in the OSIS reference (which might be a range). Any ideas of the top of your hear? Did that BCV parser have a function that I could use as a callback for this? Have you run across doing this anywhere else? Surely I would be re-inventing the wheel to try to code something up.
@curiousdannii No they are not. But I could add another key with the first verse in the set if that's the hold up, the OSIS refs are already going to be in order as far as each value goes.
@curiousdannii Okay this is sounding promising. I'll look into it.
@Caleb Ah, okay, yeah that shouldn't be a problem at all. Split by commas, then by hyphens so that you only have one reference. Then split by periods. Then write a comparison function which checks the book, chapter, and verse in order.
(Or use a regex to cut at the first comma or hyphen)
@curiousdannii I can handle that end. I can also add a key that has just the data I need to use for this. The data sets aren't huge (5k at the outside and it doesn't need to run frequently) but might it not be more efficient to do some sort of parsing first and just save an order key of some kind that can be numerically sorted later?
Can I get an absolute verse sequence number for an given OSIS ref from BPVP?
@Caleb A comparison function should be pretty efficient, especially when your data set is smallish and it's only run infrequently. It's a lot simpler than having to ensure that a second key is kept up to date.
@Caleb I don't think so. I had to make my own function for counting verses, and that was only inside of a book.
@curiousdannii The data set is automatically extracted anyway so that's a non-issue. And the extraction would run again any time the source data changed, which is also when a new sort would have to happen, so it's six of one, half dozen of the other.
@curiousdannii "XXXYYYZZZ" where X in the book number, Y is the chapter, and Z is the verse, padded so a numerical sort will return them all in the absolute right order?
This is sounding easy. Time to hack on bcv_parser.translations.default.order.
@curiousdannii "XXXYYYZZZ" where X in the book number, Y is the chapter, and Z is the verse, padded so a numerical sort will return them all in the absolute right order?
I'm building 2 things at once: a reverse index to put in an appendix in the back of books that lists all references in a work and what page they appeared on, plus a sidebar for an online Bible reference tool that lists every book & page in published books that talks about any of the currently displayed verses.
@curiousdannii Yes, I will need to account for the ranges for the online version. Right now I have to send another book to press this week and want to get this appendix in so I just need the first one from each range. The displayed label will show the range but the sort is just on the first verse.
@curiousdannii This might be the simplest bit yet ;-) Overall this is a steaming pile. If nothing else the identity crisis it has with half the variable names in Turkish and half in English is enough to keep most people away. If not that, 800+ lines of Makefile inception would do the job.