-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor cli #32
Refactor cli #32
Conversation
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.
This is great! I actually learned a lot just by going through this code so thanks 👍
Just for fun, I also tested the installation and it worked flawlessly:
(venv) april@boudica:~/projects/MARS/mars-cli$ mars-cli -d health-check
############# Welcome to the MARS CLI. #############
Running in Development environment
Checking the health of the target repositories.
Checking development instances.
Webin (https://wwwdev.ebi.ac.uk/ena/submit/webin/auth) is healthy.
ENA (https://wwwdev.ebi.ac.uk/ena/submit/webin-v2/) is healthy.
Biosamples (https://wwwdev.ebi.ac.uk/biosamples/samples/) is healthy.
(venv) april@boudica:~/projects/MARS/mars-cli$ ls ~/.mars
app.log settings.ini
(venv) april@boudica:~/projects/MARS/mars-cli$
from mars_lib.target_repo import TargetRepository, TARGET_REPO_KEY | ||
|
||
|
||
class IsaBase(BaseModel): |
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'm not an ISA or a Pydantic expert, but I'm wondering whether Pydantic gives us a way to extend the base ISA schemas to make "MARS-ISA-JSON" a reality. The idea here would be something like:
- ISA Python API contains the Pydantic models that exactly implement ISA JSON schema (if we can generate Pydantic classes from JSON schema automatically, this is hopefully not much overhead for their team - this code probably gives a good start).
- MARS extends those models with additional requirements - again I'm not an expert but something like this gist (from this SO answer). This way our schema stays up-to-date with ISA, but we maintain our own additions to the schema.
- MARS can then validate using our additional requirements, and also use ISA-tools' own object model to take advantage of things like GraphQL queries for filtering and so on.
(BTW none of affects this PR in particular, I'm just thinking/fantasizing out loud.)
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.
Yeah I agree with you.
There are python packages that generate pydantic models from json.
And pydantic models can spit out json schema as well.
Curious about what the rest thinks about it.
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.
how can we coordinate to reuse objects and functionality from the isa-api rather than re-implementing?
Note: the latest code now supports adding 'Comments' to Assays thus allowing to indicate which Repository to dispatch to.
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.
@proccaserra We would love to reuse the ISA API if it meets all our needs. But we were puzzled how we would for example validate, using ISA-tools, the loaded isa structure in a more stringent way than the ISA-JSON validator currently does? Because in the latest implementation we used, even an empty json was seen as a valid ISA JSON :/
Co-authored-by: April Shen <[email protected]>
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've tested these changes and they worked for me! Again a step closer ;)
It's certainly not perfect but I hope a good start...