Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡ limit variant locations in variants detail page #37

Open
3 tasks
bunop opened this issue Jan 10, 2023 · 1 comment
Open
3 tasks

⚡ limit variant locations in variants detail page #37

bunop opened this issue Jan 10, 2023 · 1 comment
Labels
enhancement New feature or request performance Improve the performance or better resource management
Milestone

Comments

@bunop
Copy link
Member

bunop commented Jan 10, 2023

display only smarter coordinates in variant detail endpoint. This could be done by creating a new collection with only the information I need. This collection will be served by the endpoint.

  • Create variant collections with only SMARTER coordinates
  • Replace the collection used by the variant endpoints
  • Test if there are improvement in speed or in fetching data
@bunop bunop added enhancement New feature or request performance Improve the performance or better resource management labels Jan 10, 2023
@bunop bunop added this to the Backend v2 milestone Jan 10, 2023
@bunop bunop added this to SMARTER Aug 3, 2023
@bunop bunop moved this to To do in SMARTER Aug 3, 2023
@bunop
Copy link
Member Author

bunop commented Aug 9, 2024

this query can create a new collection with only the supported coordinates:

db.variantSheep.aggregate([
  { $unwind: "$locations" },
  {
    $match: {
      $or: [
        { "locations.version": "Oar_v4.0", "locations.imported_from": "SNPchiMp v.3" },
        { "locations.version": "Oar_v3.1", "locations.imported_from": "SNPchiMp v.3" }
      ]
    }
  },
  {
    $group: {
      _id: "$_id",
      chip_name: { $first: "$chip_name" },
      name: { $first: "$name" },
      sequence: { $first: "$sequence" },
      illumina_top: { $first: "$illumina_top" },
      sender: { $first: "$sender" },
      rs_id: { $first: "$rs_id" },
      locations: { $push: "$locations" },
      all_fields: { $mergeObjects: "$$ROOT" }
    }
  },
  {
    $replaceRoot: {
      newRoot: {
        $mergeObjects: [
          { $arrayToObject: { $objectToArray: "$all_fields" } },
          { locations: "$locations" }
        ]
      }
    }
  },
  { $limit: 2 }
], { allowDiskUse: true }).pretty()

Need to check if the fields non in the $group statement are preserved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Improve the performance or better resource management
Projects
Status: To do
Development

No branches or pull requests

1 participant