Skip to content

Commit

Permalink
Merge branch 'main' into retry-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD authored Feb 27, 2024
2 parents 1f5ad96 + 472d870 commit 1770936
Show file tree
Hide file tree
Showing 18 changed files with 184 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build-and-deploy-mac.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build-and-deploy-mac
name: Mac Release
run-name: ${{ github.actor }} is building a MAC release for NWB GUIDE

on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Build-and-deploy-win.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build-and-deploy-win
name: Windows Release
run-name: ${{ github.actor }} is building a Windows release for NWB GUIDE

on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pyflask-build-and-dist-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PyFlask build and distributable tests
name: Build Tests — Flask
on:
schedule:
- cron: "0 16 * * *" # Daily at noon EST
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/testing-external.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Dev Tests (Live Services)
on:
schedule:
- cron: "0 16 * * *" # Daily at noon EST
pull_request:

concurrency: # Cancel previous workflows on the same pull request
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CACHE_NUMBER: 2 # increase to reset cache manually

jobs:
testing:
name: Dev tests with live services on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
label: environments/environment-Linux.yml

- os: macos-latest
label: environments/environment-Mac.yml

- os: windows-latest
label: environments/environment-Windows.yml


steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow --tags

# see https://github.com/conda-incubator/setup-miniconda#caching-environments
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: nwb-guide
use-mamba: true

- name: Set cache date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Conda env
uses: actions/cache@v2
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}-${{ runner.arch }}-${{steps.get-date.outputs.today }}-${{ hashFiles(matrix.label) }}-${{ env.CACHE_NUMBER }}
id: cache

- if: steps.cache.outputs.cache-hit != 'true'
name: Create and activate environment
run: mamba env update -n nwb-guide -f ${{ matrix.label }}

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install GUIDE
run: npm ci

- name: Create env file
run: |
touch .env
echo DANDI_STAGING_API_KEY=${{ secrets.DANDI_STAGING_API_KEY }} >> .env
- if: matrix.os != 'ubuntu-latest'
name: Run tests
run: npm run coverage:app

- if: matrix.os == 'ubuntu-latest'
name: Run tests with xvfb
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run coverage:app


- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
10 changes: 2 additions & 8 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Back-end Tests
name: Dev Tests
on:
schedule:
- cron: "0 16 * * *" # Daily at noon EST
Expand All @@ -13,7 +13,7 @@ env:

jobs:
testing:
name: Back-end tests on ${{ matrix.os }}
name: Dev tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down Expand Up @@ -74,12 +74,6 @@ jobs:
- name: Install GUIDE
run: npm ci


- name: Create env file
run: |
touch .env
echo DANDI_STAGING_API_KEY=${{ secrets.DANDI_STAGING_API_KEY }} >> .env
- if: matrix.os != 'ubuntu-latest'
name: Run tests
uses: nick-fields/retry@v3
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
<p align="center">
<img src="src/renderer/assets/img/logo-guide-draft-transparent-tight.png" width="250" alt="NeuroConv logo"/>
<h3 align="center">NWB Graphical User Interface for Data Entry</h3>
<p align="center">
<a href="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/testing.yml"><img src="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/testing.yml/badge.svg" alt="Full Tests"></a>
<a href="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/testing-external.yml"><img src="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/testing-external.yml/badge.svg" alt="Full Tests with External Dependencies"></a>
<a href="https://github.com/neurodatawithoutborders/nwb-guide/actions/workflows/pyflask-build-and-dist-tests.yml"><img src="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/pyflask-build-and-dist-tests.yml/badge.svg" alt="Build and Distributable Tests"></a>
<a href="https://codecov.io/github/NeurodataWithoutBorders/nwb-guide?branch=main"><img src="https://codecov.io/github/NeurodataWithoutBorders/nwb-guide/coverage.svg?branch=main" alt="codecov"></a>
<a href="https://nwb-guide.readthedocs.io/en/latest/"><img src="https://readthedocs.org/projects/nwb-guide/badge/?version=latest" alt="Documentation"></a>
<a href="https://github.com/catalystneuro/nwb-guide/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="License: MIT"></a>
</p>
<p align="center">
<a href="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/Build-and-deploy-mac.yml"><img src="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/Build-and-deploy-mac.yml/badge.svg" alt="Mac Build"></a>
<a href="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/Build-and-deploy-win.yml"><img src="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/Build-and-deploy-win.yml/badge.svg" alt="Windows Build"></a>
</p>
<p align="center">
<a href="https://github.com/psf/black"><img alt="Python code style: black" src="https://img.shields.io/badge/python_code_style-black-000000.svg"></a>
<a href="https://github.com/prettier/prettier"><img alt="JavaScript code style: prettier" src="https://img.shields.io/badge/javascript_code_style-prettier-ff69b4.svg?style=flat"></a>
</p>
<p align="center">
<a href="https://join.slack.com/t/nwb-users/shared_invite/enQtNzMwOTcwNzQ2MDM5LWMyZDUwODJjYjM3MzMzYzZiNDk4ZTU3ZjQ3MmMxMmY5MDUyNzc0ZDI5ZjViYmJjYTQ5NjljOGFjZmMwOGIwZmQ"><img src="https://img.shields.io/badge/chat-Slack-lightblue?style=flat&logo=slack" alt="NWB Slack"></a>
</p>
</p>


