Skip to content

Commit

Permalink
Merge pull request #883 from MetadataConsulting/MET-1332-generate-forms
Browse files Browse the repository at this point in the history
MET-1332 single section forms and ability to specify item name
  • Loading branch information
musketyr authored Nov 10, 2016
2 parents 3fa3c9c + 0c137d1 commit d381e58
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
</div>

<table class="table table-condensed table-striped table-borderless table-no-margin small">
<tr ng-if="view.handlesKey('http://forms.modelcatalogue.org/form#form')">
<th class="col-md-3">
Single Section Form
<i class="fa fa-question"
popover="Specifies if this data class should be handled as single-section form."
popover-title="Single Section Form"
popover-trigger="mouseenter"></i>
</th>
<td>
<span editable-checkbox="extAsMap['http://forms.modelcatalogue.org/form#form']" class="small"
e-ng-change="exclude.value = !exclude.value" e-string-to-boolean>
{{element.ext.get('http://forms.modelcatalogue.org/form#form') ?
(element.ext.get('http://forms.modelcatalogue.org/form#form') == "false" ? "No": "Yes") : "" }}
</span>
</td>
</tr>

<tr ng-if="view.handlesKey('http://forms.modelcatalogue.org/form#name')">
<th class="col-md-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,37 @@
</td>
</tr>

<tr ng-if="view.handlesKey('http://forms.modelcatalogue.org/item#name', element)">
<th class="col-md-3">
Name
<i class="fa fa-question"
popover="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 &quot;item1&quot; and &quot;Item1&quot; 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 &quot;CRF Versioning&quot; and &quot;Scope of CRFs and Items&quot; in this document
for more detail."
popover-title="Name"
popover-trigger="mouseenter"></i>
</th>
<td class="full-width-editable">
<span editable-text="extAsMap['http://forms.modelcatalogue.org/item#name']" e-maxlength="255"
e-ng-disabled="exclude.value"
class="small">
{{element.ext.get('http://forms.modelcatalogue.org/item#name')}}
</span>
</td>
</tr>

<tr ng-if="view.handlesKey('http://forms.modelcatalogue.org/item#phi', element)">
<th class="col-md-3">
Protected Health Information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,32 @@
Specifies if this data element should be excluded from the result CRF.
</p>
</div>

<div class="form-group">
<label for="item-question" class="control-label">Name</label>
<input maxlength="255" type="text" class="form-control" id="item-name"
ng-model="object.access('http://forms.modelcatalogue.org/item#name')"
ng-disabled="object.access('http://forms.modelcatalogue.org/item#exclude').asBoolean()"
ng-model-options="{ getterSetter: true }">
<p class="help-block">
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.<br/>
This field is case-sensitive. Items with names &quot;item1&quot; and &quot;Item1&quot; 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:<br/>
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.<br/>
This field should be used at all times.<br/>
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 &quot;CRF Versioning&quot; and &quot;Scope of CRFs and Items&quot; in this document
for more detail.
</p>
</div>

<div class="checkbox">
<label>
<input type="checkbox" ng-model="object.access('http://forms.modelcatalogue.org/item#phi')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,37 @@
</td>
</tr>

<tr ng-if="view.handlesKey('http://forms.modelcatalogue.org/item#name', element)">
<th class="col-md-3">
Name
<i class="fa fa-question"
popover="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 &quot;item1&quot; and &quot;Item1&quot; 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 &quot;CRF Versioning&quot; and &quot;Scope of CRFs and Items&quot; in this document
for more detail."
popover-title="Name"
popover-trigger="mouseenter"></i>
</th>
<td class="full-width-editable">
<span editable-text="extAsMap['http://forms.modelcatalogue.org/item#name']" e-maxlength="255"
e-ng-disabled="exclude.value"
class="small">
{{element.ext.get('http://forms.modelcatalogue.org/item#name')}}
</span>
</td>
</tr>

<tr ng-if="view.handlesKey('http://forms.modelcatalogue.org/item#phi')">
<th class="col-md-3">
Protected Health Information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,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<String> indices = getIndices(entity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -97,7 +98,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)
Expand All @@ -106,7 +107,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<Long>, '', caseReportForm, new Relationship(destination: formModel), true)
handleSectionModel(itemNumber, [] as Set<Long>, '', caseReportForm, new Relationship(destination: formModel), formModel.ext[EXT_FORM_FORM] != 'true')
}
}
}
Expand Down

0 comments on commit d381e58

Please sign in to comment.