Migrates translations to the REDCap native Multi-Language Management system

Overview

REDCap Multi-Lingual Migration

Automates much of the process of moving translations from the old Multilingual external module to the newer built-in Multi-Language Management (MLM) page.

Developed and tested with Python 3.9.10, although this should work with all versions of Python >= 3.9.

Functionality of this script is split into 2 parts:

  • extract_em_translations.py makes a REDCap API call to the old project to obtain its entire collection of translations from the old Multilingual external module. Stores translations in a timestamped .csv file in output/, which is generated automatically.
  • prepare_translations.py uses this .csv file to provide translations to a .json file from the new REDCap project's MLM page. This creates another .json file that can be re-imported into the new REDCap project's MLM with all applicable translations pre-filled.

Please note the license terms in LICENSE.txt - this tool is not guaranteed to be compatible with your own REDCap projects "out of the box"; some tinkering may be required. UCI MIND lacks the resources to maintain or add features to this tool, although we may push critical updates as necessary.

Before use

  • Edit secrets.json and add the API token and URL from your old REDCap project - the one with the Multilingual external module. Visit that project's "API" and "API Playground" pages for details.
  • Edit languages.csv and add the languages that your REDCap projects support.
    • Column 1 should contain the language in English, column 2 should contain a two-character shortcode for the language, and column 3 should contain the language in its native language (example: Spanish, es, Español)
  • Ensure that the new REDCap project uses the exact same variable names as the old REDCap project.
  • Download template .json files for each language on your new REDCap project's Multi-Language Management page:
    • Multi-Language Management -> Actions -> "Export Language" (the blue file with a downwards arrow) -> Select "JSON" under "Export Options" -> "Download Language"
    • A folder named multi_language_manager_json/ has been included as a place to put these files, as well as a basic JSON file that roughly follows the format the scripts expect.
  • When running this script, it is recommended to create a virtual environment to keep packages isolated on your system:
cd {into this repository's folder}

# Create a Python virtual environment (only need to do this once):
python -m venv .venv

# Activate the virtual environment:
.\.venv\Scripts\Activate.ps1
# No file extension needed on other platforms
# Windows: .ps1 for PowerShell or .bat for Command Prompt

# If using PowerShell and "running scripts is disabled on this system", need to
# enable running external scripts. Open PowerShell as admin and use this command:
#     set-executionpolicy remotesigned
# (only need to do this once)

# While in the virtual env, install packages (only need to do this once):
python -m pip install -r requirements.txt

# Run the script, develop, debug, etc.:
python main.py {arguments, see below} ...

# Deactivate when done
deactivate

Usage

Use on a command line (brackets indicate optional arguments):

python main.py [-h] -j JSON_TEMPLATE -l LANGUAGE [-o OUTPUT_FILE] [-q]

Arguments:

Argument Shorthand Required? Description
--help -h Display a help message and exit.
--json-template -j Path to a .json file downloaded from a new REDCap project's Multi-Language Management system. Configure this in tandem with --language.
--language -l Determines which language to translate REDCap fields to. Can be a two-character shortcode or a full name (i.e. 'es' or 'Spanish' are valid). Configure this in tandem with --json-template.
--output-file -o Destination file of the filled-out template .json. If this argument is absent, the new .json file will be written to output/ with a timestamped file name.
--replace-quotes -q If this argument is provided, escaped double quote characters (\") will be used in translated text. If this argument is absent, escaped double quote characters will be replaced with single quotes (') (the default behavior).

To import your filled-in JSON files to your new REDCap project:

  • Multi-Language Management -> Actions -> "Edit Language" (the pencil icon) -> "Import from file or system" -> "Browse" and select your filled-in .json file -> check "use imported values" -> "Import"

After importing, it is highly recommended to perform a manual check of the translations to ensure that no fields were missed or translated incorrectly. Be vigilant for any non-functioning HTML or JSON-esque code fragments.

Owner
UCI MIND
UC Irvine Institute for Memory Impairments and Neurological Disorders
UCI MIND
A pipeline for making highlighted text stand-alone.

title emoji colorFrom colorTo sdk app_file pinned decontextualizer 📤 green gray streamlit main.py false Decontextualizer As a second step in improvin

Paul Bricman 26 Dec 17, 2022
Translate .sbv subtitle files

deepl4subtitle Deeplを使って字幕ファイル(.sbv)を翻訳します。タイムスタンプも含めて出力しますが、翻訳時はタイムスタンプは文の一部とは切り離されるので、.sbvファイルをそのまま翻訳機に突っ込むよりも高精度な翻訳ができるはずです。 つかいかた 入力する.sbvファイルの前処理

Yasunori Toshimitsu 1 Oct 20, 2021
PyNews 📰 Simple newsletter made with python 🐍🗞️

PyNews 📰 Simple newsletter made with python Install dependencies This project has some dependencies (see requirements.txt) that are not included in t

Luciano Felix 4 Aug 21, 2022
Tools to extract questionaire of finalexam.eu and provide interactive questionaire with summary

AskMe This script is completely terminal based. No user interface is added. You can get the command line options by using the --help argument. Make su

David Loewe 1 Nov 09, 2021
Word-Generator - Generates meaningful words from dictionary with given no. of letters and words.

Meaningful Word Generator Generates meaningful words from dictionary with given no. of letters and words. This might be useful for generating short li

Mohammed Rabil 1 Jan 01, 2022
Fixes mojibake and other glitches in Unicode text, after the fact.

ftfy: fixes text for you print(fix_encoding("(ง'⌣')ง")) (ง'⌣')ง Full documentation: https://ftfy.readthedocs.org Testimonials “My life is li

Luminoso Technologies, Inc. 3.4k Jan 08, 2023
A python Tk GUI that creates, writes text and attaches images into a custom spreadsheet file

A python Tk GUI that creates, writes text and attaches images into a custom spreadsheet file

Mirko Simunovic 13 Dec 09, 2022
Extract knowledge from raw text

Extract knowledge from raw text This repository is a nearly copy-paste of "From Text to Knowledge: The Information Extraction Pipeline" with some cosm

Raphael Sourty 10 Dec 03, 2022
Athens: a great tool for taking notes and organising knowldge

AthensSyncer Athens is a great tool for taking notes and organising knowldge. But it is a bummer that you cannot use it accross multiple devices. Well

6 Dec 14, 2022
Vector space based Information Retrieval System for Text Processing - Information retrieval

Information Retrieval: Text Processing Group 13 Sequence of operations Install Requirements Add given wikipedia files to the corpus directory. Downloa

1 Jan 01, 2022
Add your new words to a text file and get them randomly.

Memorize-New-Words In this very very very little project, I've wrote a code to memorize new english words. Therefore you can add the words and their m

Mostafa 2 Jul 04, 2022
The Levenshtein Python C extension module contains functions for fast computation of Levenshtein distance and string similarity

Contents Maintainer wanted Introduction Installation Documentation License History Source code Authors Maintainer wanted I am looking for a new mainta

Antti Haapala 1.2k Dec 16, 2022
A Python package to facilitate research on building and evaluating automated scoring models.

Rater Scoring Modeling Tool Introduction Automated scoring of written and spoken test responses is a growing field in educational natural language pro

ETS 59 Oct 10, 2022
Shows twitch pay for any streamer from Twitch leaked CSV files.

twitch_leak_csv_reader Shows twitch pay for any streamer from Twitch leaked CSV files. Requirements: You need python3 (you can install python 3 from o

5 Nov 11, 2022
box is a text-based visual programming language inspired by Unreal Engine Blueprint function graphs.

Box is a text-based visual programming language inspired by Unreal Engine blueprint function graphs. $ cat factorial.box ┌─ƒ(Factorial)───┐

Pranav 104 Dec 24, 2022
Repository containing the code for An-Gocair text normaliser

Scottish Gaelic Text Normaliser The following project contains the code and resources for the Scottish Gaelic text normalisation project. The repo can

3 Jun 28, 2022
A simple Python module for parsing human names into their individual components

Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff

Derek Gulbranson 574 Dec 20, 2022
Getting git-style versioning working on RDFlib

Getting git-style versioning working on RDFlib

Gabe Fierro 1 Feb 01, 2022
Free & simple way to encipher text

VenSipher VenSipher is a free medium through which text can be enciphered. It can convert any text into an unrecognizable secret text that can only be

3 Jan 28, 2022
REST API for sentence tokenization and embedding using Multilingual Universal Sentence Encoder.

MUSE stands for Multilingual Universal Sentence Encoder - multilingual extension (supports 16 languages) of Universal Sentence Encoder (USE).

Dani El-Ayyass 47 Sep 05, 2022