Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Markdown in metadig report view #2394

Open
jeanetteclark opened this issue May 1, 2024 · 1 comment
Open

Support Markdown in metadig report view #2394

jeanetteclark opened this issue May 1, 2024 · 1 comment

Comments

@jeanetteclark
Copy link
Collaborator

Describe the feature you'd like

Rendering Markdown using showdown.js on metadig reports would give us a lot of flexibility to create much better looking reports.

Is your feature request related to a problem? Please describe.

We would like to show some informational checks with tables showing summaries of files. For example

"\nTable: Data summary\n\n|                         |     |\n|:------------------------|:----|\n|Name                     |df   |\n|Number of rows           |56   |\n|Number of columns        |2    |\n|_______________________  |     |\n|Column type frequency:   |     |\n|character                |2    |\n|________________________ |     |\n|Group variables          |None |\n\n\n**Variable type: character**\n\n|skim_variable        | n_missing| complete_rate| min| max| empty| n_unique| whitespace|\n|:--------------------|---------:|-------------:|---:|---:|-----:|--------:|----------:|\n|X                    |         0|             1|   0|  34|     8|       42|          0|\n|For.all.Sample.types |         0|             1|   0| 979|     6|       49|          0|\n\n"

would look like:

Screen Shot 2024-04-30 at 5 03 57 PM

(except without the colors maybe)

Right now the best we have is:

Screen Shot 2024-04-30 at 4 35 42 PM

which is not so readable.

I'd argue that this functionality is basically a requirement for the data quality suite to proceed. @mbjones can also weigh in on priority

@mbjones
Copy link
Member

mbjones commented May 1, 2024

@jeanetteclark Fully agree that markdown support in check results would be super useful.

I briefly looked into how we handle this in the current system. Basically, there is a MdqRunView that renders the report runs by 1) fetching the report from solr, 2) parsing it into a model collection named QualityReport, and 3) passing the data from that report model to a template to be rendered.

The result output then gets rendered in the template by iterating over the results, and creating either an img tag or a span with class check-output based on the type of the output. See: https://github.com/NCEAS/metacatui/blob/main/src/js/templates/mdqRun.html#L274-L279

To add markdown support should be a matter of inserting a new block for markdown type outputs -- basically an else if in the view logic in a couple of places. See the current markdown template here: https://github.com/NCEAS/metacatui/blob/main/src/js/templates/markdown.html along with the associated MarkdownView that renders the Markdown. I think you could reuse a lot of this, and it may involve inserting a directive like <div class="markdown"><%- output.value %></div> in the report template in the output block around line 277.

I hope @robyngit can help guide us on what the approach would be to integrating the MarkdownView into the quality reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants