Sensitive data
Marking a table as holding records about people, what the page may show from it, tables that are already counts, models and survival curves over one, and what the checks leave to the author.
On this page
A table of records about people — patients, students, clients of a service — can be analysed in full and published without showing any one of them. Marked sensitive, a table has every value worked out from it checked before it reaches the page: counts, means and models are shown, while a person's own row is never shown, and nothing is reported about a group of fewer than 10 people. The analysis is written as it would be over any table; the checks need nothing written beside each value.
#Marking a table
An attached table is sensitive by its file name: the part before .csv ends in .sensitive, as in patients.sensitive.csv. The name goes wherever the file goes, so a copy attached to another internote is sensitive there too, and any other program still opens it as an ordinary CSV.
@data#patients:patients.sensitive.csv
{{count(filter(#patients, region = "Metropolitan"))}} patients lived in a city,
and {{count(filter(#patients, region = "Remote"))}} remotely.A table written inline, or read from a URL, has no file name to carry the mark, and takes sensitive on its instead:
@data#trial{
arm | response
Placebo | 3.1
…
}(sensitive)A file named sensitive stays sensitive: sensitive: false on one is refused. To publish its rows, rename the file.
#What the page shows
#Rows
No row of a sensitive table reaches the page. A column, a cell, a row read with nth or first, and the rows a filter keeps are each refused wherever they would be shown, in prose or in an attribute — a scatter of #patients.age is `#patients` is sensitive, and this shows individual rows; summarise it (`count`, `mean`, `median`). min and max are one person's value, and are refused the same way, as is over the table, which would write one block per person. Any of them can still be read inside an expression that summarises it: {{mean(#patients.age)}} is shown.
#Small groups
A summary — count, sum, mean, median, sd and the rest — is shown when the group it summarises holds at least 10 people. Below that it is withheld, and the page shows n.p. (not published) in its place. A count of zero is shown: a group with nobody in it says nothing about anyone.
- A median or a quartile is shown only with at least 10 readings on each side of it, since it is one of the readings.
modeis shown when the value it names is held by at least 10 people, anduniquelists only the values that are.- A withheld value cannot decide an
: the branch taken would give it away.
#Values worked out from a small group
A value worked out from a withheld one is withheld too, so arithmetic cannot recover the small group: a withheld count plus 10 is still withheld, or subtracting the 10 would give the count back. Both of these read n.p. when the remote group is small — the share, because its numerator is the remote count, and the difference, because two large counts of the same table subtracted are a count of the group between them:
{{round(100 * count(filter(#patients, region = "Remote")) / count(#patients), 1)}}%
{{count(#patients) - count(filter(#patients, region != "Remote"))}}#In graphs and tables
A withheld value in a graph is a gap: its point is not drawn, and its name stays on the axis. A bar chart that writes its values (show labels) writes n.p. where the bar would have stood, so the empty place does not read as zero. A cell of a table environment, and the editor's expressions console, show n.p. as the prose does.


@data#visits{
clinic | patients | waiting
Clinic A | 142 | 31
Clinic B | 96 | 24
Clinic C | 6 | 12
}(sensitive: (contributors: patients))
graph{
bar(x: Clinic A, Clinic B, Clinic C; y: {{mean(filter(#visits, clinic = "Clinic A").waiting)}}, {{mean(filter(#visits, clinic = "Clinic B").waiting)}}, {{mean(filter(#visits, clinic = "Clinic C").waiting)}}; show labels)
}(
y axis label: median wait, days
)Values that follow a slider are checked the same way each time they change.
#Tables of counts
Some tables are counts already: one row per clinic or region, standing for the people it counts. contributors: inside sensitive names the column that says how many, as the figure above does with sensitive: (contributors: patients). A row standing for at least 10 people is then shown like any other row, and a summary over several rows counts the people in all of them. A row standing for fewer is refused — `#visits` is sensitive, and this shows a row that stands for fewer than 10 people (`patients`); summarise it (`count`, `sum`, `mean`) — so a chart of every row needs the small ones filtered out first, filter(#visits, patients >= 10). A sensitive table with no contributors: has one person to a row.
#Models and survival curves
The models report what they find, checked term by term.
fit,coxandfinegraywithhold the numbers of a term whose level holds fewer than 10 people, or fewer than 10 events; the term keeps its name incoefficients. A model over fewer than 10 people is withheld whole.kmandcifmerge neighbouring steps until each holds at least 10 events, and stop where fewer than 10 people remain at risk, so no step marks one person's date. A value read off the curve with->comes from the same steps, so the number in the prose and the curve on the canvas agree.rateis withheld when its events are.- A model's
residualsandvaluesare one value per person, and are refused. Its fitted curve,fitted, is shown.
@let(
readmission: cox(#patients, days, outcome = "Readmitted", (age / 10, (region: Metropolitan)))
remote: first(filter(readmission.coefficients, term = "region: Remote"))
curve: km(#patients, days, outcome = "Readmitted")
)
Living remotely went with a hazard ratio of {{remote.ratio}}.#A higher threshold
disclosure: holds the rules a table's values are released under, apart from sensitive, which says what the table is. Its threshold raises the smallest group shown for one table; it cannot lower it below 10. A value worked out from two sensitive tables is held to the higher threshold.
@data#rare:rare-condition.sensitive.csv(disclosure: (threshold: 20))#What it does not do
- Each value is checked on its own. Two values that each pass can still be compared to recover a small group, as a group's mean would be beside the same mean with one more person; an analysis that publishes many overlapping cuts of the same records still needs reading for that.
boxplot,violin,densityandhistogramdraw from rows, so they refuse a sensitive table.
sensitive decides what the page shows, not who can read the data. The rows still travel to the reader's browser with the internote, as any table's do, so a table that must not leave the author's hands is not attached at all.