Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ophys Metadata #505

Merged
merged 183 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
4560231
Enable Ophys and fix table
garrettmflynn Nov 9, 2023
45aea75
Add table in table
garrettmflynn Nov 9, 2023
3223109
Merge branch 'disable-schema-props' into ophys-metadata
garrettmflynn Nov 9, 2023
67731fd
Update form with new data
garrettmflynn Nov 9, 2023
23c90db
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2023
ac9394e
Merge branch 'disable-schema-props' into ophys-metadata
garrettmflynn Nov 9, 2023
10f05cd
Merge branch 'disable-schema-props' into ophys-metadata
CodyCBakerPhD Nov 9, 2023
0a0afb3
Merge branch 'main' into ophys-metadata
garrettmflynn Nov 9, 2023
2e54119
Merge branch 'disable-schema-props' into ophys-metadata
garrettmflynn Nov 9, 2023
c6c1a23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2023
e73fdde
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Nov 10, 2023
fc0abe7
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Nov 11, 2023
6eeea26
Improve ignore specificity
garrettmflynn Nov 11, 2023
91134a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2023
ffcc1f1
Properly ignore properties in tables
garrettmflynn Nov 11, 2023
16a0906
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Nov 11, 2023
e84e8e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2023
c218ffd
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Nov 11, 2023
0176293
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Nov 11, 2023
31b0176
Allow ordering the table columns
garrettmflynn Nov 11, 2023
f857aed
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Nov 11, 2023
0a3809e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2023
9d5babf
Max height of table cell and other updates
garrettmflynn Nov 11, 2023
a420280
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Nov 11, 2023
1fe9836
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2023
c267c32
Merge branch 'main' into ophys-metadata
garrettmflynn Nov 11, 2023
9f7891c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2023
3d454e9
Allow segmentation
garrettmflynn Nov 11, 2023
cf1d990
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Nov 11, 2023
d497565
Update GuidedMetadata.js
garrettmflynn Nov 11, 2023
ce8d56d
Update base-metadata.schema.ts
garrettmflynn Nov 11, 2023
296a179
Update base-metadata.schema.ts
garrettmflynn Nov 11, 2023
66916bb
Update BasicTable.js
garrettmflynn Nov 12, 2023
6d1c510
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Nov 21, 2023
b6cefb2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 21, 2023
0361b82
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Nov 22, 2023
019e1ab
Merge branch 'main' into ophys-metadata
garrettmflynn Nov 22, 2023
86e07c6
Merge branch 'main' into ophys-metadata
garrettmflynn Nov 29, 2023
5450bf9
Update sorting
garrettmflynn Nov 29, 2023
cefafc3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 29, 2023
95e3b5f
Basic patternProperties rendering
garrettmflynn Nov 30, 2023
160c8c1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 30, 2023
f0c4821
Flag additional properties (but avoid for now)
garrettmflynn Nov 30, 2023
425b302
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 30, 2023
98886d8
Encode IDs
garrettmflynn Nov 30, 2023
3b324ef
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Nov 30, 2023
b8004fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 30, 2023
e6ecdd4
Update data from pattern properties forms
garrettmflynn Dec 13, 2023
9563807
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2023
676e939
Fix list
garrettmflynn Dec 13, 2023
97b1913
Add pattern properties
garrettmflynn Dec 13, 2023
4963d85
Merge branch 'main' into ophys-metadata
garrettmflynn Dec 13, 2023
c7dc62c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2023
7fb923e
Correct for merge and patternProperties
garrettmflynn Dec 15, 2023
273b83d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2023
5a2a18d
Validate only patternProperties when provided
garrettmflynn Dec 15, 2023
f71fcd6
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Dec 15, 2023
a7cbd0a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2023
067c372
Fix table validation
garrettmflynn Dec 15, 2023
cb44409
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Dec 15, 2023
9348b1f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2023
6b74de4
Fix table validation in tests
garrettmflynn Dec 15, 2023
9167be5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2023
0be825c
Allow editing nested tables
garrettmflynn Dec 18, 2023
b9975a5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2023
3596b77
Proper validation of all table properties, including nested
garrettmflynn Dec 18, 2023
e35b970
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2023
90c9b9d
Allow NaN in forms for numbers
garrettmflynn Dec 18, 2023
8e2bd00
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Dec 18, 2023
e2ed87c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 18, 2023
eb1c0ad
Warn users about changing a device name
garrettmflynn Dec 21, 2023
af2fda4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 21, 2023
ea811a1
Proper exclusion of certain JSON Schema errors
garrettmflynn Dec 21, 2023
aa5f7cd
Show additional properties and block adding them
garrettmflynn Dec 21, 2023
20a33c1
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Dec 21, 2023
6e1599a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 21, 2023
16aba1a
Fix validation
garrettmflynn Dec 28, 2023
b1532fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 28, 2023
45242ce
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Dec 31, 2023
9c95fbb
Exclude additionalProperties rendering group if none exist on initial…
garrettmflynn Dec 31, 2023
17a201c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 31, 2023
7e42759
Exclude additional properties from (auto)validated object
garrettmflynn Dec 31, 2023
8cef7e9
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Dec 31, 2023
780598f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 31, 2023
0287695
fix bad merge conflict
CodyCBakerPhD Dec 31, 2023
0d659cd
Preprocess refs independently from the JSON Schema form
garrettmflynn Dec 31, 2023
ed453b3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 31, 2023
a7ea64b
Update typescript
garrettmflynn Dec 31, 2023
5260306
Update utils.ts
garrettmflynn Dec 31, 2023
085c928
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 31, 2023
6f70a77
Merge branch 'main' into ophys-metadata
garrettmflynn Jan 3, 2024
23d56de
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
12234df
Fix merge
garrettmflynn Jan 3, 2024
aeac3de
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 3, 2024
ed5611d
Update JSONSchemaInput.js
garrettmflynn Jan 3, 2024
b2b073f
Update JSONSchemaInput.js
garrettmflynn Jan 3, 2024
8e1ffbe
Fix ignore
garrettmflynn Jan 3, 2024
2ab1a34
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
6829a42
Remove editing test div
garrettmflynn Jan 3, 2024
c3b2ac3
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 3, 2024
18afec8
Update List.ts
garrettmflynn Jan 3, 2024
b25caf4
Allow adding row to table without any
garrettmflynn Jan 3, 2024
38e2a9e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
09e5d84
Proper NaN representation
garrettmflynn Jan 3, 2024
37ae64d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
2dab4b9
Auto-update devices on dependencies if changed
garrettmflynn Jan 3, 2024
2da1318
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 3, 2024
d90f34f
Render pattern properties as tables in the File Metadata
garrettmflynn Jan 3, 2024
959ee90
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
ad7a1af
Check unique device names
garrettmflynn Jan 4, 2024
9c776c0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 4, 2024
9c1c68a
Ensure safe property editing
garrettmflynn Jan 4, 2024
592b763
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 4, 2024
724a320
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 4, 2024
ab37d93
Render as editable tables
garrettmflynn Jan 4, 2024
6aab853
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 4, 2024
6a7b50b
Pass schema appropriately from all tables
garrettmflynn Jan 8, 2024
1ba6647
Fix validation
garrettmflynn Jan 9, 2024
95f71ea
Fix plane metadata
garrettmflynn Jan 11, 2024
25deb97
Merge branch 'main' into ophys-metadata
garrettmflynn Jan 11, 2024
efb4a02
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 11, 2024
8e04428
Ensure pipelines are consistent with new structure
garrettmflynn Jan 11, 2024
56e0ecc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 11, 2024
95bcfb7
Update GuidedMetadata.js
garrettmflynn Jan 11, 2024
7e473c7
Merge branch 'fix-project-tracking' into ophys-metadata
garrettmflynn Jan 11, 2024
2692aa9
Update BasicTable.js
garrettmflynn Jan 11, 2024
0b36101
Fix variables
garrettmflynn Jan 11, 2024
8abb309
Merge branch 'main' into ophys-metadata
garrettmflynn Jan 12, 2024
5bebd2c
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Jan 17, 2024
5390233
Fix ignore and click instruction
garrettmflynn Jan 17, 2024
df79b82
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 17, 2024
6fe8c80
Fix nested validation
garrettmflynn Jan 17, 2024
17e3635
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 17, 2024
272fe9f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 18, 2024
167caaa
Intermediate update for ignore improvements
garrettmflynn Jan 18, 2024
c4302e8
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 18, 2024
2d4c2ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 18, 2024
b48c838
Merge branch 'main' into ophys-metadata
CodyCBakerPhD Jan 23, 2024
83f950f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2024
e955c69
Fix deep ignore passing. Don't render empty TwoPhotonSeries. Reorder …
garrettmflynn Jan 23, 2024
09e3793
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2024
56cdf73
Merge branch 'main' into ophys-metadata
garrettmflynn Jan 23, 2024
a0edf0d
Handle additional properties like custom pattern properties
garrettmflynn Jan 23, 2024
1ca4960
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2024
e4d5972
Fix tests
garrettmflynn Jan 23, 2024
9995dfd
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 23, 2024
04aaba5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2024
591a140
Fix validation and pressing enter on table cells
garrettmflynn Jan 23, 2024
cb8c155
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 23, 2024
ef24e34
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2024
949dced
Update GuidedMetadata.js
garrettmflynn Jan 23, 2024
9b6b545
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 23, 2024
44c9025
Fix array autofill for tables
garrettmflynn Jan 24, 2024
44d4cd4
Merge branch 'main' into ophys-metadata
garrettmflynn Jan 24, 2024
713cee6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2024
2c51b40
Fix pipeline generation button
garrettmflynn Jan 24, 2024
20a1507
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 24, 2024
83f0043
Fix error headers and modal header
garrettmflynn Jan 24, 2024
10e4d6f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2024
88cead9
add more test cases
CodyCBakerPhD Jan 24, 2024
1660a94
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2024
d4b73a4
Limit table interactions based on min/maxItems
garrettmflynn Jan 24, 2024
e298f54
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 24, 2024
6e61a00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2024
362b7c2
Hide property key on custom tables
garrettmflynn Jan 24, 2024
8dc8eb8
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 24, 2024
eb0f0a4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2024
f9be972
Update Table.js
garrettmflynn Jan 24, 2024
7c36b9a
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 24, 2024
792b183
Fix nested copy/paste
garrettmflynn Jan 24, 2024
b3e9bf0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2024
b432f09
Do not delete definitions
garrettmflynn Jan 25, 2024
dfa145a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 25, 2024
a0191f8
Update utils.ts
garrettmflynn Jan 25, 2024
7a60e1e
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 25, 2024
79fe244
Update JSONSchemaInput.js
garrettmflynn Jan 25, 2024
e89a4e5
Fix table validation
garrettmflynn Jan 25, 2024
8729bf2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 25, 2024
6bd83dd
Fix validation
garrettmflynn Jan 25, 2024
ce9f068
Merge branch 'ophys-metadata' of https://github.com/NeurodataWithoutB…
garrettmflynn Jan 25, 2024
7b4024f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 25, 2024
3297634
Coerce to float in pattern properties
garrettmflynn Jan 26, 2024
3fad7fc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion guide_testing_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ pipelines:
PhySortingInterface:
folder_path: ephy_testing_data/phy/phy_example_0

