GitMurf / csv-to-roam-table-md

Prepare/convert your CSV tables to be ready to import into your Roam Research database.
MIT License
8 stars 1 forks source link

New script idea: add date created and last edit time attributes to pages based on JSON export parsing #15

Open GitMurf opened 4 years ago

GitMurf commented 4 years ago

Slack post with all the details:

https://roamresearch.slack.com/archives/CNC4881EU/p1587839149387900

Full details from Slack:

Mitch Yesterday at 11:25 AM Hi everyone, is there maybe a feature that can extract "Created" and "Updated" datetime information of a page, and put it in the page itself?

Gijs 22 hours ago Not really but have a look at roam toolkit.

Murf 21 hours ago @Mitch I could create a script that looks at a JSON export of your DB and parses out those dates and then adds them as attributes on each page. But then would have to upload the markdown pages and choose the option to "append" to page data that is already there. Does that sound like what you are looking for?

Mitch 5 hours ago @Murf I'm not sure what you mean by 'attributes'. To provide an idea of what I'm using right now: At the top of each dedicated page, I add some metainformation at the top (see attachment). However, I put in the start date and last edit manually (in order to make the page show up on my daily pages). Ideally, Roam would update this automatically. However, if I could bulk-edit this information for all pages every now and then (which could be accomplished by such a script, if I understand you correctly), I'm sure that would already be a great time-saver!

image

Murf 2 hours ago @Mitch Roam has "Attributes"...

image

Murf 2 hours ago Here is what my "Scratch work" page looks like with the attribute... you just type :: and then the attribute/page name to use "Last Edit". It then shows it as bolded and removes the second : but the code in the block actually is: Last Edit:: [[April 25th, 2020]]

image

Murf 2 hours ago And then here is Page 2 Test...

image

Murf 2 hours ago So what I am proposing is I could create a script that would parse out the last edit / update time and the created time and then put them in as attributes (Last Edit:: and Created::) ... for example here is what a JSON export would look like for a page named "Interference": {"create-email":"--REDACTED--","create-time":1586311196718,"title":"Interference","edit-time":1586311196754,"edit-email":"--REDACTED--"}

So would:

  1. parse out the create-time and edit-time
  2. then convert to a real date and time value
  3. then create those two attributes and add to the page.

@Mitch Does that all make sense? And is that what you want?