# Exporting Study Data

## Exporting the Data

During the study, participants' behavioral data on the website is recorded in the MongoDB database that you have set up. MongoDB is a NoSQL Server in which data is stored in BSON (Binary JSON) documents and each document is built on a key-value pair structure. The details of this are not too important if you are not familiar with MongoDB.&#x20;

Instead, a script (`data-export.js`) is provided in The Truman Platform project folder that when run, exports basic variables and information about the participants' behavioral metrics on Truman into a readable csv file. This eliminates the need for you to go into the database (which can be overwhelming) and allow you to easily analyze participants' behavioral data at the end of your study.

### How to export data into readable csv file

To run `data-export.js` to export participants' behavioral metrics data into a csv file:&#x20;

1. Ensure the value to the key **MONGODB\_URI=** in the `.env` file is the MongoDB URL connection string to your database. If you followed the instructions to installing Truman, this should already be set to the correct value.
2. Create a folder named `./outputFiles` in your base project directory. Exported csv files will go in this folder.
3. Next, enter `node data-export.js` in your terminal/command prompt from your project directory. A new exported csv file is generated each time you enter this command and run the script.
4. When the script is completed, you will find the csv file with the data in the folder `./outputFiles/truman-dataExport-.........csv`.
5. To understand this file, see below.

### Data exported

In general, these are the types of behaviors calculated/ exported by the `data-export.js` file.&#x20;

* All interactions with posts and comments (including likes, flags, view times)
* Participants' posting behavior
* Actor based interactions (Block, report, follow, profile view)
* Site log (time on site)
* Page log (pages visited)
* Participant information (MTurkID, username, experimental condition)

Below is a more detailed breakdown and description of each variable.&#x20;

In the outputted csv file, each row is one participant and the value in a column corresponds to the variable column name.

<table><thead><tr><th width="280">Variable Name</th><th>Description</th></tr></thead><tbody><tr><td>Id</td><td>Participant's provided Mechanical Turk ID</td></tr><tr><td>ResponseID</td><td>(if applicable) Participant's provided Qualtrics ResponseID (see <a href="../launching-your-study#integrating-truman-with-qualtrics">Integrating Truman with Qualtrics</a> for more details)</td></tr><tr><td>Username</td><td>Participant's username</td></tr><tr><td>Condition</td><td>Participant's condition</td></tr><tr><td>NumUserPostsCreated</td><td>Number of posts <em>made</em> by the participant</td></tr><tr><td>NumUserCommentsCreated</td><td>Number of comments <em>made</em> by the participant</td></tr><tr><td>NumActorPostsLiked</td><td>Number of actor posts <em>liked</em> by the participant </td></tr><tr><td>NumActorPostsFlagged</td><td>Number of actor posts <em>flagged</em> by the participant</td></tr><tr><td>NumActorCommentsLiked</td><td>Number of actor comments <em>liked</em> by the participant</td></tr><tr><td>NumActorCommentsFlagged</td><td>Number of actor comments <em>flagged</em> by the participant</td></tr><tr><td>UserPostsCreated</td><td>Metadata of the participant-made posts, including: <br>- text of the post <br>- which day of the study the post was made (ex: 1, 2, 3, etc., where the day number is defined in 24-hour periods of the study)<br>Formatted like: <em>&#x3C;TEXT></em>, on Day <em>&#x3C;DAY></em></td></tr><tr><td>UserCommentsCreated</td><td>Metadata of the participant-made comments, including: <br>- text of the comment <br>- id of the post the comment was left on<br>- which day of the study the comment was made (ex: 1, 2, 3, etc., where the day is defined in 24-hour periods of the study)<br>Formatted like: <em>&#x3C;TEXT></em>, on Post <em>&#x3C;POST ID></em>, on Day <em>&#x3C;DAY></em></td></tr><tr><td>ActorPostsLiked</td><td>List of ids of the actor posts the participant liked</td></tr><tr><td>ActorPostsFlagged</td><td>List of ids of the actor posts the participant flagged</td></tr><tr><td>ActorCommentsLiked</td><td>List of ids of the actor comments the participant liked </td></tr><tr><td>ActorCommentsFlagged</td><td>List of ids of the actor comments the participant flagged</td></tr><tr><td>ActorsBlocked</td><td>List of actor usernames the participant blocked</td></tr><tr><td>ActorsReported</td><td>List of actor usernames the participant reported, and the reason for reporting<br>Formatted like: <em>&#x3C;USERNAME></em>, Reported for <em>&#x3C;REASON></em></td></tr><tr><td>ActorsFollowed</td><td>List of actor usernames the participant followed</td></tr><tr><td>TimeOnSite</td><td>Total amount of time (in seconds) participant spent on site</td></tr><tr><td>PageLog</td><td>List of page URLs the participant visited</td></tr></tbody></table>

## Analyzing the Data and Paying Participants

You can use programs like R or other analyzing tools to analyze the data, find interesting trends and statistical significance, and compare different conditions.

The key that unites the participants' data with any Qualtrics pre-study surveys or Qualtrics post-study surveys results that you have used in your study is the ResponseID (see [Integrating Truman with Qualtrics](../launching-your-study#integrating-truman-with-qualtrics) for more details)

You may also use the Mechanical Turk ID value of participants and the exported data to identify and help with payments/ rewards after the study.
