Skip to content

Commit

Permalink
Merge pull request #377 from brown-ccv/feat-v3.3
Browse files Browse the repository at this point in the history
feat: Honeycomb v3.3.0
  • Loading branch information
RobertGemmaJr authored Mar 25, 2024
2 parents ef49af1 + 73cd81c commit 92b3187
Show file tree
Hide file tree
Showing 78 changed files with 9,540 additions and 14,366 deletions.
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ psiturkit/*_turk
/.vscode
/.env
.env
/.pnp
.pnp.js
.gitignore
.DS_Store
.gitignore
**/firebase-service-account.json
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
},
plugins: ["react"],
rules: {
"react/prop-types": "off", // TODO: These should be added so the rule can be removed
"no-unused-vars": "warn",
"react/prop-types": "off", // TODO @brown-ccv #223: App prop validation, remove this rule
"import/order": "warn",
},
settings: {
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Pull Request

# Runs the build and test scripts on PR
on: pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
name: 🧪 Build and Test
build:
name: 🧪 Build
runs-on: ${{ matrix.os }}

# Run action for [home/clinic] with in [windows/macOS/ubuntu]
Expand Down Expand Up @@ -42,11 +40,7 @@ jobs:
path: ./env
mode: ${{matrix.setting}}

# Test and lint
- name: 🧪 Test
run: npm test
env:
CI: true
# Lint the code
- name: 🔬 Lint
run: npm run lint -- --max-warnings=0

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

Expand All @@ -20,8 +21,8 @@ jobs:
# Run build script for [home/clinic] in [windows/macOS/ubuntu]
strategy:
matrix:
setting: [home, clinic]
os: [windows-latest, macOS-latest, ubuntu-latest]
setting: [home, clinic]
fail-fast: true

steps:
Expand Down Expand Up @@ -62,9 +63,6 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
run: npm run package:linux

# Upload installers to github release
# TODO: Can these be combined based on matrix.os???
# TODO: Overwrite files if they exist?
# Get package info
- name: Get package name and version
id: package_info
Expand All @@ -73,6 +71,7 @@ jobs:
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
shell: bash

# Upload installers to GitHub release
- name: ⬆ Upload installer to release - Windows
if: startsWith(matrix.os, 'windows')
uses: svenstaro/upload-release-action@v2
Expand All @@ -85,8 +84,8 @@ jobs:
if: startsWith(matrix.os, 'mac')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-x64.dmg
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-x64.dmg
file: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-universal.dmg
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-universal.dmg
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬆ Upload installer to release - Linux
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Brewfile.lock.json

# Versioning
public/config/version.json
public/version.json
Brewfile.lock.json

# Firebase private key
Expand Down
2 changes: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ cask "github"
brew "openjdk"
cask "visual-studio-code"

# TODO #278: Python management (miniconda)?
# TODO @brown-ccv #278: Python management (miniconda)? [Python is only needed for PsiTurk]
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

[![DOI:10.1590/1516-4446-2020-1675](https://img.shields.io/badge/DOI-10.1590%2F1516--4446--2020--1675-orange)](https://doi.org/10.1590/1516-4446-2020-1675) [![docs](https://img.shields.io/badge/docs-stable-blue)](https://brown-ccv.github.io/honeycomb-docs/)

Honeycomb is a template for reproducible psychophysiological tasks for clinic, laboratory, and home use. It is maintained by members of the [Center for Computation and Visualization](https://ccv.brown.edu) and the [Neuromotion Lab](http://borton.engin.brown.edu/) at Brown University. To learn about installation, usage and deployment please [visit our documentation](https://brown-ccv.github.io/honeycomb-docs/).

_Note: previously named Neuro Task Starter, some references may still refer to it as such._

## Introduction

Honeycomb is an open source task-template repository that combines well-accepted practices and technologies from the cognitive science and web development communities to build psychophysiological tasks that support lab equipment recordings and are ready for deployment to different settings (desktop or online) without significant changes to the code base.

It is maintained by members of the [Center for Computation and Visualization](https://ccv.brown.edu) and the [Neuromotion Lab](http://borton.engin.brown.edu/) at Brown University.

## Documentation

- [Honeycomb Documentation](https://brown-ccv.github.io/honeycomb-docs/)
- [Honeycomb Discussions Board](https://github.com/brown-ccv/honeycomb/discussions)
- [Behavioral Task Hub (Beehive)](https://beehive.ccv.brown.edu)

## Cite This Work

If you use Honeycomb in your work, please cite:

[Provenza, N.R., Gelin, L.F.F., Mahaphanit, W., McGrath, M.C., Dastin-van Rijn, E.M., Fan, Y., Dhar, R., Frank, M.J., Restrepo, M.I., Goodman, W.K. and Borton, D.A., 2021. Honeycomb: a template for reproducible psychophysiological tasks for clinic, laboratory, and home use. Brazilian Journal of Psychiatry, 44, pp.147-155.](https://doi.org/10.1590/1516-4446-2020-1675)
8 changes: 8 additions & 0 deletions assets/icons/hexagon-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/icon.icns
Binary file not shown.
Binary file added assets/icons/icon.ico
Binary file not shown.
Binary file added assets/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icons/mac/icon.icns
Binary file not shown.
Binary file removed assets/icons/win/icon.ico
Binary file not shown.
17 changes: 10 additions & 7 deletions cli.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { checkbox, confirm, expand, input, select } from "@inquirer/prompts";
import fsExtra from "fs-extra";

// TODO @brown-ccv #183: Upgrade to modular SDK instead of compat
import { cert, initializeApp } from "firebase-admin/app";
import { getFirestore } from "firebase-admin/firestore";
import fsExtra from "fs-extra";

/** -------------------- GLOBALS -------------------- */

Expand All @@ -18,12 +20,13 @@ const INVALID_DEPLOYMENT_ERROR = new Error("Invalid deployment: " + DEPLOYMENT);

/** -------------------- MAIN -------------------- */

// TODO @brown-ccv #289: Pass CLI arguments with commander (especially for action)
async function main() {
// TODO #289: User should be able to pass command line arguments OR inquirer (especially for action)

ACTION = await actionPrompt();
DEPLOYMENT = await deploymentPrompt();
// TODO @brown-ccv #291: Enable downloading all study data at once
STUDY_ID = await studyIDPrompt();
// TODO @brown-ccv #291: Enable downloading all participant data at once
PARTICIPANT_ID = await participantIDPrompt();
EXPERIMENT_IDS = await experimentIDPrompt();

Expand Down Expand Up @@ -55,6 +58,8 @@ main();

/** -------------------- DOWNLOAD ACTION -------------------- */

/** Download data that's stored in Firebase */
// TODO @brown-ccv #300: Download as either CSV or JSON
async function downloadDataFirebase() {
let overwriteAll = false;

Expand Down Expand Up @@ -83,7 +88,6 @@ async function downloadDataFirebase() {
`${STUDY_ID}/${PARTICIPANT_ID}/${experimentID}.json`.replaceAll(":", "_"); // (":" are replaced to prevent issues with invalid file names)

// Determine if the file should be saved
// TODO #300: Download as either CSV or JSON
let shouldDownload;
if (fsExtra.existsSync(outputFile)) {
// File exists, check if user wants to overwrite
Expand Down Expand Up @@ -119,6 +123,7 @@ async function downloadDataFirebase() {

/** -------------------- DELETE ACTION -------------------- */

/** Delete data that's stored in Firebase */
async function deleteDataFirebase() {
const confirmation = await confirmDeletionPrompt();
if (confirmation) {
Expand Down Expand Up @@ -156,8 +161,8 @@ async function actionPrompt() {
}

/** Prompt the user for the deployment they are trying to access */
// TODO @brown-ccv #290: Add other deployments!
async function deploymentPrompt() {
// TODO #290: Add other deployments!
const response = "firebase";

// Initialize Firestore
Expand Down Expand Up @@ -213,7 +218,6 @@ async function participantIDPrompt() {
};

return await input({
// TODO #291: Enable downloading all study data at once
message: "Select a participant:",
validate: async (input) => {
const invalid = "Please enter a valid participant from your Firestore database";
Expand All @@ -232,7 +236,6 @@ async function participantIDPrompt() {

/** Prompt the user to select one or more experiments of the PARTICIPANT_ID on STUDY_ID */
async function experimentIDPrompt() {
// TODO #291: Enable downloading all participant data at once
const dataSnapshot = await getDataRef(STUDY_ID, PARTICIPANT_ID).get();

// Sort experiment choices by most recent first
Expand Down
25 changes: 14 additions & 11 deletions firestore.rules
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// participantID must be in the registered_participants array in the registered_studies/{studyID} document
match /participant_responses/{studyID}/participants/{participantID} {
allow create, read:
if participantID in get(/databases/$(database)/documents/registered_studies/$(studyID)).data.registered_participants;
match /participant_responses/{studyID}/participants/{participantID} {
allow create, read:
if
// Allows any combination of studyID and participantID to be created in Firebase
true
// participantID must be in the registered_participants array in the registered_studies/{studyID} document
// participantID in get(/databases/$(database)/documents/registered_studies/$(studyID)).data.registered_participants;

// experimentID must be in the data subcollection
match /data/{experimentID} {
allow create, read: if true
// experimentID must be in the data subcollection
match /data/{experimentID} {
allow create, read: if true

// trialID must be in the trials subcollection
match /trials/{trialID} {
allow create, read: if true
}
// trialID must be in the trials subcollection
match /trials/{trialID} {
allow create, read: if true
}
}
}
}
}
46 changes: 46 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Configuration file for Electron Forge
*/
module.exports = {
packagerConfig: {
asar: true,
icon: "assets/icons/icon",
},
makers: [
{
// zip files
name: "@electron-forge/maker-zip",
},
{
// Linux Distribution
name: "@electron-forge/maker-deb",
config: {
options: {
icon: "assets/icons/icon.png",
},
},
},
{
// Mac Distribution
name: "@electron-forge/maker-dmg",
config: {
icon: "assets/icons/icon.icns",
overwrite: true,
},
},
{
// Windows Distribution
name: "@electron-forge/maker-squirrel",
config: {
iconUrl: "https://raw.githubusercontent.com/brown-ccv/honeycomb/main/assets/icons/icon.ico",
setupIcon: "assets/icons/icon.ico",
},
},
],
plugins: [
{
name: "@electron-forge/plugin-auto-unpack-natives",
config: {},
},
],
};
Loading

0 comments on commit 92b3187

Please sign in to comment.