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

add conversion script and functions from cobidas checklist #5

Closed
wants to merge 2 commits into from

Conversation

Remi-Gau
Copy link
Contributor

Should fix #3

@satra

Transferring here the few scripts and functions used to convert spreadsheets into schema.

The script is based on COBIDAS so it assumes that one spreadsheet describes a whole protocol and will almost always contain several activities that will need to be created and added to the protocol.

I started adding some modularity to deal with functions for items, activities and protocol separately but I suspect that those could be turned into classes as well: but coming from the matlab school I still think with function and procedural rather than object and classes + methods. Baby steps.

Also those scripts are 2 weeks old so they output things that are not up to date with the latest shape of the schema.

@Remi-Gau
Copy link
Contributor Author

@satra

Finally took the time to try doing some actual object oriented programming and creating my first classes in python to make some tools that could be useful to create new protocols, activity, items...

The general idea is that the classes for protocol, activity and schema are all based on a schema class because I quickly realized there was a lot of overlap.

There is room for improvement and some things are not "general" enough and too centered on my specific needs.

Also I have created some methods to set some "default" content in the jsonld: not sure if this is something we want to do.

Similarly the actual URI and schema version, I use to point to all the definitions are "hard coded" in the schema class: not sure if we want to make that more flexible.

Will try to keep working on it but if you have suggestions, pointers... I am listening.

The scripts that I use and that rely on those classes are on a separate PR on the builder repo: in case it is unclear how those are used.
ReproNim/reproschema-builder#6

@satra
Copy link
Contributor

satra commented Sep 23, 2020

thanks @Remi-Gau - i'll merge this in for now, but we may want to do something a little more complex :) for example building the python classes (using say pydantic or attrs) directly from the schema/shape file.

unless those words were completely clear i can take a stab sometime soon at at least a process. this would allow us to just maintain the schema rather than both code and schema changes. although in the short run what you have done is a great starting point.

@Remi-Gau
Copy link
Contributor Author

If there are ways to automate that (am now googling those said words) let's go for it.

For me this was also a way to train my baby pythonic muscles. :-)

@satra satra mentioned this pull request Sep 25, 2020
@satra
Copy link
Contributor

satra commented Sep 25, 2020

closing to move to #10

@satra satra closed this Sep 25, 2020
@Remi-Gau Remi-Gau deleted the remi-conversion_script branch June 6, 2021 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

conversion tools
2 participants