NWB GUIDE is a desktop app that provides a no-code user interface for converting neurophysiology data to NWB.

<p align="center">
<a href="https://www.youtube.com/watch?v=z-rk2wi5BDc" target="_blank">
<img src="docs/assets/guide-video-image.png" alt="Watch the video" width="500" />
</a>
</p>


## Installation
See the installation instructions in our [documentation](https://nwb-guide.readthedocs.io/en/latest/installation.html).
10 changes: 6 additions & 4 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Start by cloning the repository
Install Python Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^


Install the appropriate Python dependencies for your operating system.

**Windows**
Expand All @@ -51,15 +50,19 @@ Install the appropriate Python dependencies for your operating system.
conda env create -f ./environments/environment-Linux.yml
Activate the Python Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Before starting NWB GUIDE, you'll need to ensure that the Python environment is activated.

.. code-block:: bash
conda activate nwb-guide
Installing JavaScript Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Install JavaScript Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Next, install all JavaScript dependencies based on the `package-lock.json` file.

Expand All @@ -78,7 +81,6 @@ You can now run the following command to start the application using Electron.
npm start
Repo Structure
--------------
1. **src/renderer/src** - Contains all the source code for the frontend
Expand Down
17 changes: 11 additions & 6 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ Installation
Windows
-------

Download and run the `NWB-GUIDE-Setup-vX.Y.Z.exe <https://github.com/NeurodataWithoutBorders/nwb-guide/releases/latest/download/NWB-GUIDE-x64.exe>`_ file and follow all instruction prompts.
Download and run `NWB-GUIDE-x64.exe <https://github.com/NeurodataWithoutBorders/nwb-guide/releases/latest/download/NWB-GUIDE-x64.exe>`_ and follow all instruction prompts.

MacOS - Intel
-------------

Download the `NWB-GUIDE-vX.Y.Z.dmg <https://github.com/NeurodataWithoutBorders/nwb-guide/releases/latest/download/NWB-GUIDE-x64.dmg>`_ file, which should prompt you to move it into your 'Applications' folder in order to run.
Download `NWB-GUIDE-x64.dmg <https://github.com/NeurodataWithoutBorders/nwb-guide/releases/latest/download/NWB-GUIDE-x64.dmg>`_, which should prompt you to move it into your 'Applications' folder in order to run.

MacOS - Apple Silicon
---------------------

Download the `NWB-GUIDE-vX.Y.Z-arm64.dmg <https://github.com/NeurodataWithoutBorders/nwb-guide/releases/latest/download/NWB-GUIDE-arm64.dmg>`_ file, which should prompt you to move it into your 'Applications' folder in order to run.
Download `NWB-GUIDE-arm64.dmg <https://github.com/NeurodataWithoutBorders/nwb-guide/releases/latest/download/NWB-GUIDE-arm64.dmg>`_, which should prompt you to move it into your 'Applications' folder in order to run.

.. note::
Some data formats can have issues using this build of the application. If you encounter errors when using a particular interface, try following the advanced :ref:`Developer Installation instructions<developer_installation>` instructions.

Ubuntu
------
Linux
-----

Please clone the :linux-fix:`linux-fix <>` branch of the NWB GUIDE and follow the :ref:`Developer Installation instructions<developer_installation>` on this documentation after the "Clone the Repo" step.
Please clone the :linux-fix:`linux-fix <>` branch of the NWB GUIDE and follow the :ref:`Developer Installation instructions<developer_installation>` after the "Clone the Repo" step.

.. code-block:: bash
git clone --branch linux-fix https://github.com/NeurodataWithoutBorders/nwb-guide
cd nwb-guide
5 changes: 4 additions & 1 deletion src/renderer/src/stories/InfoBox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LitElement, css, html } from "lit";
import { Chevron } from "./Chevron";
import { unsafeHTML } from "lit/directives/unsafe-html.js";

export class InfoBox extends LitElement {
static get styles() {
Expand Down Expand Up @@ -120,7 +121,9 @@ export class InfoBox extends LitElement {
${new Chevron({ direction: "right" })}
</div>
<div class="guided--info-container">
<span class="guided--help-text">${this.content}</span>
<span class="guided--help-text"
>${typeof this.content === "string" ? unsafeHTML(this.content) : this.content}</span
>
</div>
`;
}
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src/stories/JSONSchemaForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ export class JSONSchemaForm extends LitElement {

// if (!isValid && allErrors.length && nMissingRequired === allErrors.length) message = `${nMissingRequired} required inputs are not defined.`;

console.log(allErrors);
// Check if all inputs are valid
if (flaggedInputs.length) {
flaggedInputs[0].focus();
Expand Down
36 changes: 25 additions & 11 deletions src/renderer/src/stories/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,37 @@ export class Search extends LitElement {

#sortedCategories = [];

getTokens = (input) =>
input
.replaceAll(/[^\w\s]/g, "")
.split(" ")
.map((token) => token.trim().toLowerCase())
.filter((token) => token);

#populate = (input = this.value ?? "") => {
const toShow = [];

// Check if the input value matches the label
this.#options.forEach(({ option, label }, i) => {
if (label.toLowerCase().includes(input.toLowerCase()) && !toShow.includes(i)) toShow.push(i);
});
const inputTokens = this.getTokens(input);

// Check if the input value matches any of the keywords
this.#options.forEach(({ option, keywords = [], structuredKeywords = {} }, i) => {
[...keywords, ...Object.values(structuredKeywords).flat()].forEach((keyword) => {
if (keyword.toLowerCase().includes(input.toLowerCase()) && !toShow.includes(i)) toShow.push(i);
});
// Check if the input value matches the label or any of the keywords
this.#options.forEach(({ label, keywords, structuredKeywords }, i) => {
const labelTokens = this.getTokens(label);
const allKeywords = [...keywords, ...Object.values(structuredKeywords).flat()];
const allKeywordTokens = allKeywords.map((keyword) => this.getTokens(keyword)).flat();
const allTokens = [...labelTokens, ...allKeywordTokens];

const result = inputTokens.reduce((acc, token) => {
for (let subtoken of allTokens) {
if (subtoken.startsWith(token) && !toShow.includes(i)) return (acc += 1);
}
return acc;
}, 0);

if (result === inputTokens.length) toShow.push(i);
});

this.#options.forEach(({ option }, i) => {
if (toShow.includes(i)) {
if (toShow.includes(i) || !inputTokens.length) {
option.removeAttribute("hidden");
} else {
option.setAttribute("hidden", "");
Expand All @@ -285,7 +299,7 @@ export class Search extends LitElement {
else element.removeAttribute("hidden");
});

this.setAttribute("active", !!toShow.length);
this.setAttribute("active", !!toShow.length || !inputTokens.length);
this.setAttribute("interacted", true);
};

Expand Down
3 changes: 1 addition & 2 deletions src/renderer/src/stories/pages/guided-mode/GuidedStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ export class GuidedStartPage extends Page {
Although not required to use the GUIDE, you can learn more about the NWB conversion
process in the
<a href="https://neuroconv.readthedocs.io/en/main" target="_blank"
>neuroconv documentation page</a
>
>neuroconv documentation page</a>.
`,
})}
</div>
Expand Down
22 changes: 10 additions & 12 deletions src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export class GuidedMetadataPage extends ManagedPage {
}

beforeSave = () => {
console.log(this.localState.results, this.info.globalState.results);
merge(this.localState.results, this.info.globalState.results);
};

Expand Down Expand Up @@ -195,22 +194,21 @@ export class GuidedMetadataPage extends ManagedPage {
// Set most Ophys tables to have minItems / maxItems equal (i.e. no editing possible)
drillSchemaProperties(
resolvedSchema,
(path, schema, target, isPatternProperties) => {
(path, schema, target, isPatternProperties, parentSchema) => {
if (path[0] === "Ophys") {
const name = path.slice(-1)[0];

if (isPatternProperties) {
schema.minItems = schema.maxItems = Object.values(resolveFromPath(path, results)).length;
return;
}
if (isPatternProperties)
return (schema.minItems = schema.maxItems =
Object.values(resolveFromPath(path, results)).length);

if (schema.type === "array") {
if (
name !== "Device" &&
target &&
name in target // Skip unresolved deep in pattern properties
) {
schema.minItems = schema.maxItems = target[name].length;
if (name !== "Device" && target) {
if (name in target)
schema.minItems = schema.maxItems = target[name].length; // Skip unresolved deep in pattern properties)
// Remove Ophys requirements if left initially undefined
else if (parentSchema.required.includes(name))
parentSchema.required = parentSchema.required.filter((n) => n !== name);
}
}
}
Expand Down
Loading

0 comments on commit 1770936

Please sign in to comment.