obsidian-tracker icon indicating copy to clipboard operation
obsidian-tracker copied to clipboard

Can't mix searchType frontmatter and text - results in either only the first target rendering or a YAML parse error

Open ThornedRose opened this issue 1 year ago • 2 comments

Using the searchType frontmatter and tags works, but mixing frontmatter and text either results in Error parsing YAML or only the first searchTarget being rendered.

Expected Behavior

So notes look something like this:

2023-11-01
---
Range: 11/22
---
This One: 16.7 ppm
Another One: 23 mcg
Third: 0.2 mmol

or

2024-01-01
---
Range: 11/22
---
This One: 14.3 ppm
Another One: 26 mcg
Third: 0.1 mmol

Range doesn't ever change between notes - it's a static value so that it renders a completely flat line in the graph.

Graph:

```tracker
searchType: frontmatter, text
searchTarget: Range[0], Range[1], 'This\s+One:\s+(?<value>[\-]?[0-9]+[\.][0-9]+|[\-]?[0-9]+)'
folder: This/Folder/
line:
    title: This One over time
    yAxisLabel: This One
    yAxisUnit: ppm
    xAxisLabel: ''
    lineColor: yellow, orange, magenta
    lineWidth: 0.5, 0.5, 1
    showPoint: false, false, true
    fillGap: true

Should result in a graph with two flat, thin lines (Range[0] and Range[1]) and This One being plotted as a graph with different values.

Current Behavior/Steps to Reproduce

Only Range[0] is rendered.

Not sure if it's something I'm doing wrong but when using the search type combo of frontmatter and tags, it worked fine. As soon as I try to combine frontmatter and text, it either only renders the first frontmatter target or has a YAML parse error.

Swapping the order of the searchTypes around:

```tracker
searchType: text, frontmatter
searchTarget: 'This\s+One:\s+(?<value>[\-]?[0-9]+[\.][0-9]+|[\-]?[0-9]+)', Range[0], Range[1]
folder: This/Folder/
line:
    title: This One over time
    yAxisLabel: This One
    yAxisUnit: ppm
    xAxisLabel: ''
    lineColor: magenta, yellow, orange
    lineWidth: 1, 0.5, 0.5
    showPoint: true, false, false
    fillGap: true

I get a Error parsing YAML.

Previously I had it set up so that it was searchType: frontmatter, tag which showed the graph correctly. However, since I want to be able to just copy-paste blood test results without converting each test item into a tag, I removed the #s back to plain text. e.g. #ThisOne: 14.3 ppm -> This One: 14.3 ppm.

If I solely use the text search type, the graph works fine but of course, doesn't have the thin reference lines I need to immediately be able to tell whether certain values are too low (Range[0]) or too high (Range[1]).

ThornedRose avatar Jan 24 '24 08:01 ThornedRose

This sounds more like you need a feature to be able to provide value markers in the graph instead? Something like:

searchType: text
searchTarget: 'This\s+One:\s+(?<value>[\-]?[0-9]+[\.][0-9]+|[\-]?[0-9]+)'
folder: This/Folder/
line:
    title: This One over time
    yAxisLabel: This One
    yAxisUnit: ppm
    xAxisLabel: ''
    lineColor: magenta, yellow, orange
    lineWidth: 1, 0.5, 0.5
    showPoint: true, false, false
    fillGap: true
    markers: 11, 22

lazyguru avatar Mar 22 '24 05:03 lazyguru

Sorry for slow reply, that would be correct. Ideally we could manually set a reference range for any given line graph, as proposed here: https://github.com/pyrochlore/obsidian-tracker/issues/308

My work around was to try using a template that automatically inserts an upper and lower reference range as part of the YAML and then actual values that change are within text. But that isn't working for me since I can't mix SearchType text and frontmatter. Not using text SearchType would require a lot of backtracking through existing diary entries (notes) and converting all the text to either YAML or using tags so I can use those two instead.

But just being able to add "markers" as a reference would work too since it's only one point of entry instead of having to add reference data to every single diary entry.

ThornedRose avatar Jun 21 '24 22:06 ThornedRose