Skip to content

refactor: restructure parse spectra response and improve logging#107

Merged
NishaSharma14 merged 1 commit into
developmentfrom
improve-parse-spectra-logs
Feb 25, 2026
Merged

refactor: restructure parse spectra response and improve logging#107
NishaSharma14 merged 1 commit into
developmentfrom
improve-parse-spectra-logs

Conversation

@hamed-musallam

Copy link
Copy Markdown
Collaborator

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:

  1. Rename errors to logs
  2. Wrap data and version inside an nmriumState object

Updated Response Structure:

{
  "nmriumState": {
    "data": {},
    "version": <version number>
  },
  "images": {},
  "logs": []
}

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.
@hamed-musallam hamed-musallam force-pushed the improve-parse-spectra-logs branch 2 times, most recently from 393643e to 1ca10bd Compare February 25, 2026 10:07
@NishaSharma14 NishaSharma14 merged commit 324dd83 into development Feb 25, 2026
2 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants