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

Update client to use API with mongo functionalities #26

Open
dirodriguezm opened this issue Dec 5, 2022 · 2 comments · May be fixed by #32
Open

Update client to use API with mongo functionalities #26

dirodriguezm opened this issue Dec 5, 2022 · 2 comments · May be fixed by #32
Assignees
Labels
enhancement New feature or request

Comments

@dirodriguezm
Copy link
Contributor

The client must be able to use the new mongo support on the API. An interface should be drafted and proposed to the team.

Interface proposals

1

from alerce.core import Alerce
alerce = Alerce()

query = Alerce.mongoquery(collection='detections')
query =  query.find({'oid' : 'ZTF1'})
query = query.sort('mjd')
query = query.limit(10)

detections = query.execute()

for detection in detections:
    print(detection)
@ASHuenchuleo
Copy link
Contributor

ASHuenchuleo commented Jan 5, 2023

For the interface, I think it's a good idea to just use the same JSON you would use for a curl request for simplicity:

from alerce.core import Alerce
alerce = Alerce()

query = {
"collection": "detections",
"filter": {
"oid": "ZTF1"
},
"sort": { "mjd": 1 },
"limit": 10
}
detections = Alerce.mongo_find(query, pandas=True)

@ASHuenchuleo
Copy link
Contributor

ASHuenchuleo commented Jan 10, 2023

The client must be able to send queries to this API following these steps

  • Add new superclass for ALeRCE client for MongoDB requests
  • Add code for parsing the API response
  • Implement the following verbs
    • find
    • findOne
    • Aggregate
  • Add the option to increase timeout for db gateways
  • Add extra functionalities
    • Count

Should we validate the input in every verb or just let the program fail?

@ASHuenchuleo ASHuenchuleo linked a pull request Jan 26, 2023 that will close this issue
@ASHuenchuleo ASHuenchuleo linked a pull request Jan 26, 2023 that will close this issue
@ASHuenchuleo ASHuenchuleo added the enhancement New feature or request label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants