User Tools

Site Tools


medal-data:icf

This is an old revision of the document!


medAL-data Informed consent form management

Verification Procedures Documentation

Step 1: SQL Query Execution

Objective: Retrieve 300 random consents from the database for patients associated with medical cases and health facilities, excluding specific conditions.

Procedure: Connect to the database using an appropriate SQL client or command-line interface. Execute the following SQL query:

SELECT p.consent
FROM patients p
JOIN medical_cases m ON p.id = m.patient_id
JOIN health_facilities h ON h.group_id = m.group_id
WHERE p.id IN (
    SELECT m.patient_id
    FROM medical_cases m
    JOIN health_facilities h ON h.group_id = m.group_id
    ORDER BY RANDOM()
)
AND p.consent IS NOT NULL AND p.consent != ''
AND h.name NOT ILIKE ALL(ARRAY['%test%','%Renzo%','%Sasha%','%CH%','%José%','%22_TIMCI%','%NOT IN USE%','%DROPPED%','%TRAINING%','%REFACTO%'])
ORDER BY RANDOM()
LIMIT 300;

Review the results to ensure 300 random consents are retrieved, meeting the specified criteria.

Expected Results: The query should return a list of 300 random consents for patients associated with medical cases and health facilities, excluding the specified conditions.

Step 2: Bash Script for SCP

Objective: Copy the identified images from the server to a local destination using scp.

Procedure: Open a terminal on the local machine. Create a new file named copy.sh Copy and paste the following script into the newly created file:

#!/bin/bash
# Set your server's address and username
REMOTE_SERVER="server's address"
REMOTE_USER="username"
 
# Set the source and destination paths on the server
# If you don't know where the storage volume is you can retrieve it with this command while connected on the server
# dokku ps:inspect medal-data | grep -A1 Binds
 
SOURCE_PATH="replace with the source path"
DESTINATION_PATH="replace with where you want to download the files locally"
 
List of image filenames
IMAGE_LIST=(
    # paste here the list from the SQL script
    # image_name.jpg
    # image_name.jpg
    # image_name.jpg
)
 
# Loop through the image filenames and copy them from the server
for image_name in "${IMAGE_LIST[@]}"; do
    # Use scp to copy each image from the server to the local machine
    scp "${REMOTE_USER}@${REMOTE_SERVER}:${SOURCE_PATH}${image_name}" "${DESTINATION_PATH}"
done

Make the script executable:

chmod +x copy.sh

Run the script:

./copy.sh

Expected Results: The bash script should successfully copy all identified images from the remote server to the specified local destination. Confirm that the images are present in the local directory specified as DESTINATION_PATH.

medal-data/icf.1705056639.txt.gz · Last modified: 2024/01/12 11:50 by Sylvain