Workflow to export event dates for use in other applications?

Let’s for this scenario presume I write a story (ok, it is a roleplaying campaign), where I have a lot of dates in an Aeon timeline. As I have not yet settled on which date the story starts, I also have one event named “Story begins”, which is set at the date I currently plans for the story to start. I have few dependencies between events, but they do exist, and I use a lot of persons and quite a few locations.

My question is really what a reasonable workflow would be to export the timeline to an e.g. CSV file for inclusion in other applications?

I plan my story in a set of Markdown files (using Emacs) and I would like to have a number of “variables” in the text, e.g. $FrodoLeavesBagsEnd, which would be expanded (by scripts I already have) to “23rd Septemeber 3018”. I intend to have a Python script reading the CSV file and the Markdown file and generate e.g. an HTML file. I am fine with writing that Python script, this is not the issue.

I will have events in the timeline like (all text stolen from Tolkien Gateway for this example):

  • 23 September: Frodo leaves Bag End
  • 24 September: Frodo is nearly caught by the Nazgûl
  • 26 September: Frodo travels through the Old Forest

I cannot have “and on the date $Frodo leaves Bag End, ImportantPerson travels to…”, it could be “and on the date $Frodo_leaves_Bag_End, ImportantPerson travels to…” but is inelegant.

My first question, for those that have endured to the end of this post, is if there is some nice feature of Aeon I could use to define e.g. $FrodoLeavesBE? I could use the tags, I presume, but defining them all by hand will be cumbersome. Any ideas?

My second question is, if there are some nifty feature to handle “time since”? Is there some field for an event that gives the time duration from some other event (e.g. “Story begins”) this event begins or ends? I could let my Python script calculate this, but want to explore the options in Aeon first.

I want to use Aeon as the prime master database of all dates for the story.

My third question is if it is possible to trigger an export of a timeline to CSV? I didn’t see any support for AppleScript but it would be nice to let my script above check if the timeline has been updated since the CSV was last updated and then trigger an update of the CSV file.

I think this is actually a moot point. I found out that the file is a json file and that jsondata['core']['data']['itemsById']['y1VkDxUgLoNQn30d5ZVEs'] is the event itself and jsondata['core']['data']['itemDatesById']['y1VkDxUgLoNQn30d5ZVEs'] is the date information for that event. I could reverese engineer the file format, but is it possible to find some description of the format?

I’m not quite sure if I’ve understood you correctly. Do you want to create placeholders for certain dates in Aeon Timeline in order to use them with your own program?
I would simply use events and mark them specially (e.g. tag, color, or belonging to an arc). After importing the data into your Python script, you can identify these events and create a {label: date} mapping dictionary. This you can e.g. apply to a Python Template string.

If you want to read the .aeon file format with Python, some modules I have already written might help you.

The .aeon file format is a combination of binary data and JSON text. It is discussed elsewhere here in the forum, just do a search.
Anyway, the main work in processing the format consists of looking up the many UID references. I wrote a Python class that provides useful dictionaries for this purpose (see above).

1 Like

I will definitely look into your code, I just had a quick browse and I think I will shamelessly steal portions of it! :star_struck:

To try to elaborate a bit on my idea/system: What I want to do is to define an event in my Aeon timeline, e.g. “Frodo leaves Bag End”, and then have an identifier (or more specifically a macro) associated with this that that I can use in my Markdown text. The Markdown will be preprocessed by GPP (which is a preprocessor very much like CPP) and it expands these macros into e.g. “23rd September 3018”, before the Markdown is sent to Pandoc for conversion to e.g. HTML.

My python script would read the Aeon file and create an include file which defines all the macros and then GPP would use it to find and replace the macros in the Markdown file.

I could have my python script to generate macro names from the event name, i.e. just remove spaces and illegal characters (e.g. FrodoLeavesBagEnd), but I was thinking of if there were some other mechanism in Aeon I could use for this.

The same goes for the second question, I could solve it myself “quite” easily, but I wanted to see if there were some feature of Aeon I could use.

That doesn’t sound too difficult. Maybe it’s because I’m not familiar with the intricacies of your project, but the macro preprocessor thing sounds a bit over-engineered to me. I mean, it can be done with a few lines of Python if you use your Markdown texts directly as templates, as I recommended above.

By the way, you don’t need to steal my code, I have released it under a most liberal license.
Good luck!

P.S.
With pypandoc you can put everything in one Python script.

As far as the features you are looking for in Aeon Timeline 3 are concerned, I’m afraid I can’t tell you anything. Perhaps there is a power user who knows more?

P.P.S

This is an example for what I mean with “a few lines of Python”. Enjoy.

from string import Template

initialText = """
# Chapter One

The adventure starts on $Frodo_leaves_Bag_End, a bright day.
"""
map = {'Frodo_leaves_Bag_End': '23rd Septemeber 3018'}
finishedText = Template(initialText).safe_substitute(map)
print(finishedText)

Just to clarify that: I already have a tool chain in place using GPP and pandoc, if this would’ve been a new tool from scratch, I agree it would be too complicated.

(I would probably use re.sub() instead of templates because templates throws exceptions if there are too many or too few keywords. I also prefer to have @Frodo rather then $Frodo because @ is better located on a Swedish keyboard – I used $ in my example as it a more common macro character and thus less confusing examples, I thought.)

Well, I see. So many roads lead to Rome, don’t they?

This applies to Template.substitute(). Anyway, the Template.safe_substitute() method is the variant that doesn’t raise the exceptions.

Cheers,
Peter

1 Like

Am I correct in assuming there is no feature in Aeon I can use for any of my tasks? I have no problem implementing it myself, but I would prefer to use Aeon to its full extent. I also see this as a good opportunity to really learn Aeon.

I really enjoyed this discussion, even though I understood only about 10% of it.

Makes me want to learn Python…

But, alas, I’m at the mid-point of my novel. Got to focus on that! :slight_smile:

1 Like