SpikeGLX-v1-SingleProbe-AP:
SpikeGLX_v1_SingleProbe_AP:
SpikeGLXRecordingInterface:
file_path: ephy_testing_data/spikeglx/Noise4Sam_g0/Noise4Sam_g0_imec0/Noise4Sam_g0_t0.imec0.ap.bin

Suite2P_SinglePlane_SingleChannel:
Suite2pSegmentationInterface:
folder_path: ophys_testing_data/segmentation_datasets/suite2p

Caiman_SinglePlane_SingleChannel:
CaimanSegmentationInterface:
file_path: ophys_testing_data/segmentation_datasets/caiman/caiman_analysis.hdf5

ScanImage_SinglePlane_SingleChannel:
ScanImageImagingInterface:
file_path: ophys_testing_data/imaging_datasets/ScanImage/scanimage_20220801_single.tif
12 changes: 10 additions & 2 deletions pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ def replace_none_with_nan(json_object, json_schema):
def coerce_schema_compliance_recursive(obj, schema):
if isinstance(obj, dict):
for key, value in obj.items():
if key in schema.get("properties", {}):
# Coerce on pattern properties as well
pattern_properties = schema.get("patternProperties")
if pattern_properties:
for pattern, pattern_schema in pattern_properties.items():
regex = re.compile(pattern)
if regex.match(key):
coerce_schema_compliance_recursive(value, pattern_schema)

