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

Feature request: don't apply postprocess_cell to headers #65

Open
PharmCat opened this issue Jan 12, 2025 · 4 comments
Open

Feature request: don't apply postprocess_cell to headers #65

PharmCat opened this issue Jan 12, 2025 · 4 comments

Comments

@PharmCat
Copy link

I try to apply this postprocess to concentration table:

struct RBLQ
    llq::Float64 
end
function SummaryTables.postprocess_cell(c::Cell, postprocessor::RBLQ)
    if isa(c.value, Real) && c.value <= postprocessor.llq return Cell("BLQ", c.style) end
    c
end

and got modified headers for time values:

Image

Is t possible not apply postprocess_cell to headers?

@jkrumbiegel
Copy link
Collaborator

You could overload postprocess_table instead where you can check what the header setting is and only replace the cells below. I usually just use missing for the blq values and replace those in the data and then with ReplaceMissing but of course that only works if you don't have other missings that should be marked differently.

@PharmCat
Copy link
Author

postprocess_table

Hi! Thank you! It is herd to find examples for postprocess_table (no ref to API form docs). Finally this solution seems works fine:

function SummaryTables.postprocess_table(t::Table, postprocessor::RBLQ)
    if isnothing(t.header) startrow = 1 else startrow = t.header + 1 end
    if startrow <= size(t.cells, 1) 
        for m in startrow:size(t.cells, 1) 
            for n in 1:size(t.cells, 2) 
                c = t.cells[m, n]
                if isa(c.value, Real) && c.value <= postprocessor.llq 
                    t.cells[m, n] = Cell("BLQ", c.style) 
                end
            end
        end
    end
    t
end

@jkrumbiegel
Copy link
Collaborator

Yeah I didn't have a real use case to document, yet, that's why there's no example. In such cases it's easiest to look up uses inside the code base itself.

@PharmCat
Copy link
Author

Yeah I didn't have a real use case to document, yet, that's why there's no example. In such cases it's easiest to look up uses inside the code base itself.

Seems BLLOQ values sometimes listed in concentration tables can be used as example, also it can be used for formatting depending on the value (underline all < 0.05).

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

No branches or pull requests

2 participants