Skip to content

Add Connector API for External Projects Data#8

Merged
hakimalem merged 10 commits intodevelopmentfrom
feature/projects
Apr 3, 2025
Merged

Add Connector API for External Projects Data#8
hakimalem merged 10 commits intodevelopmentfrom
feature/projects

Conversation

@hakimalem
Copy link
Member

@hakimalem hakimalem commented Mar 5, 2025

Add Connector API for External Projects Data

Guide to Adding a New Connector

Step 1: Create the Connector Class

  • Create a new file in lib/ontologies_linked_data/concerns/connectors/ named after your data source (e.g., new_source_connector.rb).
  • This class must extend the BaseConnector class.
  • Implement the following required methods:
    • build_url: Constructs the appropriate URL for API calls.
    • build_params: Builds query parameters (like ID and acronym searches).
    • map_response: Maps API responses to a standardized format (Project model attributes).
    • Additional helper methods can be added for handling keywords, organization information, and funder details.

Step 2: Add Configuration Settings

  • Add your connector configuration to the application settings in lib/ontologies_linked_data/config/config.rb.
  • Include:
    • base_url: Main API URL.
    • source: Source identifier.
    • project_type: Type of project (e.g., "FundedProject").
    • field_mappings: Maps external API fields to internal model attributes (e.g., acronym, name, description).
    • funder: Configuration for the funding organization (e.g., name, homepage).

Usage Examples

ANR Projects

GET /connector/projects?source=ANR_AAPG&acronym=onewater

CORDIS Projects

GET /connector/projects?source=CORDIS&id=660362

Response example :

 {
        "acronym": "M2P",
        "type": "FundedProject",
        "name": "Instituts de recherche technologique",
        "description": "AIRT : Instituts de recherche technologique",
        "ontologyUsed": [],
        "created": "2025-03-07T13:19:34.471+00:00",
        "updated": "2025-03-07T13:19:34.471+00:00",
        "keywords": null,
        "contact": null,
        "institution": null,
        "grant_number": "10-AIRT-0004",
        "start_date": "2013-06-17T00:00:00.000+00:00",
        "end_date": "2029-06-30T00:00:00.000+00:00",
        "funder": {
            "id": "http://localhost:9393/Agents/bc597450-dd84-013d-aa75-0242ac160007",
            "agentType": "organization",
            "name": "Agence Nationale de la Recherche",
            "homepage": "https://anr.fr",
            "@id": "http://localhost:9393/Agents/bc597450-dd84-013d-aa75-0242ac160007",
            "@type": "http://xmlns.com/foaf/0.1/Agent",
            "@context": {
                "@vocab": "http://data.bioontology.org/metadata/",
                "agentType": "http://data.bioontology.org/metadata/agentType",
                "name": "http://xmlns.com/foaf/0.1/name",
                "homepage": "http://xmlns.com/foaf/0.1/homepage",
                "@language": "en"
            }
        },
        "coordinator": null,
        "logo": null,
        "@id": "http://localhost:9393/projects/M2P",
        "@type": "http://data.bioontology.org/metadata/Project",
        "@context": {
            "@vocab": "http://data.bioontology.org/metadata/",
            "acronym": "http://data.bioontology.org/metadata/acronym",
            "created": "http://data.bioontology.org/metadata/created",
            "updated": "http://data.bioontology.org/metadata/updated",
            "type": "http://data.bioontology.org/metadata/type",
            "name": "http://data.bioontology.org/metadata/name",
            "description": "http://data.bioontology.org/metadata/description",
            "ontologyUsed": {
                "@id": "http://data.bioontology.org/metadata/Ontology",
                "@type": "@id"
            },
            "keywords": "http://data.bioontology.org/metadata/keywords",
            "contact": "http://data.bioontology.org/metadata/contact",
            "institution": "http://data.bioontology.org/metadata/institution",
            "coordinator": "http://data.bioontology.org/metadata/coordinator",
            "logo": "http://data.bioontology.org/metadata/logo",
            "grant_number": "http://data.bioontology.org/metadata/grant_number",
            "start_date": "http://data.bioontology.org/metadata/start_date",
            "end_date": "http://data.bioontology.org/metadata/end_date",
            "funder": "http://data.bioontology.org/metadata/funder",
            "@language": "en"
        }
    },

Copy link
Collaborator

@syphax-bouazzouni syphax-bouazzouni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You branch does include 47 files changes, including other changes not related to projects feature, you need to extract only your changes first before I can review this.

@syphax-bouazzouni
Copy link
Collaborator

syphax-bouazzouni commented Mar 5, 2025

Other remarks:

@hakimalem hakimalem changed the title Feature/projects Add Connector API for External Projects Data Mar 7, 2025
@hakimalem hakimalem merged commit a3a2ebd into development Apr 3, 2025
4 checks passed
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