Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

feat(model-ad): connect the API server to the MongoDB server #2718

Closed tschaffter closed 1 week ago

tschaffter commented 1 week ago

Changelog

Note

The conversion of Documents to DTOs and vice versa is done using the monorepo shared library shared-java-util. This demonstrates the re-usability of Java code across projects in the monorepo.

Preview

Build MODEL-AD images

model-ad-build-images

or just the images needed to test this PR:

nx run-many -t build-image -p model-ad-api model-ad-mongo

Start the API server and MongoDB with Docker Compose

nx serve-detach model-ad-api

Visualize the collection gene with the MongoDB extension for VS Code

Profile:

image

List genes

Using Swagger UI, a browser or the file apps/model-ad/api/requests.http:

GET http://localhost:8080/v1/genes

HTTP/1.1 200 
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 20 Jun 2024 16:57:40 GMT
Connection: close

{
  "number": 0,
  "size": 2,
  "totalElements": 0,
  "totalPages": 1,
  "hasNext": false,
  "hasPrevious": false,
  "genes": [
    {
      "id": "66737b304e11611be5dab31c",
      "name": "BRCA1",
      "description": "BRCA1 Gene: A Key Player in Breast Cancer Susceptibility"
    },
    {
      "id": "66737b304e11611be5dab31d",
      "name": "TP53",
      "description": "TP53 Gene: Guardian of the Genome and Its Role in Cancer Prevention"
    }
  ]
}
tschaffter commented 1 week ago

Looks great! I was able to connect to Mongo via the VS Code Extension (after updating apps/model-ad/mongo/.env)

That's a good point: I should document the config files that need to be updated.