spectral-peak-data-validation-and-parsing
Summary
Parse and validate NMR spectral peak data (chemical shift values, multiplicities, integration) extracted from jcamp/RAW/mzML files into a normalized form suitable for external prediction APIs. This skill ensures data integrity before downstream query construction and inference.
When to use
When you have received POST requests containing peaks data as form parameters (chemical shift, multiplicity, integration values) and need to accept, validate, and normalize those values before formatting them into a query compatible with an external NMR prediction service such as nmrshiftdb.
When NOT to use
- Peak data is already validated and formatted into an nmrshiftdb API query—skip directly to HTTP submission.
- Input is raw spectral image or binary spectrum data (jcamp/RAW/mzML file)—use spectral file conversion and peak extraction first.
- Peaks have already been matched against a reference database—this skill is for upstream validation, not post-prediction processing.
Inputs
- POST request with form parameters containing NMR peak data
- Chemical shift values (float, ppm)
- Multiplicity labels (string: singlet, doublet, triplet, etc.)
- Integration values (float, relative intensity)
Outputs
- Validated and normalized peak data structure (JSON or dict)
- Validation error report (if data fails checks)
- Formatted query ready for nmrshiftdb API submission
How to apply
Receive the peaks data payload at the endpoint (e.g., /predict/by_peaks_form or /api/v1/chemspectra/predict/nmr_peaks_form). Parse the form parameters to extract chemical shift values, multiplicities (e.g., singlet, doublet), and integration values. Validate each field: check that chemical shift values are within expected NMR range (typically 0–12 ppm for ¹H NMR), that multiplicities match known types, and that integration values are positive and reasonable. Reject or flag malformed entries and return detailed error messages. Once validated, normalize the parsed data into a structured format (typically JSON or dictionary) ready for formatting into the external API query. This validation step prevents downstream failures and ensures the prediction request is well-formed.
Related tools
Examples
curl -X POST http://localhost:3007/api/v1/chemspectra/predict/nmr_peaks_form -d 'shift=7.3&multiplicity=doublet&integration=2.0&shift=3.5&multiplicity=singlet&integration=3.0'
Evaluation signals
- All required form parameters (chemical shift, multiplicity, integration) are present and parsed without exceptions.
- Chemical shift values fall within expected NMR range (0–12 ppm for ¹H); out-of-range values are flagged.
- Multiplicity labels match known NMR coupling patterns (singlet, doublet, triplet, etc.); unknown labels are rejected.
- Integration values are positive, non-zero, and have consistent scale across the peak list.
- Normalized output structure matches the schema expected by the nmrshiftdb HTTP API (verified by successful downstream submission).
Limitations
- Validation scope is limited to structural and range checks; does not verify chemical plausibility (e.g., whether a peak multiplicity is physically consistent with molecular structure).
- No handling of overlapping peaks or peak clusters—assumes each peak is discrete and independently reported.
- Integration normalization assumes form parameters use a consistent scale; mixed or undeclared scales may cause silent errors.
- No version management or schema evolution for nmrshiftdb API changes—validation rules must be manually updated if external API format changes.
Evidence
- [other] Parse and validate the peaks data (chemical shift values, multiplicities, integration).: "Parse and validate the peaks data (chemical shift values, multiplicities, integration)."
- [other] Receive POST request at endpoint /predict/by_peaks_form or /api/v1/chemspectra/predict/nmr_peaks_form with peaks data as form parameters.: "Receive POST request at endpoint /predict/by_peaks_form or /api/v1/chemspectra/predict/nmr_peaks_form with peaks data as form parameters."
- [readme] This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files.: "This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files."
- [other] Format the peaks data into a query compatible with nmrshiftdb HTTP API.: "Format the peaks data into a query compatible with nmrshiftdb HTTP API."
1---2name: spectral-peak-data-validation-and-parsing3description: Use when when you have received POST requests containing peaks data as form parameters (chemical shift, multiplicity, integration values) and need to accept, validate, and normalize those values before formatting them into a query compatible with an external NMR prediction service such as.4license: CC-BY-4.05---67# spectral-peak-data-validation-and-parsing89## Summary1011Parse and validate NMR spectral peak data (chemical shift values, multiplicities, integration) extracted from jcamp/RAW/mzML files into a normalized form suitable for external prediction APIs. This skill ensures data integrity before downstream query construction and inference.1213## When to use1415When you have received POST requests containing peaks data as form parameters (chemical shift, multiplicity, integration values) and need to accept, validate, and normalize those values before formatting them into a query compatible with an external NMR prediction service such as nmrshiftdb.1617## When NOT to use1819- Peak data is already validated and formatted into an nmrshiftdb API query—skip directly to HTTP submission.20- Input is raw spectral image or binary spectrum data (jcamp/RAW/mzML file)—use spectral file conversion and peak extraction first.21- Peaks have already been matched against a reference database—this skill is for upstream validation, not post-prediction processing.2223## Inputs2425- POST request with form parameters containing NMR peak data26- Chemical shift values (float, ppm)27- Multiplicity labels (string: singlet, doublet, triplet, etc.)28- Integration values (float, relative intensity)2930## Outputs3132- Validated and normalized peak data structure (JSON or dict)33- Validation error report (if data fails checks)34- Formatted query ready for nmrshiftdb API submission3536## How to apply3738Receive the peaks data payload at the endpoint (e.g., /predict/by_peaks_form or /api/v1/chemspectra/predict/nmr_peaks_form). Parse the form parameters to extract chemical shift values, multiplicities (e.g., singlet, doublet), and integration values. Validate each field: check that chemical shift values are within expected NMR range (typically 0–12 ppm for ¹H NMR), that multiplicities match known types, and that integration values are positive and reasonable. Reject or flag malformed entries and return detailed error messages. Once validated, normalize the parsed data into a structured format (typically JSON or dictionary) ready for formatting into the external API query. This validation step prevents downstream failures and ensures the prediction request is well-formed.3940## Related tools4142- **Flask** (Web framework for receiving and handling POST requests at /predict/by_peaks_form endpoint) — https://github.com/ComPlat/chem-spectra-app43- **Python 3** (Language for implementing parse, validate, and normalize logic) — https://github.com/ComPlat/chem-spectra-app44- **gunicorn** (WSGI application server for deploying Flask application at production scale) — https://github.com/ComPlat/chem-spectra-app45- **nmrshiftdb** (External HTTP API that receives formatted peak query and returns matching NMR signals)4647## Examples4849```50curl -X POST http://localhost:3007/api/v1/chemspectra/predict/nmr_peaks_form -d 'shift=7.3&multiplicity=doublet&integration=2.0&shift=3.5&multiplicity=singlet&integration=3.0'51```5253## Evaluation signals5455- All required form parameters (chemical shift, multiplicity, integration) are present and parsed without exceptions.56- Chemical shift values fall within expected NMR range (0–12 ppm for ¹H); out-of-range values are flagged.57- Multiplicity labels match known NMR coupling patterns (singlet, doublet, triplet, etc.); unknown labels are rejected.58- Integration values are positive, non-zero, and have consistent scale across the peak list.59- Normalized output structure matches the schema expected by the nmrshiftdb HTTP API (verified by successful downstream submission).6061## Limitations6263- Validation scope is limited to structural and range checks; does not verify chemical plausibility (e.g., whether a peak multiplicity is physically consistent with molecular structure).64- No handling of overlapping peaks or peak clusters—assumes each peak is discrete and independently reported.65- Integration normalization assumes form parameters use a consistent scale; mixed or undeclared scales may cause silent errors.66- No version management or schema evolution for nmrshiftdb API changes—validation rules must be manually updated if external API format changes.6768## Evidence6970- [other] Parse and validate the peaks data (chemical shift values, multiplicities, integration).: "Parse and validate the peaks data (chemical shift values, multiplicities, integration)."71- [other] Receive POST request at endpoint /predict/by_peaks_form or /api/v1/chemspectra/predict/nmr_peaks_form with peaks data as form parameters.: "Receive POST request at endpoint /predict/by_peaks_form or /api/v1/chemspectra/predict/nmr_peaks_form with peaks data as form parameters."72- [readme] This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files.: "This backend web service provides NMR/IR/MS processing for jcamp/RAW/mzML files."73- [other] Format the peaks data into a query compatible with nmrshiftdb HTTP API.: "Format the peaks data into a query compatible with nmrshiftdb HTTP API."