dgidb / dgidb-v5

Providing interactions between drugs and genes sourced from a variety of publications and knowledgebases
https://dgidb.org
MIT License
14 stars 2 forks source link

Add support for GA4GH service info query #482

Closed acoffman closed 6 months ago

acoffman commented 6 months ago

This adds an initializer in config/initializers that will run at boot. It expects to find a data_version.yml at the root dir of the application. That file should contain a key version containing the current data version.

This will be loaded into a constant.

When generating a new data release, you will need to remember to update this value (so, if there are docs for the process somewhere, may be good to add this step to them). Its manual for now, but as we automate the data generation process, we should automate this too.

Additionally, I have added a top level serviceInfo query to the API containing all the fields needed for the GA4GH Service discovery spec. Though the query obviously looks different given it is GraphQL rather than REST, the response should be compliant with their schema.

updated_at and version information for this is pulled live from GitHub. (dataVersion is still handled as described above)

The query

{
  serviceInfo {
    id
    name
    type {
      group
      artifact
      version
    }
    description
    organization {
      name
      url
    }
    contactUrl
    documentationUrl
    createdAt
    updatedAt
    environment
    version
    dataVersion
  }
}

Will yield

{
  "data": {
    "serviceInfo": {
      "id": "org.dgidb.graphql",
      "name": "DGIdb",
      "type": {
        "group": "org.dgidb",
        "artifact": "DGIdb GraphQL",
        "version": "v.5.0.4"
      },
      "description": "An open-source search engine for drug-gene interactions and the druggable genome.",
      "organization": {
        "name": "Wagner and Griffith laboratories",
        "url": "https://dgidb.org/about#contact"
      },
      "contactUrl": "mailto:help@dgidb.org",
      "documentationUrl": "https://dgidb.org/api/graphiql",
      "createdAt": "2023-10-20T08:51:00-05:00",
      "updatedAt": "2024-01-30T18:04:04+00:00",
      "environment": "development",
      "version": "v.5.0.4",
      "dataVersion": "Dec-2023"
    }
  }
}

closes #481