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

DANS - 9707/Second fix for #9677 #9706

Conversation

qqmyers
Copy link
Member

@qqmyers qqmyers commented Jul 14, 2023

What this PR does / why we need it: In removing extra fields from the main json export, the fix in #9677 also removed them from file details where they need to be. This PR leverages the boolean flag introduced in #9695 to just add the extra fields when called to create the file details json export.

Which issue(s) this PR closes:

Closes #9707

Special notes for your reviewer: discussed in https://iqss.slack.com/archives/C03R1E7T4KA/p1689347480349959

Suggestions on how to test this: Verify that DDI exports in the exports menu have variable level metadata and that the main json export does not.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@coveralls
Copy link

coveralls commented Jul 14, 2023

Coverage Status

coverage: 20.391% (-0.001%) from 20.392% when pulling 77260cd on GlobalDataverseCommunityConsortium:DANS-external_exporters into 0661c3a on IQSS:develop.

@qqmyers qqmyers changed the title DANS - Second fix for #9677 DANS - 9707/Second fix for #9677 Jul 14, 2023
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qqmyers thanks for the PR. Would you be able to add a test so it stays fixed?

It's probably a matter of calling this...

UtilIT.exportDataset(datasetPersistentId, "ddi", apiToken);

...like we do in DatasetsIT.

@qqmyers
Copy link
Member Author

qqmyers commented Jul 14, 2023

@pdurbin - I think tests like

public void testRestrictFileExportDdi() throws IOException {
already cover this. It looks like that didn't run for #9695 but has passed for this PR.

@pdurbin
Copy link
Member

pdurbin commented Jul 15, 2023

@qqmyers if existing tests are already catching this bug why aren't they failing in the develop branch? Why did the regression need to be discovered manually?

The latest API test run for develop shows no failures: https://jenkins.dataverse.org/job/IQSS-dataverse-develop/1406/testReport/edu.harvard.iq.dataverse.api/

@qqmyers qqmyers added this to Ready for Review ⏩ in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) via automation Jul 17, 2023
@qqmyers qqmyers added the Size: 3 A percentage of a sprint. 2.1 hours. label Jul 17, 2023
@qqmyers qqmyers added this to the 5.14 milestone Jul 17, 2023
@scolapasta scolapasta moved this from Ready for Review ⏩ to In Review 🔎 in IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) Jul 17, 2023
@qqmyers
Copy link
Member Author

qqmyers commented Jul 17, 2023

OK - new test now passes. Not sure what is up with the MoveIT test - that doesn't seem related. Perhaps timing related again? Otherwise, I think this is ready for review.

@pdurbin
Copy link
Member

pdurbin commented Jul 17, 2023

Not sure what is up with the MoveIT test

Should be fixed here:

@pdurbin
Copy link
Member

pdurbin commented Jul 17, 2023

@qqmyers thanks for the test! I'm just recording here the output I see from the new test on develop where I expect it to fail (then I'll go run the test on your branch):

  <fileDscr ID="f6" URI="http://localhost:8080/api/access/datafile/6">
    <fileTxt>
      <fileName>data.tab</fileName>
      <fileType>text/tab-separated-values</fileType>
    </fileTxt>
  </fileDscr>
  <otherMat ID="f6" URI="http://localhost:8080/api/access/datafile/6" level="datafile">
    <labl>data.tab</labl>
    <txt/>
    <notes level="file" type="DATAVERSE:CONTENTTYPE" subject="Content/MIME Type">text/tab-separated-values</notes>
  </otherMat>
</codeBook>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 12.11 s <<< FAILURE! - in edu.harvard.iq.dataverse.api.DatasetsIT
edu.harvard.iq.dataverse.api.DatasetsIT.testUnrestrictedFileExportDdi  Time elapsed: 9.881 s  <<< FAILURE!
java.lang.AssertionError: 
XML path codeBook.fileDscr.fileTxt.dimensns.caseQnty doesn't match.
Expected: 3
  Actual: 

	at edu.harvard.iq.dataverse.api.DatasetsIT.testUnrestrictedFileExportDdi(DatasetsIT.java:3258)


Results:

Failures: 
  DatasetsIT.testUnrestrictedFileExportDdi:3258 XML path codeBook.fileDscr.fileTxt.dimensns.caseQnty doesn't match.
Expected: 3
  Actual: 


Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

@pdurbin
Copy link
Member

pdurbin commented Jul 17, 2023

I merged develop in and ran the test locally. Works great. Here are the variables being tested:

  <fileDscr ID="f4" URI="http://localhost:8080/api/access/datafile/4">
    <fileTxt>
      <fileName>data.tab</fileName>
      <dimensns>
        <caseQnty>3</caseQnty>
        <varQnty>3</varQnty>
      </dimensns>
      <fileType>text/tab-separated-values</fileType>
    </fileTxt>
    <notes level="file" type="VDC:UNF" subject="Universal Numeric Fingerprint">UNF:6:pZmxR+HCyezWT94Tp3MPxA==</notes>
  </fileDscr>
  <dataDscr>
    <var ID="v2" name="name" intrvl="discrete">
      <location fileid="f4"/>
      <labl level="variable">name</labl>
      <varFormat type="character"/>
      <notes subject="Universal Numeric Fingerprint" level="variable" type="Dataverse:UNF">UNF:6:tuxukW1kJmzVCPiI7MR6vg==</notes>
    </var>
    <var ID="v1" name="pounds" intrvl="discrete">
      <location fileid="f4"/>
      <labl level="variable">pounds</labl>
      <sumStat type="vald">3.0</sumStat>
      <sumStat type="invd">0.0</sumStat>
      <sumStat type="min">17.0</sumStat>
      <sumStat type="stdev">12.288205727444508</sumStat>
      <sumStat type="mode">.</sumStat>
      <sumStat type="medn">21.0</sumStat>
      <sumStat type="max">40.0</sumStat>
      <sumStat type="mean">26.0</sumStat>
      <varFormat type="numeric"/>
      <notes subject="Universal Numeric Fingerprint" level="variable" type="Dataverse:UNF">UNF:6:E4VJ3RWU5iW8zy7VC9+g5A==</notes>
    </var>
    <var ID="v3" name="species" intrvl="discrete">
      <location fileid="f4"/>
      <labl level="variable">species</labl>
      <varFormat type="character"/>
      <notes subject="Universal Numeric Fingerprint" level="variable" type="Dataverse:UNF">UNF:6:8orejrpTyzm42bgLBZKtsw==</notes>
    </var>
  </dataDscr>

@pdurbin
Copy link
Member

pdurbin commented Jul 17, 2023

I'm seeing variables in the DDI HTML Codebook too:

Screen Shot 2023-07-17 at 2 40 17 PM

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks, especially for the tests, @qqmyers!

IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from In Review 🔎 to Ready for QA ⏩ Jul 17, 2023
@pdurbin pdurbin removed their assignment Jul 17, 2023
@kcondon kcondon self-assigned this Jul 20, 2023
@kcondon kcondon merged commit 4872a58 into IQSS:develop Jul 20, 2023
9 checks passed
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from QA ✅ to Done 🚀 Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: 3 A percentage of a sprint. 2.1 hours.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Export: DDI exports is missing variable info, also an error on dataset create containing tab file
4 participants