Skip to content

Commit

Permalink
- hide code chunks by default
Browse files Browse the repository at this point in the history
- update the README
- don't cache quarto docs for now
  • Loading branch information
hughjonesd committed Apr 17, 2024
1 parent 54473ae commit f49214f
Show file tree
Hide file tree
Showing 92 changed files with 3,497 additions and 20,978 deletions.
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# unjournaldata
Unjournal evaluations, meta-analysis, and meta-science: data analysis and presentation

This is the repository for
[Unjournal](https://www.unjournal.org) evaluations, meta-analysis, and meta-science.

Some goals below
Our current reports are available at <https://unjournal.github.io>.

## Todo: Evaluation and prediction metrics
# How it works

This comment has been minimized.

Copy link
@daaronr

daaronr Apr 17, 2024

Collaborator

@hughjonesd Cool, thanks for rephrasing this


Some things to do:
Data is currently imported manually from airtable. We hope to automate this soon.

- DONE: Import evaluation rating/predictions data
The github site is created as a [Quarto](https://quarto.org) book. There is also
a [Shiny](https://shiny.posit.co) app at
<https://unjournal.shinyapps.io/DataExplorer/>.

- DONE for now: Clean and reconcile missing data, different metrics
- [ ] Aggregations of ratings under stated uncertainty
- [ ] Assess inter-rater reliability, etc.

## Later: Track and benchmark against later outcomes

## Possible: 'Claim extraction', link with predictions and replication work

## House, support, link: Data and code from papers, evaluators calculations and investigations
The site can be re-rendered by running `quarto render` from the command line,
or `quarto::quarto_render()` from within R, and pushing changes to the `main` branch.

The shiny app can be deployed by running
`rsconnect::deployApp("shinyapp/DataExplorer")`, or from within RStudio by
opening `shinyapp/DataExplorer/app.R` and clicking the 'publish' button.
16 changes: 0 additions & 16 deletions _freeze/chapters/aggregation/execute-results/html.json

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 0 additions & 14 deletions _freeze/chapters/evaluation_data_input/execute-results/html.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// some helper functions: using a global object DTWidget so that it can be used
// in JS() code, e.g. datatable(options = list(foo = JS('code'))); unlike R's
// dynamic scoping, when 'code' is eval()'ed, JavaScript does not know objects
// dynamic scoping, when 'code' is eval'ed, JavaScript does not know objects
// from the "parent frame", e.g. JS('DTWidget') will not work unless it was made
// a global object
var DTWidget = {};
Expand Down Expand Up @@ -348,6 +348,15 @@ HTMLWidgets.widget({
var table = $table.DataTable(options);
$el.data('datatable', table);

if ('rowGroup' in options) {
// Maintain RowGroup dataSrc when columns are reordered (#1109)
table.on('column-reorder', function(e, settings, details) {
var oldDataSrc = table.rowGroup().dataSrc();
var newDataSrc = details.mapping[oldDataSrc];
table.rowGroup().dataSrc(newDataSrc);
});
}

// Unregister previous Crosstalk event subscriptions, if they exist
if (instance.ctfilterSubscription) {
instance.ctfilterHandle.off("change", instance.ctfilterSubscription);
Expand Down Expand Up @@ -432,10 +441,13 @@ HTMLWidgets.widget({
regex = options.search.regex,
ci = options.search.caseInsensitive !== false;
}
// need to transpose the column index when colReorder is enabled
if (table.colReorder) i = table.colReorder.transpose(i);
return table.column(i).search(value, regex, !regex, ci);
};

if (data.filter !== 'none') {
if (!data.hasOwnProperty('filterSettings')) data.filterSettings = {};

filterRow.each(function(i, td) {

Expand Down Expand Up @@ -493,11 +505,13 @@ HTMLWidgets.widget({
$input.parent().hide(); $x.show().trigger('show'); filter[0].selectize.focus();
},
input: function() {
if ($input.val() === '') filter[0].selectize.setValue([]);
var v1 = JSON.stringify(filter[0].selectize.getValue()), v2 = $input.val();
if (v1 === '[]') v1 = '';
if (v1 !== v2) filter[0].selectize.setValue(v2 === '' ? [] : JSON.parse(v2));
}
});
var $input2 = $x.children('select');
filter = $input2.selectize({
filter = $input2.selectize($.extend({
options: $input2.data('options').map(function(v, i) {
return ({text: v, value: v});
}),
Expand All @@ -509,15 +523,14 @@ HTMLWidgets.widget({
if (value.length) $input.trigger('input');
$input.attr('title', $input.val());
if (server) {
table.column(i).search(value.length ? JSON.stringify(value) : '').draw();
searchColumn(i, value.length ? JSON.stringify(value) : '').draw();
return;
}
// turn off filter if nothing selected
$td.data('filter', value.length > 0);
table.draw(); // redraw table, and filters will be applied
}
});
if (searchCol) filter[0].selectize.setValue(JSON.parse(searchCol));
}, data.filterSettings.select));
filter[0].selectize.on('blur', function() {
$x.hide().trigger('hide'); $input.parent().show(); $input.trigger('blur');
});
Expand All @@ -526,10 +539,12 @@ HTMLWidgets.widget({
var fun = function() {
searchColumn(i, $input.val()).draw();
};
if (server) {
fun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
}
$input.on('input', fun);
// throttle searching for server-side processing
var throttledFun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
$input.on('input', function(e, immediate) {
// always bypass throttling when immediate = true (via the updateSearch method)
(immediate || !server) ? fun() : throttledFun();
});
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
var $x0 = $x;
$x = $x0.children('div').first();
Expand Down Expand Up @@ -615,13 +630,11 @@ HTMLWidgets.widget({
filter.val(v);
}
});
var formatDate = function(d, isoFmt) {
var formatDate = function(d) {
d = scaleBack(d, scale);
if (type === 'number') return d;
if (type === 'integer') return parseInt(d);
var x = new Date(+d);
var fmt = ('filterDateFmt' in data) ? data.filterDateFmt[i] : undefined;
if (fmt !== undefined && isoFmt === false) return x[fmt.method].apply(x, fmt.params);
if (type === 'date') {
var pad0 = function(x) {
return ('0' + x).substr(-2, 2);
Expand All @@ -642,7 +655,7 @@ HTMLWidgets.widget({
start: [r1, r2],
range: {min: r1, max: r2},
connect: true
}, opts));
}, opts, data.filterSettings.slider));
if (scale > 1) (function() {
var t1 = r1, t2 = r2;
var val = filter.val();
Expand All @@ -657,13 +670,28 @@ HTMLWidgets.widget({
start: [t1, t2],
range: {min: t1, max: t2},
connect: true
}, opts), true);
}, opts, data.filterSettings.slider), true);
val = filter.val();
}
r1 = t1; r2 = t2;
})();
// format with active column renderer, if defined
var colDef = data.options.columnDefs.find(function(def) {
return (def.targets === i || inArray(i, def.targets)) && 'render' in def;
});
var updateSliderText = function(v1, v2) {
$span1.text(formatDate(v1, false)); $span2.text(formatDate(v2, false));
// we only know how to use function renderers
if (colDef && typeof colDef.render === 'function') {
var restore = function(v) {
v = scaleBack(v, scale);
return inArray(type, ['date', 'time']) ? new Date(+v) : v;
}
$span1.text(colDef.render(restore(v1), 'display'));
$span2.text(colDef.render(restore(v2), 'display'));
} else {
$span1.text(formatDate(v1));
$span2.text(formatDate(v2));
}
};
updateSliderText(r1, r2);
var updateSlider = function(e) {
Expand All @@ -680,7 +708,7 @@ HTMLWidgets.widget({
updateSliderText(val[0], val[1]);
if (e.type === 'slide') return; // no searching when sliding only
if (server) {
table.column(i).search($td.data('filter') ? ival : '').draw();
searchColumn(i, $td.data('filter') ? ival : '').draw();
return;
}
table.draw();
Expand All @@ -696,7 +724,7 @@ HTMLWidgets.widget({
// processing
if (server) {
// if a search string has been pre-set, search now
if (searchCol) searchColumn(i, searchCol).draw();
if (searchCol) $input.trigger('input').trigger('change');
return;
}

Expand Down Expand Up @@ -742,15 +770,7 @@ HTMLWidgets.widget({
$.fn.dataTable.ext.search.push(customFilter);

// search for the preset search strings if it is non-empty
if (searchCol) {
if (inArray(type, ['factor', 'logical'])) {
filter[0].selectize.setValue(JSON.parse(searchCol));
} else if (type === 'character') {
$input.trigger('input');
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
$input.trigger('change');
}
}
if (searchCol) $input.trigger('input').trigger('change');

});

Expand Down Expand Up @@ -1370,7 +1390,7 @@ HTMLWidgets.widget({
changeInput('cell_clicked', {});

// do not trigger table selection when clicking on links unless they have classes
table.on('click.dt', 'tbody td a', function(e) {
table.on('mousedown.dt', 'tbody td a', function(e) {
if (this.className === '') e.stopPropagation();
});

Expand Down Expand Up @@ -1398,8 +1418,9 @@ HTMLWidgets.widget({
console.log('The search keyword for column ' + i + ' is undefined')
return;
}
$(td).find('input').first().val(v);
searchColumn(i, v);
// Update column search string and values on linked filter widgets.
// 'input' for factor and char filters, 'change' for numeric filters.
$(td).find('input').first().val(v).trigger('input', [true]).trigger('change');
});
table.draw();
}
Expand Down

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions _freeze/site_libs/dt-core-1.13.6/js/jquery.dataTables.min.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions _freeze/site_libs/htmltools-fill-0.5.8/fill.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@layer htmltools {
.html-fill-container {
display: flex;
flex-direction: column;
/* Prevent the container from expanding vertically or horizontally beyond its
parent's constraints. */
min-height: 0;
min-width: 0;
}
.html-fill-container > .html-fill-item {
/* Fill items can grow and shrink freely within
available vertical space in fillable container */
flex: 1 1 auto;
min-height: 0;
min-width: 0;
}
.html-fill-container > :not(.html-fill-item) {
/* Prevent shrinking or growing of non-fill items */
flex: 0 0 auto;
}
}
9 changes: 5 additions & 4 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ book:
date: today

execute:
freeze: auto # re-render only when source changes
freeze: false # re-render only when source changes
warning: false
message: false
error: true
echo: false

comments:
hypothesis: true
#bibliography: references.bib

format:
html:
code-fold: true
code-link: true #note: this isn't working for me
code-tools: true
code-fold: false

This comment has been minimized.

Copy link
@daaronr

daaronr Apr 17, 2024

Collaborator

@hughjonesd I think your change here may have removed all code blocks. As I said on Slack, I think having the option to see the code is helpful, at least for now

This comment has been minimized.

Copy link
@hughjonesd

hughjonesd Apr 22, 2024

Author Contributor

Give it a while. It's so in flux now that it don't matter. At the end there might be places we want to put code blocks in... an alternative is just to point nerds to github where they can clone!
Off-topic: I could fork this and make official pull requests. You'd then have a more formal review process. I'd suggest waiting for now... it's kind of a self-contained project so trust me and avoid too much process.

code-link: false #note: this isn't working for me
code-tools: false
theme: cosmo
citations-hover: true
footnotes-hover: true
Expand Down
Loading

0 comments on commit f49214f

Please sign in to comment.