File api endpoint implementation
Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder
npx -y skills add HolobiomicsLab/asb-skill-collections --skill file-api-endpoint-implementationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when when you need to construct a POST endpoint that ingests raw spectral data files from multiple vendor formats (jcamp, RAW, mzML) and must standardize them for downstream processing.
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
7.4 KB, as published. Nobody here has run it
file-api-endpoint-implementation
Summary
Implement a file conversion REST API endpoint that accepts spectral files in jcamp, RAW, or mzML formats, validates and converts them to a standardized internal representation, and returns the converted output in jcamp format with extracted metadata and peak tables. This skill is essential for building backend web services that integrate vendor-specific spectral data from NMR, IR, and MS instruments.
When to use
When you need to construct a POST endpoint that ingests raw spectral data files from multiple vendor formats (jcamp, RAW, mzML) and must standardize them for downstream processing. Specifically, when vendor-specific binary formats (RAW) require format-agnostic parsing via third-party conversion services, and the output must preserve metadata and peak information in a single canonical format.
When NOT to use
- Input is already in standardized jcamp format and requires no conversion or metadata extraction.
- Endpoint is for non-spectral file types (images, documents, genomic sequences) — this skill is specific to NMR/IR/MS spectral processing.
- Real-time streaming of spectral data is required; this endpoint assumes discrete file uploads and batch conversion.
Inputs
- HTTP POST request body containing file upload (jcamp, RAW, or mzML format)
- Spectral file (binary or text): jcamp, RAW (vendor-specific), mzML (XML-based MS format)
Outputs
- HTTP response: converted spectral file in jcamp format
- jcamp file with extracted metadata and peak tables
- Serialized internal spectral representation with metadata
How to apply
Design a Flask POST endpoint at /api/v1/chemspectra/file/convert that receives an uploaded spectral file. Parse and validate the input file format, routing binary RAW files through a Docker containerized proteowizard/pwiz-skyline msconvert service to handle vendor-specific formats. Extract spectral parameters and metadata during conversion. Serialize the standardized representation to jcamp output format, ensuring peak tables and metadata annotations are preserved. Return the converted artifact to the client as the HTTP response body. The rationale is that vendor-specific formats require specialized parsers (msconvert), but normalizing to jcamp provides a single contract for downstream consumers (peak picking, annotation, visualization).
Related tools
- Flask (Web framework for implementing the REST API endpoint and HTTP request/response handling)
- proteowizard/pwiz-skyline (Docker-containerized format converter for parsing and converting vendor-specific RAW spectral files to standardized formats) — https://github.com/ComPlat/chem-spectra-app
- Docker (Container runtime for isolating and executing the msconvert_docker service without vendor library dependencies on the host)
- Python 3 (Language for implementing endpoint logic, file parsing, serialization, and Docker orchestration)
- gunicorn (WSGI server for deploying the Flask endpoint in production with multiple worker processes)
Examples
curl -X POST -F '[email protected]' http://localhost:3007/api/v1/chemspectra/file/convert -o output.jcamp
Evaluation signals
- Successfully parse and validate input file format before conversion (jcamp/RAW/mzML format detection).
- Verify HTTP 200 response and presence of jcamp-formatted output file with metadata fields (e.g., title, sample, solvent, frequency).
- Confirm that peak tables are preserved in converted output — compare peak count and intensity ranges between input and output.
- Test error handling: return appropriate HTTP error codes (400 Bad Request) for unsupported formats or malformed files.
- Validate that metadata extracted from vendor-specific formats (e.g., acquisition date, instrument model from RAW files) appears in jcamp output headers.
Limitations
- RAW file conversion depends on proteowizard/pwiz-skyline Docker image availability and vendor library licensing; vendor formats may not be fully supported.
- mzML parsing may lose instrument-specific metadata not encoded in the XML schema; lossless round-trip conversion is not guaranteed.
- Endpoint performance scales with file size and conversion complexity; large binary RAW files may incur latency due to Docker container startup and format conversion overhead.
- No changelog available in the repository; version stability and backward compatibility of the jcamp output format are not formally documented.
Evidence
- [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] Receive HTTP POST request containing an uploaded spectral file (jcamp, RAW, or mzML format) at the /api/v1/chemspectra/file/convert endpoint.: "Receive HTTP POST request containing an uploaded spectral file (jcamp, RAW, or mzML format) at the /api/v1/chemspectra/file/convert endpoint."
- [other] Parse and validate the input file format using proteowizard/pwiz-skyline via the Docker msconvert_docker service to handle vendor-specific RAW formats.: "Parse and validate the input file format using proteowizard/pwiz-skyline via the Docker msconvert_docker service to handle vendor-specific RAW formats."
- [other] Convert the spectral file to a standardized internal representation, extracting metadata and spectral parameters.: "Convert the spectral file to a standardized internal representation, extracting metadata and spectral parameters."
- [other] Serialize the converted file to jcamp output format with peak tables and metadata.: "Serialize the converted file to jcamp output format with peak tables and metadata."
- [other] docker pull proteowizard/pwiz-skyline-i-agree-to-the-vendor-licenses: "docker pull proteowizard/pwiz-skyline-i-agree-to-the-vendor-licenses"