Skip to content

Commit

Permalink
Merge pull request #8473 from IQSS/8452-multiple-collMode
Browse files Browse the repository at this point in the history
8452 multiple coll mode
  • Loading branch information
kcondon authored Mar 14, 2022
2 parents 1487650 + a96f5b9 commit b8680e5
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conf/solr/8.11.1/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
<field name="characteristicOfSources" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="city" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="cleaningOperations" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="collectionMode" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="collectionMode" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="collectorTraining" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="contributor" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="contributorName" type="text_en" multiValued="true" stored="true" indexed="true"/>
Expand Down
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.

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"
]

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

0 comments on commit b8680e5

Please sign in to comment.