{{ :blocks:logo-apl.png?nolink |}} ===== Tool sync: Cohort definition/population file format===== ====Introduction==== The cohort synchronisation file is a flat CSV file, preferably UTF-8 encoded. The tool configuration nevertheless allows an ISO-8859 encoded file to be supported. ==== File format ==== ^ Field ^ Value ^ Default ^ | cmd | 'add' or 'del' | add | | cid(2) | integer | - | | cname(1) | String(255) | - | | cidnumber(1) | String(255) | - | | cdescription | String(255) | - | | ccatcontext | String(255) | - | | ccatcontextidnumber | String(255) | - | | userid | id, IDnumber, email or username | - | (1) mandatory fields (under conditions). (2) Optional column only for the 'del' command and if the cohort identification source is set to 'id'. ==== Fields ==== === cmd === A command to run on the cohort/user binding. It can be: * **add**: Adds the user to the cohort. Creates the cohort if it is missing and if possible. * **del**: Removes the user from the cohort or deletes the cohort if no user is mentioned. * **free**: Removes all the members of the cohort without deleting it. === cohortid === The cohort identifier. The source of the identifier depends on the tool setting. === userid === The user identifier. The source of the identifier depends on the tool setting. === cname (> 2017012200) === If the cohort must be created by an operation, this column must be added to provide the cohort name. If the name is not provided, the id will be used as a basis to name the cohort. === cdescription === If the cohort must be created, this column can be added to describe the cohort. An empty value will not affect the cohort definition. === idnumber === If the cohort must be created, this column can be added to define the external identifier. An empty value will not affect the cohort definition. ====File examples==== Example of a file adding empty cohorts: cname;cidnumber;cdescription Cohort 1;COH001; First cohort Cohort 2;COH002; Second cohort Cohort 3;COH003; Third cohort Cohort 4;COH004; Fourth cohort Example of a file adding a populated cohort: cname;cidnumber;cdescription;userid # Creation of the cohort Cohort 1;COH001; First cohort;user1 # Adding the members Cohort 1;COH001;;user2 Cohort 1;COH001;;user3 Cohort 1;COH001;;user4 Cohort 1;COH001;;user5 Example of a file populating an existing cohort: cidnumber;userid COH001; First cohort;user1 COH001;;user2 COH001;;user3 COH001;;user4 COH001;;user5 Example of deleting cohorts (cohort keys set to ID number): cmd;cidnumber del;COH2; del;COH4 del;COH12 File for deleting targeted cohort members: cmd;idnumber;userid del;COH1;user23 del;COH2;user24 del;COH2;user25 File to empty cohorts (by ID number) cmd;cidnumber free;COH001 free;COH002 free;COH003 free;COH004 File for combined deletion of members and/or whole cohorts: cmd;idnumber;userid # Deleting members del;COH1;user45 del;COH1;user46 # Deleting a whole cohort del;COH32; Example of a file of combined operations: cmd;cidnumber;cname;cdescription;userid # Creating and adding a member add;COH54;Class 2.3;Class 2nd 3;user1 # Adding members (base id: ID number) add;COH54;;;user100 add;COH54;;;user101 # Deleting a member del;COH55;;;user50 # Deleting a cohort del;COH56;;; # Creating a cohort add;COH54;Class 2.4;Class 2nd 4; ---- [[:Tool:Sync|Back to the component index]] - [[:start|Back to catalogue]]