agentsclimarketplace

Converter output schema design

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/converter-output-schema-design

Use when when integrating multiple heterogeneous metadata services (e.g., CIR, CTS, PubChem, IDSM, BridgeDb) that return unstructured or variably-formatted responses, and you need to enforce uniform output contracts before committing fetched values to mass spectra files (.msp format).From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill converter-output-schema-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 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 file declares

Copied from the file, not written here

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

9.8 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it

converter-output-schema-design

Summary

Design and implement a structured schema that defines the output format and validation rules for metadata converters in annotation pipelines. This skill ensures consistent, validated data structure across heterogeneous external service responses before metadata is written to spectra files.

When to use

When integrating multiple heterogeneous metadata services (e.g., CIR, CTS, PubChem, IDSM, BridgeDb) that return unstructured or variably-formatted responses, and you need to enforce uniform output contracts before committing fetched values to mass spectra files (.msp format).

When NOT to use

  • Input is a single, pre-validated, homogeneous data source (schema design is overkill; direct write is sufficient).
  • You do not intend to write metadata back to spectra files (schema enforcement is unnecessary if data is only for inspection).
  • All converters already guarantee format compliance and your pipeline has no requirement for traceability or rejection of malformed data.

Inputs

  • converter output dictionary (raw response from external service)
  • converter service specification (e.g., CIR, CTS, PubChem API documentation)
  • input .msp file with compound names and partial metadata

Outputs

  • validated metadata dictionary with pass/fail status per attribute
  • structured validation report file (logs attribute name, fetched value, validation rule, pass/fail, service source)
  • annotated .msp file with only validated metadata written back to spectra

How to apply

First, identify all metadata attribute types that converters will produce (e.g., SMILES, InChI, CAS number, formula, InChIKey, IUPAC name) and their service-specific specifications. Design a schema document that defines acceptance criteria for each attribute—such as SMILES format validation, InChI prefix requirements (InChI=1S/), CAS number format rules, and presence/absence constraints. Implement this schema as a Validator class that intercepts converter output dictionaries and applies attribute-specific validation rules before metadata is committed to the spectra object. Integrate the Validator into the conversion pipeline between converter response parsing and spectra write operations, using the existing Job and Converter architecture. Log all validation results (attribute name, fetched value, validation rule applied, pass/fail status, service source) to a structured validation report file for traceability and debugging.

Related tools

Examples

from MSMetaEnhancer.libs.converters import Validator; validator = Validator(schema={'inchi': {'prefix': 'InChI=1S/'}, 'smiles': {'regex': r'^[A-Za-z0-9@H()\[\]\-=#\\/]+$'}, 'cas_number': {'regex': r'^\d{1,7}-\d{2}-\d$'}}); result = validator.validate({'inchi': 'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H', 'smiles': 'c1ccccc1', 'cas_number': '71-43-2'}); print(result['status'], result['log'])

Evaluation signals

  • Validation schema correctly accepts well-formed SMILES (linear/branched structures), InChI (prefix InChI=1S/), CAS numbers (digits and hyphens), and rejects malformed variants of each.
  • Validator rejects converter outputs missing required fields or containing null/empty values where presence is mandated by schema.
  • Structured validation report logs 100% of converter outputs with attribute name, fetched value, rule applied, pass/fail status, and service source; every entry is traceable.
  • Unit tests using pytest verify that each attribute type (SMILES, InChI, CAS, formula, InChIKey, IUPAC name) passes when correctly formatted and fails when malformed.
  • End-to-end test with sample .msp file confirms only validated metadata reaches output .msp file and invalid entries are excluded, with validation logs capturing all decisions.

Limitations

  • Schema must be maintained and updated whenever converter service APIs change their response formats or add new attributes, requiring manual intervention.
  • Validation rules are service-specification-dependent and may conflict (e.g., different canonicalization rules for SMILES across CIR, CTS, and PubChem); schema may need per-service overrides.
  • Validation does not guarantee semantic correctness (e.g., a well-formed SMILES string may still represent the wrong chemical structure); only syntactic/format compliance is checked.
  • Rate limiting and API errors from external services are handled separately in converter code and are not the responsibility of schema validation; schema only validates successfully-fetched data.

Evidence

  • [other] Design a validation schema defining acceptance criteria for each metadata attribute type (e.g., SMILES format, InChI prefix, CAS number format) based on service specifications.: "Design a validation schema defining acceptance criteria for each metadata attribute type (e.g., SMILES format, InChI prefix, CAS number format) based on service specifications."
  • [other] Implement a Validator class that intercepts converter output dictionaries and applies attribute-specific validation rules before metadata is committed to the spectra object.: "Implement a Validator class that intercepts converter output dictionaries and applies attribute-specific validation rules before metadata is committed to the spectra object."
  • [other] Integrate the Validator into the conversion pipeline (between converter response parsing and spectra write) using the existing Job and Converter architecture.: "Integrate the Validator into the conversion pipeline (between converter response parsing and spectra write) using the existing Job and Converter architecture."
  • [other] Log all validation results (attribute name, fetched value, validation rule applied, pass/fail status, service source) to a structured validation report file.: "Log all validation results (attribute name, fetched value, validation rule applied, pass/fail status, service source) to a structured validation report file."
  • [other] MSMetaEnhancer implements attribute validation tracked in logs to check fetched annotation values before they are written back to spectra, ensuring data quality during the metadata enrichment process.: "MSMetaEnhancer implements attribute validation tracked in logs to check fetched annotation values before they are written back to spectra, ensuring data quality during the metadata enrichment process."
  • [readme] It adds metadata like SMILES, InChI, and CAS number fetched from the following services: [CIR], [CTS], [PubChem], [IDSM], and [BridgeDb].: "It adds metadata like SMILES, InChI, and CAS number fetched from the following services: [CIR], [CTS], [PubChem], [IDSM], and [BridgeDb]."
  • [other] Add unit tests using pytest that verify validation accepts correct formats and rejects malformed data for each supported attribute type.: "Add unit tests using pytest that verify validation accepts correct formats and rejects malformed data for each supported attribute type."

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.