Note aging

A very interesting approach, @AlanG !
I tried something different, using the dataview and metaedit plugins and starting with one of the examples in the metaedit rep. The result looks like this:


The entries are sorted by last review date and by creation date secondarily. Filtering by note names, folders and tags is possible (see code below). Clicking on a button in the right column creates or updates the metadata entry to the current date.

This is the code, just copy it in an empty note and make sure to have both dataview and metaedit plugins installed:

```dataviewjs
// Filter for which notes to query - "Note Review" is the
// name of the note containing this script
const filter = '-"Note Review" and -"Templates" and -"Archiv" and -#taskdone'
// Name of the metadata entry
const metaentry = "reviewed"
// How many results to show in the table
const nresults = 15

// get the metaedit API methods
const {update} = this.app.plugins.plugins["metaedit"].api;
const {createYamlProperty} = this.app.plugins.plugins["metaedit"].api;
const {getPropertiesInFile} = this.app.plugins.plugins["metaedit"].api;

// create a button
const buttonMaker = (pn, pv, fpath) => {
    const btn = this.container.createEl("button", {"text": "Rev. today!"});
    const file = this.app.vault.getAbstractFileByPath(fpath);
    btn.addEventListener("click", async (evt) => {
        evt.preventDefault();
        const props = await getPropertiesInFile(file);
        let is_in_props = false;
        for (const prop of props) {
	        if (prop["key"] === pn) {
		        is_in_props = true;
		    }
	    }
        if (is_in_props === true) {
	        await update(pn, pv, file);
        } else {
	        await createYamlProperty(pn, pv, file);
        }
    });
    return btn;
}

// create the table
dv.table(
	["Name", "Reviewed", ""],
	dv.pages(filter)
	.sort(t => t.file.ctime, "acs")
    .sort(t => t[metaentry], "asc").slice(0,nresults)
    .map(t => [
		t.file.link,
		t[metaentry], 
		buttonMaker(
			metaentry,
			new Date().toISOString().slice(0,10),
			t.file.path
		)]
	)
)
```
1 Like

Use case or problem

I am trying to have a clear vision of notes that are still relevant.
Some notes only make sense for a brief period of time.

Proposed solution

  1. The user adds metadata to a note, say “Expiration date”, “Expire after X days”.
  2. Once the sufficient amount of time has elapsed, Obsidian “cleans up” the “expired notes”. Or add a way to ignore “expired notes” .

There is already an existing plugin idea thread for this, so I’m going to merge this into there. There is also some discussion in that thread that might show you some existing workarounds.

Also look into this thread for an idea: Review old notes, aging notes, spaced repetition