{"id":22217774,"url":"https://github.com/fredhutch/redcapdotnetdets","last_synced_at":"2025-07-27T14:32:24.578Z","repository":{"id":54780712,"uuid":"64228947","full_name":"FredHutch/RedcapDotNetDETs","owner":"FredHutch","description":"Data entry triggers for REDCap written using .NET Web API","archived":false,"fork":false,"pushed_at":"2022-06-22T18:01:53.000Z","size":414,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-16T04:30:13.563Z","etag":null,"topics":["redcap","redcap-api"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FredHutch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-26T14:41:22.000Z","updated_at":"2024-04-16T04:30:13.564Z","dependencies_parsed_at":"2022-08-14T02:50:27.048Z","dependency_job_id":null,"html_url":"https://github.com/FredHutch/RedcapDotNetDETs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FredHutch%2FRedcapDotNetDETs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FredHutch%2FRedcapDotNetDETs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FredHutch%2FRedcapDotNetDETs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FredHutch%2FRedcapDotNetDETs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FredHutch","download_url":"https://codeload.github.com/FredHutch/RedcapDotNetDETs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227810235,"owners_count":17823177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["redcap","redcap-api"],"created_at":"2024-12-02T22:17:50.605Z","updated_at":"2024-12-02T22:17:56.065Z","avatar_url":"https://github.com/FredHutch.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REDCapDotNetDETs\n\u003e Created by Paul Litwin, [Collaborative Data Services](http://cds.fredhutch.org), Fred Hutchinson Cancer Reseach Center, Seattle\n\n## Description\nA Microsoft .NET-based implementation of a set of [REDCap](https://projectredcap.org) Data Entry Triggers.\n- Created with Visual Studio 2015.\n- .NET version: 4.5.2.\n- Built as an ASP.NET WebAPI web service using C# programing language.\n- Uses Log4Net for logging.\n- Includes unit test for Adaptive randomization code.\n- Extensive comments in source code.\n\n### Update History\n- See GitHub releases.\n\n### This solution contains two projects\n- **DotNetDETs** - This is the main project containing three WebAPI endpoints: \n  - **DETExample** - a basic example of a .NET data entry trigger. Implemented using class  DotNetDETs/Controllers/DETExampleController.cs.\n  - **Adaptive** - a .NET data entry trigger that implements **Adaptive Randomization** in REDCap. Implemented using class  DotNetDETs/Controllers/AdaptiveController.cs.\n  - **DatabasedNotify** - a .NET data entry trigger that reacts to a saved survey and then, based on the value\nof a field on the survey, adds the record to the appropriate data access group and emails the\nappropriate site contact.\n- **DotNetDETUnitTests** - This is a unit test project for testing the Adaptive Randomization code.\n\n\nA description of each of the endpoints and supporting code follows...\n\n## DETExample Endpoint\nThis is basic example of a data entry trigger built in asp.net as a WebAPI web service. It uses common code (see below).\n\n## Adaptive Endpoint\nThis REDCap DET implements Adaptive Randomization per Smoak and Lin \n\u003chttp://www2.sas.com/proceedings/sugi26/p242-26.pdf\u003e.\nOne difference from the Smoak and Lin paper is that there is no run-in of simple randomization as mentioned in the paper. Instead, only the first assignment for each covariate group is randomly assigned using simple randomization. Thereafter, all subjects in that group are randomized using adaptive randomization.\n\n### REDCap Hook used to integrate Adaptive Randomization into data form\nHere is the hook code used to create a **Randomize Participant** button on our randomization form which mimics the Save and Continue button on a REDCap form. It uses the [Andy Martin REDCap Hook Framework](https://github.com/123andy/redcap-hook-framework). *This PHP code shown here is not included in the source of this .NET project.*\n```\n\u003c?php\n\t// Saved to a file named redcap_data_entry_form.php and placed in the hooks folder for the appropriate project\n\tswitch ($instrument) {\n\n        case \"randomization\":\n\t\t\tprint '\u003cscript type=\"text/javascript\"\u003e$(function() {$(\"input[name=\\'pc_rnd_ready\\']\").replaceWith(\"\u003cinput type=\\'button\\' id=\\'btnRandomize\\' name=\\'submit-btn-savecontinue\\' style=\\'font-weight:bold;font-size:12px;margin:1px 0;\\' onClick=\\'dataEntrySubmit(this);return false;\\' value=\\'Randomize Participant\\' /\u003e\"); });\u003c/script\u003e';\n\t\t\tbreak;\n\n        default:\n\t\t//nothing to do\n\t\n\t}\n?\u003e\n```\n\n### Unit Test for the Adaptive randomization code\nThe DotNetDETUnitTests unit test project allows you to quickly randomize a bunch of subjects to see if the adaptive randomization routine is working properly.\n\n## DatabasedNotify Endpoint\nPerforms two actions based on the value of the *cityField* field:\n 1. Adds form to appropriate data access group (DAG) based on city.\n 2. Notifies appropriate contact at the site for that city.\n\nNote: The *DatabasedNotifyEmailsTestMode* config setting of true diverts all emails to \ntest recipient. Need to set to false when in production.\n\n## Common Code\nThe common code under the Infrastructure folder consists of the following classes:\n 1. **RedCapDETBModelBinder.cs** is used to parse the posted values passed to the DET by REDCap. \n 2. **RedCapAccess.cs** contains routines to read and write records to REDCap. The REDCap API code was adapted from the work of [Chris Nefcy](https://github.com/redcap-tools/nef-c-sharp).\n 3. **Metadata.cs** is a class used to store the metadata (data dictionary) from the ExportMetadata API call.\n 4. **Messaging.cs** is used to send asynchronous emails.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredhutch%2Fredcapdotnetdets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredhutch%2Fredcapdotnetdets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredhutch%2Fredcapdotnetdets/lists"}