From 46706b1f0a719101012ea6162c2213c98e188928 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Fri, 29 May 2026 14:06:48 -0700 Subject: [PATCH 1/2] fix: allow subject/procedures 400 responses, expose error messages, fix typo (#159) * fix: expose full contents of error messages * fix: allow 400 responses for subject/procedures * docs: typo --- .../prepare_before_acquisition.md | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/docs/source/acquire_upload/prepare_before_acquisition.md b/docs/source/acquire_upload/prepare_before_acquisition.md index 710625d..e825a3e 100644 --- a/docs/source/acquire_upload/prepare_before_acquisition.md +++ b/docs/source/acquire_upload/prepare_before_acquisition.md @@ -21,7 +21,7 @@ The funding endpoint will be used during data upload to populate your data descr ```{raw} html
- + @@ -84,7 +84,7 @@ The funding endpoint will be used during data upload to populate your data descr fetch('https://aind-metadata-service/api/v2/funding/' + encodeURIComponent(projectName)) .then(response => { if (!response.ok) { - throw new Error('HTTP error! status: ' + response.status); + return response.text().then(text => { throw new Error(text || 'HTTP error! status: ' + response.status); }); } return response.json(); }) @@ -175,7 +175,7 @@ The investigators endpoint will be used during data upload to populate your data fetch('https://aind-metadata-service/api/v2/investigators/' + encodeURIComponent(projectName)) .then(response => { if (!response.ok) { - throw new Error('HTTP error! status: ' + response.status); + return response.text().then(text => { throw new Error(text || 'HTTP error! status: ' + response.status); }); } return response.json(); }) @@ -266,17 +266,19 @@ Subject metadata is populated by lab animal services (LAS) without your involvem fetch('https://aind-metadata-service/api/v2/subject/' + encodeURIComponent(subjectId)) .then(response => { - if (!response.ok) { - throw new Error('HTTP error! status: ' + response.status); + if (!response.ok && response.status !== 400) { + return response.text().then(text => { throw new Error(text || 'HTTP error! status: ' + response.status); }); } - return response.json(); + return response.json().then(data => ({ data, status: response.status })); }) - .then(response => { - const data = response.data || response; - resultDiv.style.backgroundColor = '#d4edda'; - resultDiv.style.border = '1px solid #28a745'; - resultDiv.innerHTML = 'Subject Information:
' + 
-                              JSON.stringify(data, null, 2) + '
'; + .then(({ data, status }) => { + const subject = data.data || data; + const isInvalid = status === 400; + resultDiv.style.backgroundColor = isInvalid ? '#fff3cd' : '#d4edda'; + resultDiv.style.border = isInvalid ? '1px solid #ffc107' : '1px solid #28a745'; + resultDiv.innerHTML = (isInvalid ? 'Warning: subject data failed schema validation:' : 'Subject Information:') + + '
' +
+                              JSON.stringify(subject, null, 2) + '
'; }) .catch(error => { resultDiv.style.backgroundColor = '#f8d7da'; @@ -395,7 +397,7 @@ Currently, only NSB procedures are automatically attached to data assets during ### Custom procedures -Custom [Procedures](https://aind-data-schema.readthedocs.io/en/latest/procedures.html) require you to generate a `procedures.json` file manually. Note that the `data-transfer-service` will **NOT** merge your procedures with any stored in NSB, you must pull the NSB procedures and manually merge them ahead of time, please reach out to Scientific Computing for help with this process. +Custom [Procedures](https://aind-data-schema.readthedocs.io/en/latest/procedures.html) require you to generate a `procedures.json` file manually. Please only provide metadata for procedures that are not stored by NSB. ### NSB procedures @@ -457,17 +459,19 @@ Standardized procedures that are performed by NSB (link?) are uploaded and acces fetch('https://aind-metadata-service/api/v2/procedures/' + encodeURIComponent(subjectId)) .then(response => { - if (!response.ok) { - throw new Error('HTTP error! status: ' + response.status); + if (!response.ok && response.status !== 400) { + return response.text().then(text => { throw new Error(text || 'HTTP error! status: ' + response.status); }); } - return response.json(); + return response.json().then(data => ({ data, status: response.status })); }) - .then(response => { - const data = response.data || response; - resultDiv.style.backgroundColor = '#d4edda'; - resultDiv.style.border = '1px solid #28a745'; - resultDiv.innerHTML = 'Procedures Information:
' + 
-                              JSON.stringify(data, null, 2) + '
'; + .then(({ data, status }) => { + const procedures = data.data || data; + const isInvalid = status === 400; + resultDiv.style.backgroundColor = isInvalid ? '#fff3cd' : '#d4edda'; + resultDiv.style.border = isInvalid ? '1px solid #ffc107' : '1px solid #28a745'; + resultDiv.innerHTML = (isInvalid ? 'Warning: procedures data failed schema validation:' : 'Procedures Information:') + + '
' +
+                              JSON.stringify(procedures, null, 2) + '
'; }) .catch(error => { resultDiv.style.backgroundColor = '#f8d7da'; From 6284b1e8974c877adde50089bed1e95ad81d4291 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Sat, 30 May 2026 15:59:55 -0700 Subject: [PATCH 2/2] feat: draft QC diagram --- docs/source/diagrams/mid_level/QC.drawio | 115 ++++++++++++++++++ docs/source/diagrams/mid_level/QC.drawio.svg | 4 + .../source/explore_analyze/quality_control.md | 6 +- 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 docs/source/diagrams/mid_level/QC.drawio create mode 100644 docs/source/diagrams/mid_level/QC.drawio.svg diff --git a/docs/source/diagrams/mid_level/QC.drawio b/docs/source/diagrams/mid_level/QC.drawio new file mode 100644 index 0000000..23c37df --- /dev/null +++ b/docs/source/diagrams/mid_level/QC.drawio @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/source/diagrams/mid_level/QC.drawio.svg b/docs/source/diagrams/mid_level/QC.drawio.svg new file mode 100644 index 0000000..0330332 --- /dev/null +++ b/docs/source/diagrams/mid_level/QC.drawio.svg @@ -0,0 +1,4 @@ + + + +
Metadata
(DocDB)
Data Assets
(S3)
Static Data Stores
Static QC Portal
(data.allenneuraldynamics.org/qc)
Microsoft Entra
Editable QC Portal
(qc.allenneuraldynamics.org/view)
v
QC metadata
v
Reference media
OAuth
Data Consumers
User QCMetric
updates
Processes that transform data
User review
submission
\ No newline at end of file diff --git a/docs/source/explore_analyze/quality_control.md b/docs/source/explore_analyze/quality_control.md index 06d6e94..87489c3 100644 --- a/docs/source/explore_analyze/quality_control.md +++ b/docs/source/explore_analyze/quality_control.md @@ -8,4 +8,8 @@ Please see the documentation on [QualityControl](https://aind-data-schema.readth ## QC Portal -Please see the [QC Portal](https://github.com/AllenNeuralDynamics/aind-qc-portal?tab=readme-ov-file) documentation for more information. \ No newline at end of file +![QC diagram](../diagrams/mid_level/QC.drawio.svg) + +The QC Portal is a web app that allows users to explore the quality control metadata for data assets and, in edit mode, modify the value and state of metrics to annotate assets as passing or failing QC. + +Please see the [QC Portal](https://github.com/AllenNeuralDynamics/aind-qc-portal?tab=readme-ov-file) documentation for more information.