Skip to content

Commit

Permalink
Merge branch 'main' into ephys-metadata-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD authored Mar 12, 2024
2 parents 3e5a1be + 3d994b7 commit 94ae7d7
Show file tree
Hide file tree
Showing 18 changed files with 194 additions and 67 deletions.
1 change: 1 addition & 0 deletions environments/environment-MAC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- jsonschema = 4.18.0 # installs jsonschema-specifications
- pip
- pip:
- scipy<1.12.0 # Fix needed for scipy._lib._testutils
- chardet == 5.1.0
- configparser == 6.0.0
- flask == 2.3.2
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"build:mac": "npm run build && npm run build:flask && npm run build:electron:mac",
"build:linux": "npm run build && npm run build:flask && npm run build:electron:linux",
"build:flask": "python -m PyInstaller nwb-guide.spec --log-level DEBUG --clean --noconfirm --distpath ./build/flask",
"build:flask:spec:base": "pyi-makespec --name nwb-guide --onedir --collect-data jsonschema_specifications --collect-all dandi --collect-all keyrings --collect-all unittest --collect-all nwbinspector --collect-all neuroconv --collect-all pynwb --collect-all hdmf --collect-all hdmf_zarr --collect-all ndx_dandi_icephys --collect-all sklearn --collect-all ci_info ./pyflask/app.py",
"build:flask:spec": "npm run build:flask:spec:base && python prepare_pyinstaller_spec.py",
"build:electron:win": "electron-builder build --win --publish never",
"build:electron:mac": "electron-builder build --mac --publish never",
"build:electron:linux": "electron-builder build --linux --publish never",
Expand Down
43 changes: 0 additions & 43 deletions prepare_pyinstaller_spec.py

This file was deleted.

