open5e-api icon indicating copy to clipboard operation
open5e-api copied to clipboard

Export/Conversion to Other Formats and Systems

Open Sturlen opened this issue 2 years ago • 4 comments

Being able to export Open5e data to other formats and into VTT's would be a great feature. The issue here is: how should it be implemented? Should this be a a part of the API or a separate application?

My current idea is to have an endpoint that will fetch the Open5e content and then convert it using a conversion function. e.g. /monsters/bear/foundry or /monsters/bear?format=json/foundry

As for target formats, I've seen interest for in following:

  • FoundryVTT
  • Alchemy Docs
  • Reroll.co Docs

Let me know what you think.

Sturlen avatar Dec 12 '23 16:12 Sturlen

This is a GREAT idea, and definitely needs some design/attention. What are the use cases here?

I would anticipate that a large 1 time export is more likely than a smaller single-item on-demand export. This pushes me towards desigining a bulk export feature rather than a new resource. And if we're doing a bulk export, why not do that at build-time?

That being said, there are some simple use cases that would be one-time exports. The one I have in mind is a button on a monster that's basically "send to Homebrewery" that converts the current item into homebrewery-friendly markdown and pushes it over there. I already have that here though: https://github.com/open5e/open5e/issues/395

augustjohnson avatar Jan 07 '24 13:01 augustjohnson

And if we're doing a bulk export, why not do that at build-time?

I've been experimenting with this. I create separate json files for each creature during build and host them from the web server as static files. Test is live on https://5e.spetland.no/monsters/a-mi-kuk . Clicking on JSON format at the bottom navigates to the correct json file. Supporting more export formats could be done by converting and storing that format as another option. image

This does require you to host over a thousand static assets just for the monsters, but so far I've not run into any issues with it. Might need a CDN in the future

Sturlen avatar Jan 07 '24 20:01 Sturlen

Here's my preferred approach for this:

  • Only export v2 data.
  • Have the tabular data match 1 to 1 with the tables. - I'm pretty sure this can be done on our build agents because they have the sqlite3 cli.
  • Have the data available as an Asset in the release link on github.
  • Have the data automatically added to a given Release.

I'm not sure I know enough about github and releases to automatically do this, but the commands to export should be pretty simple.

augustjohnson avatar Jun 05 '24 12:06 augustjohnson

I'm reducing the scope on this to only outputting CSV, but doing so for the v2 data. While this isn't exactly the vision of what we need, it offers a solid next step on this path.

augustjohnson avatar Aug 08 '24 23:08 augustjohnson