-
Notifications
You must be signed in to change notification settings - Fork 46
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
Return a pyDataverse object from an API requests #9
Comments
This is a good idea. I had at the beginning different return types implemented, but to offer full control to the user, i removed it. Am trying to list up all return_types, that could be of interest
|
In the case of multiple returns, one could return a subDictionary containing all return types and the user can decide on the return desired. return {'json':jsonObject, 'dict':dictObject, ...}
...
json = returnDict["json"] Or some kind of return class. json = returnClass.getJson() |
In general, to keep the module as simple, tidy and modular as possible, I want to define each abstraction level in detail and give the users as much freedom as possible. A user should be able to decide, what it wants to do with the responses, and I should not limit their options I think. This said, from that point on, a lot of abstractions can be made, to offer functions for specific use-cases. Once the core works well, the next level of abstraction can be tackled. To be more concrete: The first step is to develop get() and set() to create proper dicts as output. This will then be used to connect all kinds of i/o formats (to_json, from_json, to_xml, from_xml and so on). Once this is done, the passing of objects could also be an option (or just pass the Dataset.to_json() output as JSON string into the API call directly). |
Will be solved in #132. |
As discussed during the 2024-02-14 meeting of the pyDataverse working group, we are closing old milestones in favor of a new project board at https://github.com/orgs/gdcc/projects/1 and removing issues (like this one) from those old milestones. Please feel free to join the working group! You can find us at https://py.gdcc.io and https://dataverse.zulipchat.com/#narrow/stream/377090-python |
When pulling a dataset, the response object contains the json of the dataset. Would it be attractive to instead return a Dataset object?
The Dataset class would simply contain getter and setter functions for all properties and the constructor only needs the json as an input.
I assume this would improve clarity (one could create a print function to show the metadata maybe using pandas?).
Additionally, a Dataset object could be passed to other functions like create_dataset.
The text was updated successfully, but these errors were encountered: