refactor: restructure parse spectra response and improve logging#107
Merged
Conversation
Wrap `data` and `version` under `nmriumState`, and rename `errors` to `logs` to capture all log levels (info, warn, error, debug, ...etc) instead of errors only.
393643e to
1ca10bd
Compare
NishaSharma14
approved these changes
Feb 25, 2026
NishaSharma14
added a commit
that referenced
this pull request
Jul 15, 2026
* build: update CI/CD workflows and deployment scripts (#94) * build: update CI/CD workflows and deployment scripts * docker exec nmr-converter * fix: remove spaces from release-please workflow file * fix: update dev url in docker-compose-dev.yml * fix: update log file ownership and permissions in deployment script * feat: improve prediction (#93) * feat: improve prediction refactor: improve code refactor: improve nmr-cli chore: update package-lock.json * feat: expose molecular prediction powered by nmrdb.org and nmrshift engines feat: improve prediction with molfile refactor: improve prediction error message * feat(docker): add shared-data volume to nmr-converter service * fix: identation issue in dev-build.yml * chore: update nmr-cli package-lock.json (#97) * Fix playwright version in package.json Updated playwright dependency version to 1.56.1. * build: remove the cache from the build workflow * feat: exposed publication string endpoint with swagger docs updates (#99) * docs: improve OpenAPI descriptions, examples, and response codes Add detailed descriptions, request/response examples, and proper HTTP response codes across all routers. Add OpenAPI tag metadata and a rich API description to the FastAPI app configuration. * feat(spectra): add parse-publication-string endpoint Add POST /spectra/parse/publication-string endpoint that resurrects an NMR spectrum from an ACS-style publication string. The endpoint accepts the publication string as a plain text body and invokes the nmr-cli parse-publication-string command via Docker exec. Uses StreamingResponse with Content-Disposition attachment header to prevent Swagger UI from hanging on the large spectrum JSON response. Also improves OpenAPI docs for existing spectra endpoints. * fix: dpeloy script error * feat: peaks to nmrium endpoint (#100) * docs: improve OpenAPI descriptions, examples, and response codes Add detailed descriptions, request/response examples, and proper HTTP response codes across all routers. Add OpenAPI tag metadata and a rich API description to the FastAPI app configuration. * feat(spectra): add parse-publication-string endpoint Add POST /spectra/parse/publication-string endpoint that resurrects an NMR spectrum from an ACS-style publication string. The endpoint accepts the publication string as a plain text body and invokes the nmr-cli parse-publication-string command via Docker exec. Uses StreamingResponse with Content-Disposition attachment header to prevent Swagger UI from hanging on the large spectrum JSON response. Also improves OpenAPI docs for existing spectra endpoints. * feat(spectra): add peaks-to-nmrium endpoint and CLI command Add a new POST /spectra/parse/peaks endpoint that converts a list of NMR peaks (chemical shift, intensity, width) into a full NMRium-compatible spectrum object. The endpoint delegates to a new `peaks-to-nmrium` CLI command in nmr-cli which uses `peaksToXY` from nmr-processing to generate the simulated 1D spectrum data. * fix: remove app volume mount and add the caching for docker build * fix: stream serialization of large NMRium state objects (#101) * fix: stream serialization of large NMRium state objects refactor: include the meta and info object in case of serialize as dataSource * refactor: stream nmr-cli output as JSON response in parse-spectra endpoint * fix: improve error handling for spectra snapshot capture (#103) close #102 * feat: update nmr-cli to replace 'chromium' with 'firefox' for spectra image capture(#104) * chore(nmr-cli): update dependencies * feat(nmr-cli): update nmrium core dependencies * refactor(nmr-cli): replace 'chromium' with 'firefox' for spectra image capture * chore(nmr-cli): update playwright to version 1.58.2 * refactor(nmr-cli): capture errors using fiflogger (#106) * chore(nmr-cli): update dependencies * refactor(nmr-cli): capture errors using fiflogger * refactor: restructure parse spectra response and improve logging (#107) Wrap `data` and `version` under `nmriumState`, and rename `errors` to `logs` to capture all log levels (info, warn, error, debug, ...etc) instead of errors only. * feat: add from/to spectrum range options to peaks-to-nmrium endpoint * feat(nmr-cli): update NMRium core packages (#109) * chore(nmr-cli): update dependencies * feat(nmr-cli): update nmrium core packages --------- Co-authored-by: Nisha Sharma <sharmanis14@gmail.com> Co-authored-by: hamed-musallam <35760236+hamed-musallam@users.noreply.github.com> Co-authored-by: hamed musallam <hamed.musallam@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We did further modifications to the response object structure for the parse-spectra API.
Currently, the response includes an errors field which, as the name suggests, only captures error-level messages. However, the goal is to extend this to capture all log levels, including info, warn, error, debug, etc., so that API users have full visibility into what happened during the parsing process, not just when something went wrong.
To achieve this, we need to:
errorstologsdataandversioninside annmriumStateobjectUpdated Response Structure:
{ "nmriumState": { "data": {}, "version": <version number> }, "images": {}, "logs": [] }