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

Return a pyDataverse object from an API requests #9

Open
Ajax23 opened this issue Jun 14, 2019 · 5 comments
Open

Return a pyDataverse object from an API requests #9

Ajax23 opened this issue Jun 14, 2019 · 5 comments
Assignees
Labels
pkg:api api related activities prio:high status:confirmed Is a valid issue and will be moved forward soon. type:feature New feature

Comments

@Ajax23
Copy link
Contributor

Ajax23 commented Jun 14, 2019

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.

@skasberger skasberger changed the title Dataset class Return Dataset object for Api requests Jun 22, 2019
@skasberger skasberger self-assigned this Jun 22, 2019
@skasberger skasberger added pkg:api api related activities type:feature New feature type:idea Further information is requested labels Jun 22, 2019
@skasberger skasberger added this to the v0.2.2 milestone Jun 22, 2019
@skasberger
Copy link
Member

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

  • json (default)
  • dict
  • Dataset/Dataverse/Datafile object
  • requests object

@Ajax23
Copy link
Contributor Author

Ajax23 commented Jun 24, 2019

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()

@skasberger skasberger changed the title Return Dataset object for Api requests Return Dataset object in Api requests Jul 2, 2019
@skasberger skasberger modified the milestones: v0.2.2, v0.3.0, v0.4.0 or later Jun 19, 2020
@skasberger
Copy link
Member

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).

@skasberger skasberger changed the title Return Dataset object in Api requests Return a pyDataverse object from an API requests Jun 26, 2020
@skasberger skasberger added prio:low status:deferred Will be looked at later. and removed type:feature New feature labels Jun 26, 2020
@skasberger skasberger added status:confirmed Is a valid issue and will be moved forward soon. and removed status:confirmed Is a valid issue and will be moved forward soon. labels Jul 21, 2020
djbrooke pushed a commit to djbrooke/pyDataverse that referenced this issue Feb 9, 2021
@skasberger skasberger modified the milestones: Later, v0.4.0 Feb 17, 2021
@skasberger skasberger mentioned this issue Feb 17, 2021
26 tasks
@skasberger
Copy link
Member

skasberger commented Feb 17, 2021

Will be solved in #132.

@skasberger skasberger removed prio:low status:deferred Will be looked at later. type:idea Further information is requested labels Feb 17, 2021
@skasberger skasberger added prio:high status:confirmed Is a valid issue and will be moved forward soon. type:feature New feature labels Feb 17, 2021
@skasberger skasberger mentioned this issue Mar 14, 2021
35 tasks
skasberger added a commit that referenced this issue Apr 7, 2021
@pdurbin
Copy link
Member

pdurbin commented Feb 14, 2024

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

@pdurbin pdurbin removed this from the v0.4.0 milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:api api related activities prio:high status:confirmed Is a valid issue and will be moved forward soon. type:feature New feature
Projects
None yet
Development

No branches or pull requests

3 participants