Here are some requirements to consider for representing suttas in JSON. Most of the following should be obvious, but there may be some nuances for discussion:
- unique JSON document for Pali sutta we must have one and only one canonical JSON document for each Pali sutta.
- unique JSON document for each sutta translation we must have at most one JSON document for each sutta translation. I.e., it’s fine to include translations with the Pali original JSON
- segment id lookup: we must be able to get from a text segment id to the corresponding text segment with ease. Note: using a JSON object keyed by segment id would do this
- immutable segment ids: segment ids are used for translation references and must therefore be global and permanent. Note: We should probably just leave the current segment ids as they are, inconsistencies and all
- segment sequence: must be derivable from the JSON. Note: if we use segment-ids as JSON object keys, the segment-ids must be sortable, since there is no guarantee of key sequence in JSON objects. Given the inconsistencies in segment ids today, I’m not sure if we can guarantee that sorting order matches sutta order
- diff-able: we must be able to compare different revisions of a sutta or translation of a sutta. Note: Existing JSON diff utilities already do this.
- presentation support at sutta granularity It must be possible to generate HTML for the entire sutta from the JSON document. I.e., let’s not have a separate document for presentation.
- presentation support at segment granularity It must be possible to generate HTML for a single text segment from the JSON document Note: this is probably trivially achieved by wrapping the segment in <div class=“myfavoritesegmentcss”>
- support Pali canon line groups: The Pali canon groups lines together and so should we for Dhamma transmission fidelity
- presentation support at Pali canon line group granularity It must be possible to generate HTML for a Pali segment group from the JSON document. Note: this is probably trivially achieved by wrapping the segments in <div class=“myfavoritelinegroupcss”>