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

8452 multiple coll mode #8473

Merged
merged 7 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doc/release-notes/8452-multiple-collectionmode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### A small modification to the Social Science metadata block

The metadata block update allows the field "collectionMode" to have multiple values and to support Controlled Vocabularies.

For the upgrade instruction:

Update the Social Science metadata block as follows:

- `wget https://github.com/IQSS/dataverse/releases/download/v5.10/social_science.tsv`
- `curl http://localhost:8080/api/admin/datasetfield/load -X POST --data-binary @social_science.tsv -H "Content-type: text/tab-separated-values"`

As a general reminder, please note that it is important to keep your metadata block definitions up-to-date.
2 changes: 1 addition & 1 deletion scripts/api/data/metadatablocks/social_science.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
targetSampleActualSize Actual Actual sample size. Enter an integer... int 8 FALSE FALSE FALSE FALSE FALSE FALSE targetSampleSize socialscience
targetSampleSizeFormula Formula Formula used to determine target sample size. text 9 FALSE FALSE FALSE FALSE FALSE FALSE targetSampleSize socialscience
deviationsFromSampleDesign Major Deviations for Sample Design Show correspondence as well as discrepancies between the sampled units (obtained) and available statistics for the population (age, sex-ratio, marital status, etc.) as a whole. text 10 FALSE FALSE FALSE FALSE FALSE FALSE socialscience
collectionMode Collection Mode Method used to collect the data; instrumentation characteristics (e.g., telephone interview, mail questionnaire, or other). textbox 11 FALSE FALSE FALSE FALSE FALSE FALSE socialscience
collectionMode Collection Mode Method used to collect the data; instrumentation characteristics (e.g., telephone interview, mail questionnaire, or other). textbox 11 FALSE FALSE TRUE FALSE FALSE FALSE socialscience
researchInstrument Type of Research Instrument Type of data collection instrument used. Structured indicates an instrument in which all respondents are asked the same questions/tests, possibly with precoded answers. If a small portion of such a questionnaire includes open-ended questions, provide appropriate comments. Semi-structured indicates that the research instrument contains mainly open-ended questions. Unstructured indicates that in-depth interviews were conducted. text 12 FALSE FALSE FALSE FALSE FALSE FALSE socialscience
dataCollectionSituation Characteristics of Data Collection Situation Description of noteworthy aspects of the data collection situation. Includes information on factors such as cooperativeness of respondents, duration of interviews, number of call backs, or similar. textbox 13 FALSE FALSE FALSE FALSE FALSE FALSE socialscience
actionsToMinimizeLoss Actions to Minimize Losses Summary of actions taken to minimize data loss. Include information on actions such as follow-up visits, supervisory checks, historical matching, estimation, and so on. text 14 FALSE FALSE FALSE FALSE FALSE FALSE socialscience
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,17 @@ private static void writeMethodElement(XMLStreamWriter xmlw , DatasetVersionDTO
writeFullElement(xmlw, "srcDocu", dto2Primitive(version, DatasetFieldConstant.accessToSources));
xmlw.writeEndElement(); //sources

writeI18NElement(xmlw, "collMode", version, DatasetFieldConstant.collectionMode, lang);
FieldDTO collModeFieldDTO = dto2FieldDTO(version, DatasetFieldConstant.collectionMode, "socialscience");
if (collModeFieldDTO != null) {
// This field was made multiple as of 5.10
// Below is a backward compatibility check allowing export to work in
// an instance where the metadata block has not been updated yet.
if (collModeFieldDTO.getMultiple()) {
writeI18NElementList(xmlw, "collMode", collModeFieldDTO.getMultipleVocab(), DatasetFieldConstant.collectionMode, collModeFieldDTO.getTypeClass(), "socialscience", lang);
} else {
writeI18NElement(xmlw, "collMode", version, DatasetFieldConstant.collectionMode, lang);
}
}
writeI18NElement(xmlw, "resInstru", version, DatasetFieldConstant.researchInstrument, lang);
writeFullElement(xmlw, "collSitu", dto2Primitive(version, DatasetFieldConstant.dataCollectionSituation));
writeFullElement(xmlw, "actMin", dto2Primitive(version, DatasetFieldConstant.actionsToMinimizeLoss));
Expand Down Expand Up @@ -1359,7 +1369,19 @@ private static List<String> dto2PrimitiveList(DatasetVersionDTO datasetVersionDT
}
return null;
}


private static FieldDTO dto2FieldDTO(DatasetVersionDTO datasetVersionDTO, String datasetFieldTypeName, String metadataBlockName) {
MetadataBlockDTO block = datasetVersionDTO.getMetadataBlocks().get(metadataBlockName);
if (block != null) {
for (FieldDTO fieldDTO : block.getFields()) {
if (datasetFieldTypeName.equals(fieldDTO.getTypeName())) {
return fieldDTO;
}
}
}
return null;
}

private static void writeFullElementList(XMLStreamWriter xmlw, String name, List<String> values) throws XMLStreamException {
//For the simplest Elements we can
if (values != null && !values.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,12 @@
},
{
"typeName": "collectionMode",
"multiple": false,
"multiple": true,
"typeClass": "primitive",
"value": "CollectionMode"
"value": [
"CollectionMode"
]
Comment on lines -976 to +978
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that the native JSON format is changing? If so we should indicate this under "Backward Incompatibilities" in the release notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the answer is "yes". (I'm not 100% sure, tbh. the above change in the .json file was needed for the tests to pass. There is a small chance that a real json import would still work; and the single primitive value would be accepted... I should've tested that).

OK, I'll look for an example of an advertised backward incompatibility in the past release notes.

Copy link
Member

@pdurbin pdurbin Mar 9, 2022

Choose a reason for hiding this comment

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

Thanks. If it helps, the 5.10 release notes already have a "Backwards Incompatibilities" section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is an incompatibility, yes.


},
{
"typeName": "researchInstrument",
Expand Down