Inspired by org-mode properties and columns, I propose an plugin idea of a syntax and query system to make a database out of inline entries.
The syntax may look like this:
:jogging:
- start:
** date: 2022-10-04T0720
** place: South Park - end:
** date: 2022-10-04T0740
** place: North Park - duration: {dur(start.date, end.date)}
- distance(km): 4.0
An entry has an ID (jogging) followed by properties structured hierarchically. It might be useful if a simple calculation is available inside an entry (but this is pretty optional).
TABLE from jogging, dur(start.date, end.date) AS TIME, distance(km) AS DISTANCE
WHERE distance(km) => 4
Entries would be collected and shown by dataview-like query. I think this function could be realized in a similar way to obsidian-tasks.
{DATE: 2022-10-04}
:meal:
- name: udon
- type: lunch
- nutrition:
** kcal: 500
** pfc: (5, 10, 20)
** salt: 3 - price(JPY): 400
Another use case collects basic information of each meal. Elements written in some specific way in the headline would be inherited.
TABLE nutrition.pfc[0] AS PROTEIN, price AS PRICE, nutrition.pfc[0]/price AS CP
WHERE (on OR after <% start_of_month %>) AND (on OR before <% end_of_month %>)
This query shows the cost-performance (CP) of protein intake in a month with obsidian-templater though I’m not sure who wants to know that.
The intext database could be expanded to a daily timeline, a calculation of calories-in and -out, and a monthly balance sheet.
I’m waiting for your comments or advice.