elif key in schema.get("properties", {}):
prop_schema = schema["properties"][key]
if prop_schema.get("type") == "number" and value is None:
if prop_schema.get("type") == "number" and (value is None or value == "NaN"):
obj[
key
] = (
Expand Down
62 changes: 60 additions & 2 deletions schemas/base-metadata.schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { serverGlobals, resolve } from '../src/renderer/src/server/globals'

import { header } from '../src/renderer/src/stories/forms/utils'
import { header, replaceRefsWithValue } from '../src/renderer/src/stories/forms/utils'

import baseMetadataSchema from './json/base_metadata_schema.json' assert { type: "json" }

Expand Down Expand Up @@ -37,7 +37,9 @@ function getSpeciesInfo(species: any[][] = []) {
export const preprocessMetadataSchema = (schema: any = baseMetadataSchema, global = false) => {


const copy = structuredClone(schema)
const copy = replaceRefsWithValue(structuredClone(schema))

copy.additionalProperties = false

// Add unit to weight
const subjectProps = copy.properties.Subject.properties
Expand Down Expand Up @@ -82,6 +84,62 @@ export const preprocessMetadataSchema = (schema: any = baseMetadataSchema, globa
nwbProps.keywords.description = 'Terms to describe your dataset (e.g. Neural circuits, V1, etc.)' // Add description to keywords


const ophys = copy.properties.Ophys

if (ophys) {

const getProp = (name: string) => ophys.properties[name]

if (getProp("TwoPhotonSeries")) {
const tpsItemSchema = getProp("TwoPhotonSeries").items
tpsItemSchema.order = [
"name",
"description",
"scan_line_rate",
"field_of_view"
]

tpsItemSchema.properties.pmt_gain.title = 'Photomultiplier Gain'
}


if (getProp("ImagingPlane")) {
const imagingPlaneItems = getProp("ImagingPlane").items
imagingPlaneItems.order = [
"name",
"description",
"device",
"optical_channel",
"excitation_lambda",
"indicator",
"location",
"reference_frame",
"imaging_rate",
'grid_spacing',
"grid_spacing_unit",
"origin_coords",
'origin_coords_unit'
]

imagingPlaneItems.properties.optical_channel.items.order = ["name", "description"]

}
}


Object.entries(copy.properties).forEach(([key, value]) => {

Object.entries(value.properties).forEach(([k, v]) => {

// Uniformly grab definitions
const ref = v.items ?? v
if (!ref.properties) return
Object.keys(ref.properties).forEach(k => {
const info = ref.properties[k]
if (info.description && info.description.includes('DEPRECATED')) delete ref.properties[k] // Remove deprecated properties
})
})
})

// Remove non-global properties
if (global) {
Expand Down
4 changes: 3 additions & 1 deletion schemas/json/dandi/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
"description": "Your DANDI API key from the <a href='https://gui-staging.dandiarchive.org' target='_blank'>staging server</a>"
}
},
"additionalProperties": false,
"required": ["main_api_key"]
}
},
"required": ["api_keys"]
"required": ["api_keys"],
"additionalProperties": false
}
4 changes: 3 additions & 1 deletion schemas/json/project/globals.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"format": "directory",
"description": "Provide a custom output location for your NWB files. Will default to ~/NWB_GUIDE/conversions"
}
}
},

"additionalProperties": false
}
2 changes: 2 additions & 0 deletions schemas/json/tutorial.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
}
},

"additionalProperties": false,

"required": ["test_data_directory_path"]
}
1 change: 1 addition & 0 deletions src/renderer/assets/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ body {
margin: 0;
height: 100%;
display: flex;
overflow: hidden; /* Dashboard without scroll behavior */
}

a {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/progress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function decode(text) {
}
}

function drill(object, callback) {
export function drill(object, callback) {
if (object && typeof object === "object") {
const copy = Array.isArray(object) ? [...object] : { ...object };
for (let k in copy) {
Expand Down
75 changes: 53 additions & 22 deletions src/renderer/src/stories/BasicTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { errorHue, warningHue } from "./globals";
import * as promises from "../promises";

import "./Button";
import { sortTable } from "./Table";
import tippy from "tippy.js";

export class BasicTable extends LitElement {
static get styles() {
Expand Down Expand Up @@ -105,6 +107,7 @@ export class BasicTable extends LitElement {
constructor({
name,
schema,
ignore,
data,
keyColumn,
maxHeight,
Expand All @@ -121,11 +124,27 @@ export class BasicTable extends LitElement {
this.maxHeight = maxHeight ?? "";
this.validateEmptyCells = validateEmptyCells ?? true;

this.ignore = ignore ?? {};

if (validateOnChange) this.validateOnChange = validateOnChange;
if (onStatusChange) this.onStatusChange = onStatusChange;
if (onLoaded) this.onLoaded = onLoaded;
}

#schema = {};
#itemSchema = {};
#itemProps = {};

get schema() {
return this.#schema;
}

set schema(schema) {
this.#schema = schema;
this.#itemSchema = schema.items;
this.#itemProps = { ...this.#itemSchema.properties };
}

#rendered;
#updateRendered = (force) =>
force || this.rendered === true
Expand All @@ -134,7 +153,7 @@ export class BasicTable extends LitElement {
rendered = this.#updateRendered(true);

#renderHeaderContent = (str) => {
const required = this.schema.required ? this.schema.required.includes(str) : false;
const required = this.#itemSchema.required ? this.#itemSchema.required.includes(str) : false;
if (required) return html`<div class="relative"><span required>${header(str)}</span></div>`;
return html`<div class="relative"><span>${header(str)}</span></div>`;
};
Expand All @@ -155,7 +174,7 @@ export class BasicTable extends LitElement {
value =
(hasRow ? this.data[row][col] : undefined) ??
// this.globals[col] ??
this.schema.properties[col].default ??
this.#itemSchema.properties[col].default ??
"";
return value;
});
Expand Down Expand Up @@ -197,7 +216,7 @@ export class BasicTable extends LitElement {

let result;

const propInfo = this.schema.properties[col] ?? {};
const propInfo = this.#itemProps[col] ?? {};
let thisTypeOf = typeof value;
let ogType;
let type = (ogType = propInfo.type || propInfo.data_type);
Expand All @@ -218,13 +237,13 @@ export class BasicTable extends LitElement {
}

// Check if required
if (!value && "required" in this.schema && this.schema.required.includes(col))
if (!value && "required" in this.#itemSchema.required.includes(col))
result = [{ message: `${col} is a required property`, type: "error" }];
// If not required, check matching types for values that are defined
else if (value !== "" && thisTypeOf !== type)
result = [{ message: `${col} is expected to be of type ${ogType}, not ${thisTypeOf}`, type: "error" }];
// Otherwise validate using the specified onChange function
else result = this.validateOnChange(col, parent, value);
else result = this.validateOnChange([col], parent, value, this.#itemProps[col]);

// Will run synchronously if not a promise result
return promises.resolve(result, () => {
Expand All @@ -239,14 +258,12 @@ export class BasicTable extends LitElement {

if (result === false) errors.push({ message: "Cell is invalid" });

if (warnings.length) {
info.warning = "";
info.title = warnings.map((error) => error.message).join("\n");
}

if (errors.length) {
info.error = "";
info.title = errors.map((error) => error.message).join("\n"); // Class switching handled automatically
} else if (warnings.length) {
info.warning = "";
info.title = warnings.map((warning) => warning.message).join("\n");
}

if (typeof result === "function") result(); // Run if returned value is a function
Expand All @@ -265,6 +282,19 @@ export class BasicTable extends LitElement {
if (info === true) return;
const td = this.shadowRoot.getElementById(`i${i}_j${j}`);
if (td) {
const message = info.title;
delete info.title;

if (td._tippy) {
td._tippy.destroy();
td.removeAttribute("data-message");
}

if (message !== undefined) {
tippy(td, { content: message, allowHTML: true });
td.setAttribute("data-message", message);
}

for (let key in info) {
const value = info[key];
if (value === undefined) td.removeAttribute(key);
Expand Down Expand Up @@ -326,9 +356,7 @@ export class BasicTable extends LitElement {
Object.keys(data).forEach((row) => {
const cols = structuredData[row];
const latest = (this.data[this.keyColumn ? cols[this.keyColumn] : row] = {});
Object.entries(cols).forEach(([key, value]) =>
key in this.schema.properties ? (latest[key] = value) : ""
); // Only include data from schema
Object.entries(cols).forEach(([key, value]) => (key in this.#itemProps ? (latest[key] = value) : "")); // Only include data from schema
});

this.onUpdate(null, null, value); // Update the whole table
Expand All @@ -338,10 +366,12 @@ export class BasicTable extends LitElement {
render() {
this.#updateRendered();

const entries = { ...this.schema.properties };
const entries = this.#itemProps;
for (let key in this.ignore) delete entries[key];
for (let key in this.ignore["*"] ?? {}) delete entries[key];

// Add existing additional properties to the entries variable if necessary
if (this.schema.additionalProperties) {
if (this.#itemSchema.additionalProperties) {
Object.values(this.data).reduce((acc, v) => {
Object.keys(v).forEach((k) =>
!(k in entries)
Expand All @@ -358,13 +388,14 @@ export class BasicTable extends LitElement {
const keys =
(this.#keys =
this.colHeaders =
Object.keys(entries).sort((a, b) => {
if (a === this.keyColumn) return -1;
if (b === this.keyColumn) return 1;
if (entries[a].required && !entries[b].required) return -1;
if (!entries[a].required && entries[b].required) return 1;
return 0;
}));
sortTable(
{
...this.#itemSchema,
properties: entries,
},
this.keyColumn,
this.#itemSchema.order
));

// Try to guess the key column if unspecified
if (!Array.isArray(this.data) && !this.keyColumn) {
Expand Down
Loading
Loading