-
Notifications
You must be signed in to change notification settings - Fork 48
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
WIP: Initial models for Mongoengine (ME) classes #78
Conversation
This pull request introduces 2 alerts when merging 13c23f5 into 03177f2 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Excited to see where this goes. Should we schedule a hackathon soon to get this in?
|
||
def create_hash(self): | ||
""" TODO: create a special hash before saving""" | ||
return '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to get the full JSON document here? Should simple to do so if so.
Also should we call this Molecule
as there is a Molecule
class in interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a to_json() method. We always want to work with the class itself unless we will send it over the REST API.
For the molecule naming, I think there should be no issue in the future. Portal won't shouldn't import or use the storage package at all. Levi's classes should be in another package used by Portal and not by Fractal.
driver = db.StringField(required=True) # example "gradient" | ||
method = db.StringField(required=True) # example "uff" | ||
basis = db.StringField() | ||
molecule = db.ReferenceField(Molecule, required=True) # or LazyReferenceField if only ID is needed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only ID is usually needed as we typically only pull data from return_result
or properties
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which field are you referring to?
By referencing the class we mean it's going to be pulled and used. If we use class_id only, then it means we will rarely use it or pull it.
So
assert len(result_list) == 2 | ||
|
||
# get unique by hash and formula | ||
one_mol = Molecule.objects(molecule_hash=water_mol.molecule_hash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can do the following in some cases as well:
query = {"molecule_hash": water_mol.molecule_hash, "molecular_formula":water_mol.molecular_formula}
.query(**query).only(molecule_hash=True).limit(5)
The attributed chaining feels awkward at the moment compared to PyMongo-- is this something that you become more accustomed to? Is there a way to do specify this in one instead of chaining?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chaining is the typical way, similar to Pandas (and Dash as you have mentioned).
I'll post example of how to do the query. The key here is to stop using the JSON style, lots of quotes and nested brackets :)
13c23f5
to
a7515aa
Compare
This pull request introduces 2 alerts when merging b03d31b into f26a240 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
2dde93a
to
8a2c02b
Compare
This pull request introduces 2 alerts when merging 8a2c02b into f26a240 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 2 alerts when merging 4f3c2a7 into d5a1276 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 6 alerts when merging 5116d9d into 424c633 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 2 alerts when merging af9c421 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 2 alerts when merging b0c68d1 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 3 alerts when merging a98e8a5 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 3 alerts when merging 5592c34 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 3 alerts when merging 1a32177 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 3 alerts when merging 6b1a570 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
This pull request introduces 3 alerts when merging 13e4bb0 into 3722afe - view on LGTM.com new alerts:
Comment posted by LGTM.com |
Certainly more work to do here, but I think everything looks good! @doaa-altarawy ready to merge? |
Woo! |
Description
Implementing issue #76
Todos
Status