Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • F flower_category_exp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 14
    • Issues 14
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Merron Woodbury
  • flower_category_exp
  • Wiki
  • Saving Experiment Data to Github

Saving Experiment Data to Github · Changes

Page history
Created Saving Experiment Data to Github (markdown) authored Jan 22, 2021 by mwoodb's avatar mwoodb
Hide whitespace changes
Inline Side-by-side
Saving-Experiment-Data-to-Github.md 0 → 100644
View page @ 8796af79
# Instructions for Saving Experiment Data to Github
## Repository for Saved Data
1. Create new repository for storing data.
2. Create folder within repository for data files.
3. Write serverless function.
* Receive POST requests from verified experiments (specify 'Access-Control-Allow-Origin')
* Parse payload from the experiment
* Connect to repository via github token
* Make commit request to add experiment data as a file in the data folder
* Check success \n
> [Netlify Functions documentation](https://docs.netlify.com/functions/build-with-javascript/)<br>
> [Tutorial on writing Netlify serverless functions](https://itnext.io/how-to-build-and-deploy-serverless-functions-to-netlify-d37418f6f7be)
## Netlify Site
1. Create new Netlify site
* Link to github repository previously created
2. Change site name
3. Add github token as environment variable (Site settings -> Build & deploy -> environment).
* Token can be generated by going to Github account Settings -> Developer settings -> Personal access tokens, and creating new token with 'repo' access.<br>
> ``GITHUB TOKEN: <github personal access token>``
4. Deploy site again (rebuilt when push to repository)
## Experiment
1. At end of jsPsych experiment, organize data into struct. Struct must include an {"experiment": <name>} field for the folder within the data folder this should be saved in.
2. Create new XMLHttpRequest
* Open POST to netlify site (e.g. "https://mwoodb-savejs.netlify.app/.netlify/functions/savejs")
3. Set header information
4. Check connection
5. Send POST request
Clone repository
  • Home
  • Saving Experiment Data to Github