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

API fails to handle metadataBlocks: "astrophysics" & "biomedical" #164

Open
4 tasks done
jmurugan-fzj opened this issue Nov 23, 2023 · 5 comments
Open
4 tasks done
Labels
status:incoming Newly created issue to be forwarded type:bug Something isn't working

Comments

@jmurugan-fzj
Copy link

jmurugan-fzj commented Nov 23, 2023

Bug report

The latest version of dataset-create-new-all-default-fields.json allows also "astrophysics" & "biomedical" related metadata to be populated for a newly created data set. But the present version of src/pyDataverse/models.py does not seem to be capable of handling these metadata blocks.

image

1. Describe your environment

  • OS: Linux, Ubuntu 22.04.1, 64bit
  • pyDataverse: 0.3.1
  • Python: 3.10.12
  • Dataverse: v. 6.0 build 1512-366fd41

2. Actual behaviour:

  • Create a new dataset with the "astrophysics" & "biomedical" metadata and notice that the metadata information is not populated in dataverse
    ds = Dataset()
    ds.set({"title": "Test Data Set"})
    ds.set({"license": "CC0 1.0"})
    ds.set({"astroType": ["Mosaic"],
            "astroFacility": ["AIK-2", "AIK-3"],
            "studyDesignType": ["Case Control", "Cross Sectional"],
            "studyAssayOrganism": ["Arabidopsis thaliana", "Bos taurus", "Zea mays"]})
    ds.validate_json()
   native_api.create_dataset(dataverse=dataverse_id, metadata=ds.json(), auth=True)
  • I have tried populating from different blocks, most of them succeeded except these two blocks
    image

3. Expected behaviour:

  • API should be able to populate also the metadata blocks: "astrophysics" & "biomedical"..

4. Steps to reproduce

  1. Create a new data-set using the method mentioned in the "expected behavior" above
  2. Check the created data set in dataverse to see that the "astrophysics" & "biomedical" metadata are missing..

5. Possible solution

  • As I mentioned above in the description model needs to be extended to populate other metadata blocks also.
@jmurugan-fzj jmurugan-fzj added status:incoming Newly created issue to be forwarded type:bug Something isn't working labels Nov 23, 2023
@pdurbin
Copy link
Member

pdurbin commented Nov 28, 2023

I don't mean to speak for @JR-1991 but I believe this is supported by EasyDataverse: https://github.com/gdcc/easyDataverse

@JR-1991
Copy link
Member

JR-1991 commented Nov 29, 2023

@pdurbin, thanks for raising this. The latest version of EasyDatavere now handles metadata configs dynamically, so you can easily get metadata schemes as classes and populate them like any other Python/PyDantic dataclass.

I've tested your use case and created a Jupyter Notebook that shows how to upload metadata to Demo Dataverse. Also, find a small documentation of other features in the flexible-connect branches Readme file.

Let me know if you have any questions 😊

Colab notebook

image

@jmurugan-fzj
Copy link
Author

I don't mean to speak for @JR-1991 but I believe this is supported by EasyDataverse: https://github.com/gdcc/easyDataverse

@pdurbin Thanks for the suggestion, does that mean that I have to switch to easyDataverse instead of pyDataverse? Also I guess, there won't be any future pyDataverse extension planned for this support?

@JR-1991 I will try this solution also, thanks for the detailed explanation with the snippets too 👍

@JR-1991
Copy link
Member

JR-1991 commented Nov 29, 2023

@jmurugan-fzj - For the time being, I suggest using EasyDataverse to work around the issue. However, in the future, you can continue to use PyDataverse since we are currently planning the next version of PyDataverse. This will address a multitude of issues and PRs filed within this repository.

@pdurbin
Copy link
Member

pdurbin commented Nov 29, 2023

we are currently planning the next version of PyDataverse

Please see https://dataverse.zulipchat.com/#narrow/stream/377090-python/topic/PyDataverse.20Re-Vamp/near/404845745 and https://docs.google.com/document/d/15cd_I2caOX5ekJrGI_kTe2KibenMk6kZ4qy9y135_60/edit?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:incoming Newly created issue to be forwarded type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants