From 0c137d11293fb0b3f4f6b547648eb593c93c20b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimi=CC=81r=20Orany=CC=81?= Date: Thu, 10 Nov 2016 15:18:34 +0100 Subject: [PATCH] MET-1332 single section forms and ability to specify item name --- .../metadata/templates/defaultBasic.tpl.html | 16 ++++++++++ .../metadata/templates/formItem.tpl.html | 31 +++++++++++++++++++ .../templates/formItemDataElement.tpl.html | 26 ++++++++++++++++ .../mc/core/forms/templates/formItem.tpl.html | 31 +++++++++++++++++++ .../modelcatalogue/core/forms/forms.coffee | 3 ++ .../grails-app/conf/BootStrap.groovy | 2 +- .../elasticsearch/ElasticSearchService.groovy | 2 +- .../forms/ModelToFormExporterService.groovy | 5 +-- 8 files changed, 112 insertions(+), 4 deletions(-) diff --git a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/defaultBasic.tpl.html b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/defaultBasic.tpl.html index 9acde86fc3..53b17f209f 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/defaultBasic.tpl.html +++ b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/defaultBasic.tpl.html @@ -5,6 +5,22 @@ + + + + + + + + + + + + + +
+ Single Section Form + + + + {{element.ext.get('http://forms.modelcatalogue.org/form#form') ? + (element.ext.get('http://forms.modelcatalogue.org/form#form') == "false" ? "No": "Yes") : "" }} + +
diff --git a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/formItem.tpl.html b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/formItem.tpl.html index f43be10538..493d88d2e6 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/formItem.tpl.html +++ b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadata/templates/formItem.tpl.html @@ -19,6 +19,37 @@
+ Name + + + + {{element.ext.get('http://forms.modelcatalogue.org/item#name')}} + +
Protected Health Information diff --git a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadataEditors/templates/formItemDataElement.tpl.html b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadataEditors/templates/formItemDataElement.tpl.html index 9194e5ae57..f131764e70 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadataEditors/templates/formItemDataElement.tpl.html +++ b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/mc/core/forms/metadataEditors/templates/formItemDataElement.tpl.html @@ -9,6 +9,32 @@ Specifies if this data element should be excluded from the result CRF.

+ +
+ + +

+ The unique label or variable name for the data element. + The field is not displayed as part of the CRF but can be viewed as part of the CRF and Item Metadata, and is shown + in the Discrepancy Notes and Rules modules.
+ This field is case-sensitive. Items with names "item1" and "Item1" will be treated as different items. This can + cause issues with many data analysis tools and should be avoided in most cases. + For Enterprise customers interested in using Datamart:
+ Please note that Datamart treat items in case-insensitive manner. Please treat all ITEM_NAMES as case-insensitive. + Also for use with Datamart, Postgres has a list of reserved words and special characters which should not be used + as item names.
+ This field should be used at all times.
+ ITEM_NAME will be used to form the OID and the variable name when exporting data from OpenClinica. + Brevity is recommended for the value as it will be used to generate the unique OC_OID. + Re-use of the same ITEM_NAME across CRF Versions indicates the variable is the same item. Once created, an item + name cannot be modified within the CRF. See "CRF Versioning" and "Scope of CRFs and Items" in this document + for more detail. +

+
+
+ Name + + + + {{element.ext.get('http://forms.modelcatalogue.org/item#name')}} + +
Protected Health Information diff --git a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/modelcatalogue/core/forms/forms.coffee b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/modelcatalogue/core/forms/forms.coffee index 0321572808..d9a88a6abe 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/modelcatalogue/core/forms/forms.coffee +++ b/ModelCatalogueCorePluginTestApp/grails-app/assets/javascripts/modelcatalogue/core/forms/forms.coffee @@ -15,6 +15,7 @@ forms.config ['metadataEditorsProvider', 'detailSectionsProvider', (metadataEdit 'dataType' ] keys: [ + "http://forms.modelcatalogue.org/form#form" "http://forms.modelcatalogue.org/form#name" "http://forms.modelcatalogue.org/form#version" "http://forms.modelcatalogue.org/form#versionDescription" @@ -34,6 +35,7 @@ forms.config ['metadataEditorsProvider', 'detailSectionsProvider', (metadataEdit typeKeys: { 'dataElement': [ "http://forms.modelcatalogue.org/item#exclude" + "http://forms.modelcatalogue.org/item#name" "http://forms.modelcatalogue.org/item#question" "http://forms.modelcatalogue.org/item#defaultValue" "http://forms.modelcatalogue.org/item#phi" @@ -108,6 +110,7 @@ forms.config ['metadataEditorsProvider', 'detailSectionsProvider', (metadataEdit keys: [ "http://forms.modelcatalogue.org/item#exclude" + "http://forms.modelcatalogue.org/item#name" "http://forms.modelcatalogue.org/item#question" "http://forms.modelcatalogue.org/item#defaultValue" "http://forms.modelcatalogue.org/item#phi" diff --git a/ModelCatalogueCorePluginTestApp/grails-app/conf/BootStrap.groovy b/ModelCatalogueCorePluginTestApp/grails-app/conf/BootStrap.groovy index 22280836ee..94f17585cd 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/conf/BootStrap.groovy +++ b/ModelCatalogueCorePluginTestApp/grails-app/conf/BootStrap.groovy @@ -64,7 +64,7 @@ class BootStrap { } } else { - initCatalogueService.initDefaultRelationshipTypes()b + initCatalogueService.initDefaultRelationshipTypes() initDataModelPolicies() initSecurity(true) } diff --git a/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/elasticsearch/ElasticSearchService.groovy b/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/elasticsearch/ElasticSearchService.groovy index ff4967d010..be49cb5ed0 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/elasticsearch/ElasticSearchService.groovy +++ b/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/elasticsearch/ElasticSearchService.groovy @@ -565,7 +565,7 @@ class ElasticSearchService implements SearchCatalogue { if (group.key in [RelationshipType, DataModelPolicy]) { return group } - throw new UnsupportedOperationException("Not Yet Implemented for $group.key") + throw new UnsupportedOperationException("Not Yet Implemented for '$group.key': ${group.toList().toBlocking().first()}") } flatMap { entity -> Class clazz = getEntityClass(entity) ImmutableSet indices = getIndices(entity) diff --git a/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/forms/ModelToFormExporterService.groovy b/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/forms/ModelToFormExporterService.groovy index 34d156bdd1..bb75a17f6e 100644 --- a/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/forms/ModelToFormExporterService.groovy +++ b/ModelCatalogueCorePluginTestApp/grails-app/services/org/modelcatalogue/core/forms/ModelToFormExporterService.groovy @@ -31,6 +31,7 @@ class ModelToFormExporterService { static transactional = false static final String EXT_FORM_NAME = "http://forms.modelcatalogue.org/form#name" + static final String EXT_FORM_FORM = "http://forms.modelcatalogue.org/form#form" static final String EXT_FORM_VERSION = "http://forms.modelcatalogue.org/form#version" static final String EXT_FORM_VERSION_DESCRIPTION = "http://forms.modelcatalogue.org/form#versionDescription" static final String EXT_FORM_REVISION_NOTES = "http://forms.modelcatalogue.org/form#revisionNotes" @@ -98,7 +99,7 @@ class ModelToFormExporterService { versionDescription formModel.ext[EXT_FORM_VERSION_DESCRIPTION] ?: formModel.description ?: "Generated from ${alphaNumNoSpaces(formModel.name)}" revisionNotes formModel.ext[EXT_FORM_REVISION_NOTES] ?: "Generated from ${alphaNumNoSpaces(formModel.name)}" - if (formModel.countParentOf()) { + if (formModel.countParentOf() && formModel.ext[EXT_FORM_FORM] != 'true') { processed << formModel.getId() for (Relationship sectionRel in formModel.parentOfRelationships) { handleSectionModel(itemNumber, processed, formName, caseReportForm, sectionRel) @@ -107,7 +108,7 @@ class ModelToFormExporterService { // at least one section is mandatory (this may happen when data class has no childs or all childs are excluded) if (caseReportForm.sections.isEmpty()) { - handleSectionModel(itemNumber, [] as Set, '', caseReportForm, new Relationship(destination: formModel), true) + handleSectionModel(itemNumber, [] as Set, '', caseReportForm, new Relationship(destination: formModel), formModel.ext[EXT_FORM_FORM] != 'true') } } }