-
Notifications
You must be signed in to change notification settings - Fork 2
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
Include instances as attributes of the relevant class #29
Conversation
I don't quite understand from the jinja template whether all the instances will be embedded into the python class? I had done something similar before in the openMINDS MATLAB package, but with suggestions from Lyuba ended up doing it differently. This is the example of a schema definition for AgeCategory. As you can see, it has a hidden Example:
|
@ehennestad I let Andrew respond but it is not loading all instances into the class only the one of the stated type (as it is done for MATLAB as well, more or less) |
8a730da
to
962ce62
Compare
Python name generated for |
I also had this issue with a lot of instance names, as MATLAB is very strict about property names. I ended up changing the constructor for controlled term classes to create the object from a controlled instance if the constructor input is a string which is recognised as a known controlled instance, for example: and it returns the instance:
I think this is a better solution because you can keep using all the original names and don't have to worry about remapping them |
* pipeline: fix typo in comment update support link Use plural attribute names where the property is an array Add "Development" section to README Ensure `pipeline` branch has the same README as `main` sort the preamble, to eliminate random changes from run to run Fix for #23 regression test for #23 # Conflicts: # build.py # pipeline/translator.py
@ehennestad and @Peyman-N I've fixed the Python name generation, but I've also added a In [1]: from openminds.latest.controlled_terms import MolecularEntity
In [2]: MolecularEntity.by_name("HEPES") == MolecularEntity.by_name("4-(2-hydroxyethyl)-1-piperazine ethanesulfonic acid")
Out[2]: True |
This is a proposal for how to include predefined metadata instances (e.g. controlled terms) in the Python library (cf #24). Usage example: