Skip to content

Commit

Permalink
improved snake case formatter closes #1054
Browse files Browse the repository at this point in the history
  • Loading branch information
ppazos committed Oct 20, 2019
1 parent d9c7928 commit 78848a2
Show file tree
Hide file tree
Showing 8 changed files with 1,415 additions and 1 deletion.
Binary file modified .gradle/3.5/fileContent/fileContent.lock
Binary file not shown.
Binary file modified .gradle/3.5/taskHistory/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/3.5/taskHistory/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/3.5/taskHistory/taskHistory.bin
Binary file not shown.
Binary file modified .gradle/3.5/taskHistory/taskHistory.lock
Binary file not shown.
13 changes: 12 additions & 1 deletion grails-app/init/ehrserver2/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import grails.util.Holders
import grails.converters.*
import groovy.json.StringEscapeUtils

import java.text.Normalizer

class BootStrap {

def configurationService
Expand Down Expand Up @@ -750,7 +752,16 @@ class BootStrap {
}

String.metaClass.toSnakeCase = {
delegate.replaceAll(/\s([A-Z])/, /$1/).replaceAll( /([A-Z])/, /_$1/ ).replaceAll(/\s/, '_').replaceAll( /^_/, '' ).toLowerCase()
def n = delegate
.trim() // remove spaces
.replaceAll(/\s([A-Z])/, /$1/) // space + uppercase char => uppercase char
.replaceAll( /([A-Z])/, /_$1/ ) // uppercase char => underscore + uppercase char
.replaceAll(/\s+/, '_') // spaces => underscore
.replaceAll( /^_/, '' ) // remove underscore from char[0]
.toLowerCase() // all lowercase

// removes accents
n = Normalizer.normalize(n, Normalizer.Form.NFD).replaceAll("[\\p{InCombiningDiacriticalMarks}]", "")
}

// Escapes quotes in strings for displaying via JS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Operational template XML automatically generated by Ocean Template Designer Version 2.8.94Beta-->
<template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.openehr.org/v1">
<language>
<terminology_id>
<value>ISO_639-1</value>
</terminology_id>
<code_string>en</code_string>
</language>
<description>
<original_author id="Original Author">Not Specified</original_author>
<lifecycle_state>Initial</lifecycle_state>
<other_details id="MetaDataSet:Sample Set ">Template metadata sample set </other_details>
<other_details id="Acknowledgements"></other_details>
<other_details id="Business Process Level"></other_details>
<other_details id="Care setting"></other_details>
<other_details id="Client group"></other_details>
<other_details id="Clinical Record Element"></other_details>
<other_details id="Copyright"></other_details>
<other_details id="Issues"></other_details>
<other_details id="Owner"></other_details>
<other_details id="Sign off"></other_details>
<other_details id="Speciality"></other_details>
<other_details id="User roles"></other_details>
<details>
<language>
<terminology_id>
<value>ISO_639-1</value>
</terminology_id>
<code_string>en</code_string>
</language>
<purpose>Not Specified</purpose>
</details>
</description>
<uid>
<value>c51011b9-0e62-4187-a36b-6706da1ddcc5</value>
</uid>
<template_id>
<value>Test index references EN</value>
</template_id>
<concept>Test index references EN</concept>
<definition>
<rm_type_name>COMPOSITION</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</occurrences>
<node_id>at0000</node_id>
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
<rm_attribute_name>category</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_COMPLEX_OBJECT">
<rm_type_name>DV_CODED_TEXT</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</occurrences>
<node_id />
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
<rm_attribute_name>defining_code</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_CODE_PHRASE">
<rm_type_name>CODE_PHRASE</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</occurrences>
<node_id />
<terminology_id>
<value>openehr</value>
</terminology_id>
<code_list>433</code_list>
</children>
</attributes>
</children>
</attributes>
<attributes xsi:type="C_MULTIPLE_ATTRIBUTE">
<rm_attribute_name>content</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_ARCHETYPE_ROOT">
<rm_type_name>OBSERVATION</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>true</upper_unbounded>
<lower>0</lower>
</occurrences>
<node_id>at0000</node_id>
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
<rm_attribute_name>data</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_COMPLEX_OBJECT">
<rm_type_name>HISTORY</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</occurrences>
<node_id>at0001</node_id>
<attributes xsi:type="C_MULTIPLE_ATTRIBUTE">
<rm_attribute_name>events</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_COMPLEX_OBJECT">
<rm_type_name>EVENT</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0</lower>
<upper>1</upper>
</occurrences>
<node_id>at0002</node_id>
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
<rm_attribute_name>data</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_COMPLEX_OBJECT">
<rm_type_name>ITEM_TREE</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</occurrences>
<node_id>at0003</node_id>
<attributes xsi:type="C_MULTIPLE_ATTRIBUTE">
<rm_attribute_name>items</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_COMPLEX_OBJECT">
<rm_type_name>ELEMENT</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0</lower>
<upper>1</upper>
</occurrences>
<node_id>at0004</node_id>
<attributes xsi:type="C_SINGLE_ATTRIBUTE">
<rm_attribute_name>value</rm_attribute_name>
<existence>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>0</lower>
<upper>1</upper>
</existence>
<children xsi:type="C_COMPLEX_OBJECT">
<rm_type_name>DV_TEXT</rm_type_name>
<occurrences>
<lower_included>true</lower_included>
<upper_included>true</upper_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>false</upper_unbounded>
<lower>1</lower>
<upper>1</upper>
</occurrences>
<node_id />
</children>
</attributes>
</children>
<cardinality>
<is_ordered>false</is_ordered>
<is_unique>false</is_unique>
<interval>
<lower_included>true</lower_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>true</upper_unbounded>
<lower>0</lower>
</interval>
</cardinality>
</attributes>
</children>
</attributes>
</children>
<cardinality>
<is_ordered>false</is_ordered>
<is_unique>false</is_unique>
<interval>
<lower_included>true</lower_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>true</upper_unbounded>
<lower>1</lower>
</interval>
</cardinality>
</attributes>
</children>
</attributes>
<archetype_id>
<value>openEHR-EHR-OBSERVATION.test_index_references.v1</value>
</archetype_id>
<term_definitions code="at0000">
<items id="description">*</items>
<items id="text">Test index references</items>
</term_definitions>
<term_definitions code="at0001">
<items id="description">*</items>
<items id="text">Events</items>
</term_definitions>
<term_definitions code="at0002">
<items id="description">*</items>
<items id="text">Event</items>
</term_definitions>
<term_definitions code="at0003">
<items id="description">*</items>
<items id="text">Tree</items>
</term_definitions>
<term_definitions code="at0004">
<items id="description">*</items>
<items id="text">text</items>
</term_definitions>
</children>
<cardinality>
<is_ordered>false</is_ordered>
<is_unique>false</is_unique>
<interval>
<lower_included>true</lower_included>
<lower_unbounded>false</lower_unbounded>
<upper_unbounded>true</upper_unbounded>
<lower>0</lower>
</interval>
</cardinality>
</attributes>
<archetype_id>
<value>openEHR-EHR-COMPOSITION.test_index_references.v1</value>
</archetype_id>
<template_id>
<value>Test index references EN</value>
</template_id>
<term_definitions code="at0000">
<items id="description">*</items>
<items id="text">Test index references</items>
</term_definitions>
</definition>
</template>
Loading

0 comments on commit 78848a2

Please sign in to comment.