Skip to content

Conversation

Copy link

Copilot AI commented Sep 26, 2025

This PR addresses issue #XX by adding detailed step-by-step instructions to the contributing documentation on how to add new services and conversion functions to MSMetaEnhancer.

What's Changed

The CONTRIBUTING.md file has been significantly enhanced with comprehensive guidance for developers who want to extend MSMetaEnhancer with new conversion services. The documentation now includes:

🏗️ Architecture Overview

  • Explanation of the modular converter system
  • Overview of base classes (Converter, WebConverter, ComputeConverter)
  • Description of the Job system and dynamic method creation
  • How the ConverterBuilder works

🌐 Web Converter Development

Complete guide for adding external API services with:

  • Step-by-step implementation instructions
  • Full code examples and templates
  • Registration process in __init__.py
  • Error handling and rate limiting patterns
  • Testing guidelines with mock examples

Example structure for a new web service:

class MyService(WebConverter):
    def __init__(self, session):
        super().__init__(session)
        self.endpoints = {'MyService': 'https://api.example.com/v1/'}
        
        conversions = [
            ('compound_name', 'inchi', 'from_name'),
            ('inchi', 'smiles', 'from_inchi'),
        ]
        self.create_top_level_conversion_methods(conversions)

💻 Compute Converter Development

Instructions for local computation services including:

  • Implementation patterns for offline calculations
  • Registration in the compute converters module
  • Synchronous method creation patterns
  • Testing approaches for computational methods

🔧 Extending Existing Services

Guidelines for adding new conversion functions to existing converters, including method naming conventions and registration patterns.

📋 Best Practices

Coverage of key development principles:

  • Error handling and graceful failures
  • Rate limiting with the Throttler class
  • Response parsing and data validation
  • Testing strategies and mock patterns
  • Common utilities and decorators

Why This Matters

The modular architecture of MSMetaEnhancer makes it relatively straightforward to add new services, but until now there was no documentation explaining how to do it. This enhancement:

  • Removes barriers for new contributors
  • Ensures consistency across service implementations
  • Provides working code examples that can be copied and adapted
  • References existing converters (CTS, PubChem, IDSM, RDKit) as examples
  • Establishes best practices for testing and error handling

Validation

All changes have been validated by:

  • Testing existing functionality remains intact
  • Verifying the architectural patterns described match the actual codebase
  • Creating and running example converters to validate the instructions
  • Ensuring all existing tests continue to pass

The documentation is based on analysis of the existing converters and follows the established patterns used by services like CTS, PubChem, IDSM, and RDKit.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add information on how to add a new service to the contributing documentation</issue_title>
<issue_description>The modular architecture with the different services and jobs makes it fairly easy to add a new service and conversion. The contributing documentation should be updated to provide step-by-step instructions on how to add a new service to MSMetaEnhancer as well as how to implement new conversion functions for the existing services.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #166

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Add information on how to add a new service to the contributing documentation Add comprehensive documentation for adding new services to MSMetaEnhancer Sep 26, 2025
Copilot AI requested a review from hechth September 26, 2025 15:26
Copilot finished work on behalf of hechth September 26, 2025 15:26
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.

Add information on how to add a new service to the contributing documentation

2 participants