4 changes: 2 additions & 2 deletions schemas/json/generated/BlackrockRecordingInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"properties": {
"file_path": {
"format": "file",
"type": "string",
"description": "Path to Blackrock file."
"description": "Path to Blackrock file.",
"type": "string"
},
"nsx_override": {
"format": "file",
Expand Down
6 changes: 4 additions & 2 deletions schemas/json/generated/BlackrockSortingInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
"properties": {
"file_path": {
"format": "file",
"type": "string",
"description": "Path to Blackrock file."
"description": "Path to Blackrock file.",
"type": "string"
},
"sampling_frequency": {
"description": "The sampling frequency for the sorting extractor. When the signal data is available (.ncs) those files will be",
"type": "number"
},
"verbose": {
"description": "Enables verbosity",
"type": "boolean",
"default": true
}
Expand Down
35 changes: 35 additions & 0 deletions schemas/json/generated/CellExplorerRecordingInterface.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"required": [],
"properties": {
"CellExplorerRecordingInterface": {
"required": [
"folder_path"
],
"properties": {
"folder_path": {
"format": "directory",
"description": "The folder where the session data is located. It should contain a\n`{folder.name}.session.mat` file and the binary files `{folder.name}.dat`\nor `{folder.name}.lfp` for the LFP interface.",
"type": "string"
},
"verbose": {
"description": "Whether to output verbose text.",
"type": "boolean",
"default": true
},
"es_key": {
"type": "string",
"default": "ElectricalSeries"
}
},
"type": "object",
"additionalProperties": false
}
},
"type": "object",
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "source.schema.json",
"title": "Source data schema",
"description": "Schema for the source data, files and directories",
"version": "0.1.0"
}
7 changes: 7 additions & 0 deletions schemas/json/generated/FicTracDataInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
"format": "file",
"type": "string"
},
"radius": {
"type": "number"
},
"configuration_file_path": {
"format": "file",
"type": "string"
},
"verbose": {
"type": "boolean",
"default": true
Expand Down
3 changes: 3 additions & 0 deletions schemas/json/generated/OpenEphysRecordingInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"stream_name": {
"type": "string"
},
"block_index": {
"type": "number"
},
"verbose": {
"type": "boolean",
"default": true
Expand Down
5 changes: 4 additions & 1 deletion schemas/json/generated/PhySortingInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"type": "string"
},
"exclude_cluster_groups": {
"type": "array"
"type": "array",
"items": {
"type": "string"
}
},
"verbose": {
"type": "boolean",
Expand Down
4 changes: 2 additions & 2 deletions schemas/json/generated/Spike2RecordingInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"properties": {
"file_path": {
"format": "file",
"type": "string",
"description": "Path to CED data file."
"description": "Path to CED data file.",
"type": "string"
},
"verbose": {
"type": "boolean",
Expand Down
5 changes: 3 additions & 2 deletions schemas/json/generated/SpikeGLXConverterPipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"properties": {
"folder_path": {
"format": "directory",
"type": "string",
"description": "Path to the folder containing SpikeGLX streams."
"description": "Path to the folder containing SpikeGLX streams.",
"type": "string"
},
"verbose": {
"description": "Whether to output verbose text.",
"type": "boolean",
"default": false
}
Expand Down
6 changes: 4 additions & 2 deletions schemas/json/generated/SpikeGLXNIDQInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
"properties": {
"file_path": {
"format": "file",
"type": "string",
"description": "Path to SpikeGLX .nidq file."
"description": "Path to SpikeGLX .nidq file.",
"type": "string"
},
"verbose": {
"description": "Whether to output verbose text.",
"type": "boolean",
"default": true
},
"load_sync_channel": {
"description": "Whether to load the last channel in the stream, which is typically used for synchronization.\nIf True, then the probe is not loaded.",
"type": "boolean",
"default": false
},
Expand Down
5 changes: 3 additions & 2 deletions schemas/json/generated/SpikeGLXRecordingInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"properties": {
"file_path": {
"format": "file",
"type": "string",
"description": "Path to SpikeGLX ap.bin or lf.bin file."
"description": "Path to SpikeGLX ap.bin or lf.bin file.",
"type": "string"
},
"verbose": {
"description": "Whether to output verbose text.",
"type": "boolean",
"default": true
},
Expand Down
20 changes: 14 additions & 6 deletions schemas/json/generated/Suite2pSegmentationInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@
"format": "directory",
"type": "string"
},
"combined": {
"type": "boolean",
"default": false
"channel_name": {
"type": "string"
},
"plane_no": {
"type": "number",
"default": 0
"plane_name": {
"type": "string"
},
"plane_segmentation_name": {
"type": "string"
},
"verbose": {
"type": "boolean",
"default": true
},
"combined": {
"type": "boolean",
"default": false
},
"plane_no": {
"type": "number"
}
},
"type": "object",
Expand Down
41 changes: 41 additions & 0 deletions schemas/json/generated/TdtRecordingInterface.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"required": [],
"properties": {
"TdtRecordingInterface": {
"required": [
"folder_path",
"gain"
],
"properties": {
"folder_path": {
"format": "directory",
"type": "string"
},
"gain": {
"type": "number"
},
"stream_id": {
"type": "string",
"default": "0"
},
"verbose": {
"type": "boolean",
"default": true
},
"es_key": {
"type": "string",
"default": "ElectricalSeries"
}
},
"type": "object",
"additionalProperties": false
}
},
"type": "object",
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "source.schema.json",
"title": "Source data schema",
"description": "Schema for the source data, files and directories",
"version": "0.1.0"
}
1 change: 1 addition & 0 deletions schemas/source-data.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function preprocessSourceDataSchema (schema) {
if (key === 'VideoInterface' || key === 'AudioInterface') {
if (schema.properties.file_paths) {
Object.assign(schema.properties.file_paths, {
items: { type: 'string' },
description: '<b>Only one file supported at this time.</b> Multiple file support coming soon.',
maxItems: 1,
})
Expand Down
38 changes: 35 additions & 3 deletions src/renderer/src/stories/JSONSchemaInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { JSONSchemaForm, getIgnore } from "./JSONSchemaForm";
import { Search } from "./Search";
import tippy from "tippy.js";
import { merge } from "./pages/utils";
import { InspectorListItem } from "./preview/inspector/InspectorList";

const isDevelopment = !!import.meta.env;

const dateTimeRegex = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/;

Expand Down Expand Up @@ -504,6 +507,27 @@ export class JSONSchemaInput extends LitElement {
required = false;
validateOnChange = true;

// Print the default value of the schema if not caught
onUncaughtSchema = (schema) => {
// In development, show uncaught schemas
if (!isDevelopment) {
if (this.form) {
const inputContainer = this.form.shadowRoot.querySelector(`#${this.path.slice(-1)[0]}`);
inputContainer.style.display = "none";
}
}

if (schema.default) return `<pre>${JSON.stringify(schema.default, null, 2)}</pre>`;

const error = new InspectorListItem({
message:
"<h3 style='margin: 0'>Internal GUIDE Error</h3><span>Cannot render this property because of a misformatted schema.</span>",
});
error.style.width = "100%";

return error;
};

constructor(props) {
super();
Object.assign(this, props);
Expand Down Expand Up @@ -872,7 +896,16 @@ export class JSONSchemaInput extends LitElement {
if (isArray) {
const hasItemsRef = "items" in schema && "$ref" in schema.items;
if (!("items" in schema)) schema.items = {};
if (!("type" in schema.items) && !hasItemsRef) schema.items.type = this.#getType(this.value?.[0]);
if (!("type" in schema.items) && !hasItemsRef) {
// Guess the type of the first item
if (this.value) {
const itemToCheck = this.value[0];
schema.items.type = itemToCheck ? this.#getType(itemToCheck) : "string";
}

// If no value, handle uncaught schema
else return this.onUncaughtSchema(schema);
}
}

const itemSchema = this.form?.getSchema ? this.form.getSchema("items", schema) : schema["items"];
Expand Down Expand Up @@ -1138,8 +1171,7 @@ export class JSONSchemaInput extends LitElement {
}
}

// Print out the immutable default value
return html`<pre>${schema.default ? JSON.stringify(schema.default, null, 2) : "No default value"}</pre>`;
return this.onUncaughtSchema(schema);
}
}

Expand Down
Loading

0 comments on commit 94ae7d7

Please sign in to comment.