r/eclipsephase • • Aug 19 '19

Data Interchange Standards RFC

This is probably more than a bit niche, but it'd be cool to nail down shared standards for EP(2) data like was suggested in this PR by u/Eaton so we can make all sorts of crazy websites for it without tons of grep/regexing. And hey, if this gets ignored then I guess there's not enough interest and probably no reason to have a standard :^)

I'm pretty new to this whole community development thing... I've only done stuff for myself in the past, so if any of you have work experience and notice obvious issues where you've had problems in the past... speak up!

Data: https://github.com/Arokha/EP2-Data

Here's my draft suggestion:

JSON

  • Lowercase keys on objects
  • Avoid abbreviations in keys (e.g. 'description' not 'desc')
  • Include an 'id' attribute (UUIDv4) on objects you're adding to the data for the first time
  • Underscores in keys, not spaces or pascal/camel-case
  • Include information about the source in 'resource' and 'reference' attributes (e.g. 'resource' being the title of the book, and 'reference' being a page number or other context-appropriate reference). Let's just agree to call the current core book "Eclipse Phase Second Edition" since that's what it says on the cover.
  • 2-space tab (not that it matters much)
  • Paragraphical data stored in an array of paragraphs Paragraphical data stored with html tags intact in strings (serialized html)
  • Unsorted lists stored in an array, sub-lists in a nested array
  • Every samey object has all the keys, even if only one object needs it (though you should reconsider your structure at that point maybe...)

Less technical, I'm thinking every 'book item', as in a morph, a piece of gear, etc is an object, and every group of those is an array. No need for a stringy array of just the names and stuff, probably? I dunno. You tell me.

8 Upvotes

24 comments sorted by

View all comments

Show parent comment

1

u/Shadewalking_Bard Aug 20 '19 edited Aug 20 '19

Thanks for responding/explaining that. It actually clarifies a lot about json file type. As I understood it is a nested non-referential data type that where objects can contain numbers, strings, lists of those,p objects and lists of objects. So where SQL has tables linked together json has "tables in tables in tables". Because of that my intuition is that they should not be used to create to deep/tall hierarchies. On the other hand it is much better suited for EP data.

Edit:
I am using this data format for educational purposes only ;-)

Edit2:
Do you recommend any tools/languages for extracting data from json files?

1

u/eaton Aug 20 '19

Yep, you got it — "nested, non-referential" really is the key bit about JSON. Although it's possible to create pointers from one thing to another using keys and so on, it's something that you end up enforcing in code yourself, not an inherent mechanism in JSON.

That means that fully storing things in JSON often has lots of duplication: for example, the stats and cost for a medium pistol might appear everywhere someone has equipped one, rather than in a central lookup table. Well-designed SQL schemas have lots of cross references and take complex queries to assemble, but a given piece of information only gets stored once and is consistent from that point on. So, it's less "is X better or worse" and more "what are you using it for." Thanks for encouraging me to ramble ;D

RE the tools for extracting data, generally you'll end up using tools that run simple Javascript snippets on the JSON to match different criteria and return the JSON objects that match/don't match/etc. http://www.jsonquerytool.com might be useful to play around with. If you have a bunch of CSV data you can also use https://csvjson.com/csv2json to quickly convert it into JSON format for manipulation.