Skip to content

Instantly share code, notes, and snippets.

View tertek's full-sized avatar

Ekin Tertemiz tertek

  • Swiss Tropical and Public Health Institute
  • Basel
View GitHub Profile
@tertek
tertek / odk-central-on-windows.md
Last active July 7, 2023 07:01
Installing ODK Central on Windows 10

Installing ODK Central on Windows 10

This guide helps you to setup ODK Central on Windows 10 whereby OS specific problems are being fixed.

Prerequisites

  • Node.js
  • Docker & Docker Compose (Docker Desktop recommended)
  • Git
@tertek
tertek / pdfToThumbnailImage.js
Created April 20, 2021 09:01
PDF to Thumbnail Image with pdf.js
function makeThumb(page) {
// draw page to fit into 96x96 canvas
var vp = page.getViewport({ scale: 1, });
var canvas = document.createElement("canvas");
var scalesize = 1;
canvas.width = vp.width * scalesize;
canvas.height = vp.height * scalesize;
var scale = Math.min(canvas.width / vp.width, canvas.height / vp.height);
console.log(vp.width, vp.height, scale);
return page.render({ canvasContext: canvas.getContext("2d"), viewport: page.getViewport({ scale: scale }) }).promise.then(function () {
@tertek
tertek / REDCap_API_to_Stata_via_Pyhton_Example.do
Created February 8, 2021 11:07
Example of using REDCap API for exporting record data and importing into Stata via Python
python:
#!/usr/bin/env python
import requests
data = {
'token': '<PLEASE INSERT API TOKEN HERE>',
'content': 'record',
'format': 'csv',
'type': 'flat',
'csvDelimiter': '',
'records[0]': '1',
@tertek
tertek / big_data_import_workaround.sql
Created January 18, 2021 15:45
SQL to reset REDCap EM Big Data Import Module when stuck.
delete from redcap_external_module_settings
where `project_id`= 14 and `external_module_id` = 9
and `key` <> "enabled"
@tertek
tertek / export_fields_with_comments.sql
Last active January 7, 2021 11:21
SQL to export fields with all comments from REDCap
SELECT d.record, d.field_name, d.value, dqr.comment, dqr.ts as `Time Raised`, u.username as `User Assigned`, dqr.response
FROM `redcap_data` as d
LEFT JOIN `redcap_data_quality_status` as dqs ON d.record = dqs.record AND d.field_name = dqs.field_name
LEFT JOIN `redcap_data_quality_resolutions` as dqr ON dqr.status_id = dqs.status_id
LEFT JOIN `redcap_user_information` as u ON dqs.assigned_user_id = u.ui_id
WHERE
# exclude unneeded fields
d.field_name NOT LIKE "%_complete"