ooze-parser 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/LICENSE +21 -0
  4. data/lib/ooz/base/evolution.rb +9 -0
  5. data/lib/ooz/base/field/checklist/item.rb +12 -0
  6. data/lib/ooz/base/field/checklist.rb +22 -0
  7. data/lib/ooz/base/field/cross_reference.rb +10 -0
  8. data/lib/ooz/base/field/date.rb +11 -0
  9. data/lib/ooz/base/field/file/file.rb +11 -0
  10. data/lib/ooz/base/field/file.rb +21 -0
  11. data/lib/ooz/base/field/gauge/stop.rb +12 -0
  12. data/lib/ooz/base/field/gauge.rb +22 -0
  13. data/lib/ooz/base/field/image_gallery/image.rb +14 -0
  14. data/lib/ooz/base/field/image_gallery.rb +22 -0
  15. data/lib/ooz/base/field/number.rb +9 -0
  16. data/lib/ooz/base/field/people.rb +11 -0
  17. data/lib/ooz/base/field/plain_text.rb +9 -0
  18. data/lib/ooz/base/field/rich_text.rb +9 -0
  19. data/lib/ooz/base/field/select/option.rb +12 -0
  20. data/lib/ooz/base/field/select.rb +22 -0
  21. data/lib/ooz/base/field/tag_field.rb +9 -0
  22. data/lib/ooz/base/field/undefined.rb +8 -0
  23. data/lib/ooz/base/field.rb +24 -0
  24. data/lib/ooz/base/field_factory.rb +9 -0
  25. data/lib/ooz/base/force/binding.rb +10 -0
  26. data/lib/ooz/base/force.rb +20 -0
  27. data/lib/ooz/base/model.rb +37 -0
  28. data/lib/ooz/base/model_factory.rb +49 -0
  29. data/lib/ooz/base/ooze.rb +30 -0
  30. data/lib/ooz/base/section.rb +10 -0
  31. data/lib/ooz/base/stage/task/action/escalate.rb +12 -0
  32. data/lib/ooz/base/stage/task/action/reminder.rb +12 -0
  33. data/lib/ooz/base/stage/task/action/tag.rb +13 -0
  34. data/lib/ooz/base/stage/task/action.rb +27 -0
  35. data/lib/ooz/base/stage/task/action_factory.rb +12 -0
  36. data/lib/ooz/base/stage/task/completion.rb +10 -0
  37. data/lib/ooz/base/stage/task/priority.rb +11 -0
  38. data/lib/ooz/base/stage/task/review.rb +11 -0
  39. data/lib/ooz/base/stage/task/scheduled_callback.rb +14 -0
  40. data/lib/ooz/base/stage/task/strategy/direct.rb +13 -0
  41. data/lib/ooz/base/stage/task/strategy/editable.rb +13 -0
  42. data/lib/ooz/base/stage/task/strategy/prior.rb +13 -0
  43. data/lib/ooz/base/stage/task/strategy/prior_supervisor.rb +13 -0
  44. data/lib/ooz/base/stage/task/strategy/scheduler.rb +14 -0
  45. data/lib/ooz/base/stage/task/strategy/supervisor.rb +12 -0
  46. data/lib/ooz/base/stage/task/strategy.rb +21 -0
  47. data/lib/ooz/base/stage/task/strategy_factory.rb +12 -0
  48. data/lib/ooz/base/stage/task.rb +33 -0
  49. data/lib/ooz/base/stage.rb +28 -0
  50. data/lib/ooz/base.rb +14 -0
  51. data/lib/ooz/common/base_class.rb +63 -0
  52. data/lib/ooz/common/base_factory.rb +9 -0
  53. data/lib/ooz/common/base_model.rb +59 -0
  54. data/lib/ooz/common/hash_diff.rb +36 -0
  55. data/lib/ooz/common.rb +9 -0
  56. data/lib/ooz/model/evolution.rb +12 -0
  57. data/lib/ooz/model/field/checklist/item.rb +13 -0
  58. data/lib/ooz/model/field/checklist.rb +21 -0
  59. data/lib/ooz/model/field/cross_reference.rb +9 -0
  60. data/lib/ooz/model/field/date.rb +9 -0
  61. data/lib/ooz/model/field/file/file.rb +13 -0
  62. data/lib/ooz/model/field/file.rb +21 -0
  63. data/lib/ooz/model/field/gauge/stop.rb +13 -0
  64. data/lib/ooz/model/field/gauge.rb +21 -0
  65. data/lib/ooz/model/field/image_gallery/image.rb +13 -0
  66. data/lib/ooz/model/field/image_gallery.rb +21 -0
  67. data/lib/ooz/model/field/number.rb +9 -0
  68. data/lib/ooz/model/field/people.rb +9 -0
  69. data/lib/ooz/model/field/plain_text.rb +9 -0
  70. data/lib/ooz/model/field/rich_text.rb +9 -0
  71. data/lib/ooz/model/field/select/option.rb +13 -0
  72. data/lib/ooz/model/field/select.rb +21 -0
  73. data/lib/ooz/model/field/tag_field.rb +9 -0
  74. data/lib/ooz/model/field/undefined.rb +9 -0
  75. data/lib/ooz/model/field.rb +42 -0
  76. data/lib/ooz/model/field_factory.rb +7 -0
  77. data/lib/ooz/model/force/binding.rb +16 -0
  78. data/lib/ooz/model/force.rb +16 -0
  79. data/lib/ooz/model/ooze.rb +72 -0
  80. data/lib/ooz/model/section.rb +31 -0
  81. data/lib/ooz/model/stage.rb +18 -0
  82. data/lib/ooz/model.rb +12 -0
  83. data/lib/ooz/version.rb +3 -0
  84. data/lib/ooze-parser.rb +8 -0
  85. data/ooze-parser.gemspec +26 -0
  86. metadata +148 -0
@@ -0,0 +1,42 @@
1
+ module Ooz
2
+ module Model
3
+ class Field < Base::Field
4
+ module Methods
5
+ def self.included(base)
6
+ base.send(:include, InstanceMethods)
7
+ end
8
+
9
+ module InstanceMethods
10
+ def bindings
11
+ ooze.bindings_by_field[_id] || []
12
+ end
13
+
14
+ def section
15
+ ooze.sections_by_field[_id]
16
+ end
17
+
18
+ def stages
19
+ section.stages
20
+ end
21
+ end
22
+ end
23
+
24
+ include Methods
25
+
26
+ end
27
+ end
28
+ end
29
+
30
+ require_relative "field/undefined"
31
+ require_relative "field/select"
32
+ require_relative "field/date"
33
+ require_relative "field/plain_text"
34
+ require_relative "field/rich_text"
35
+ require_relative "field/number"
36
+ require_relative "field/gauge"
37
+ require_relative "field/people"
38
+ require_relative "field/tag_field"
39
+ require_relative "field/cross_reference"
40
+ require_relative "field/file"
41
+ require_relative "field/image_gallery"
42
+ require_relative "field/checklist"
@@ -0,0 +1,7 @@
1
+ module Ooz
2
+ module Model
3
+ class FieldFactory < Base::FieldFactory
4
+ def_parent_class Model::Field
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ module Ooz
2
+ module Model
3
+ class Force
4
+ class Binding < Base::Force::Binding
5
+ def force
6
+ root
7
+ end
8
+
9
+ def field
10
+ ooze.fields_hash(reference_id)
11
+ end
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Ooz
2
+ module Model
3
+ class Force < Base::Force
4
+ end
5
+ end
6
+ end
7
+
8
+ require_relative "force/binding"
9
+
10
+ module Ooz
11
+ module Model
12
+ class Force
13
+ overridable_const :binding_class, Model::Force::Binding
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,72 @@
1
+ module Ooz
2
+ module Model
3
+ class Ooze < Base::Ooze
4
+ overridable_const :evolution_class, Model::Evolution
5
+ overridable_const :section_class, Model::Section
6
+ overridable_const :field_factory_class, Model::FieldFactory
7
+ overridable_const :force_class, Model::Force
8
+
9
+ def stages?
10
+ evolution && evolution.stages&.length > 0
11
+ end
12
+
13
+ def stages
14
+ return [] if !stages?
15
+ evolution.stages
16
+ end
17
+
18
+ def stages_hash
19
+ to_hash(stages)
20
+ end
21
+
22
+ def stages_by_section
23
+ stages.map do |stg|
24
+ stg.flow_node_ids.map do |id|
25
+ [id, stg]
26
+ end
27
+ end.flatten(1).group_by do |pair|
28
+ pair.first
29
+ end.transform_values do |arr_pairs|
30
+ arr_pairs.map {|pair| pair.last}
31
+ end
32
+ end
33
+
34
+ def fields
35
+ membranes
36
+ end
37
+
38
+ def fields_hash
39
+ to_hash(fields)
40
+ end
41
+
42
+ def sections
43
+ flow_nodes
44
+ end
45
+
46
+ def sections_hash
47
+ to_hash(sections)
48
+ end
49
+
50
+ def sections_by_field
51
+ sections.map do |sec|
52
+ sec.field_ids.map do |id|
53
+ [id, sec]
54
+ end
55
+ end.flatten(1).to_h
56
+ end
57
+
58
+ def bindings
59
+ forces.reduce([]) do |binds, f|
60
+ binds + f.bindings
61
+ end
62
+ end
63
+
64
+ def bindings_by_field
65
+ bindings.group_by do |b|
66
+ b.reference_id
67
+ end
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,31 @@
1
+ module Ooz
2
+ module Model
3
+ class Section < Base::Section
4
+
5
+ def stages
6
+ ooze.stages_by_section[_id] || []
7
+ end
8
+
9
+ def orphan?
10
+ ooze.stages? && stages.empty?
11
+ end
12
+
13
+ def split?
14
+ _type == "Enzyme::Flow::SplitNode"
15
+ end
16
+
17
+ def compact?
18
+ !split?
19
+ end
20
+
21
+ def field_ids
22
+ split? ? (left_membrane_ids || []) + (right_membrane_ids || []) : membrane_ids
23
+ end
24
+
25
+ def fields
26
+ collect_from(field_ids, ooze.fields_hash)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,18 @@
1
+ module Ooz
2
+ module Model
3
+ class Stage < Base::Stage
4
+ overridable_const :task_completion_class, Model::Stage::Task::Completion
5
+ overridable_const :task_review_class, Model::Stage::Task::Review
6
+
7
+ def sections?
8
+ flow_node_ids && flow_node_ids.length > 0
9
+ end
10
+
11
+ def sections
12
+ return [] if !sections?
13
+ collect_from(flow_node_ids, ooze.sections_hash)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
data/lib/ooz/model.rb ADDED
@@ -0,0 +1,12 @@
1
+ module Ooz
2
+ module Model
3
+ end
4
+ end
5
+
6
+ require_relative 'model/field'
7
+ require_relative 'model/field_factory'
8
+ require_relative 'model/section'
9
+ require_relative 'model/stage'
10
+ require_relative 'model/evolution'
11
+ require_relative 'model/force'
12
+ require_relative 'model/ooze'
@@ -0,0 +1,3 @@
1
+ module Ooz
2
+ VERSION = "0.1.7"
3
+ end
@@ -0,0 +1,8 @@
1
+ require 'json'
2
+
3
+ module Ooz
4
+ end
5
+
6
+ require_relative 'ooz/common'
7
+ require_relative 'ooz/base'
8
+ require_relative 'ooz/model'
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require "./lib/ooz/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "ooze-parser"
8
+ s.version = Ooz::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Oscar Segura"]
11
+ s.email = ["oscar@ecoportal.co.nz"]
12
+ s.date = %q{2018-11-24}
13
+ s.summary = %q{ooze-parser to boost data integration and treatment}
14
+ s.homepage = "https://www.ecoportal.com"
15
+ s.licenses = %w[MIT]
16
+
17
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+
21
+ #s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ #s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
+ s.require_paths = ["lib"]
24
+
25
+ s.add_development_dependency "rspec", "~> 3", ">= 3.8"
26
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ooze-parser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ platform: ruby
6
+ authors:
7
+ - Oscar Segura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: '3.8'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '3.8'
33
+ description:
34
+ email:
35
+ - oscar@ecoportal.co.nz
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".gitignore"
41
+ - LICENSE
42
+ - lib/ooz/base.rb
43
+ - lib/ooz/base/evolution.rb
44
+ - lib/ooz/base/field.rb
45
+ - lib/ooz/base/field/checklist.rb
46
+ - lib/ooz/base/field/checklist/item.rb
47
+ - lib/ooz/base/field/cross_reference.rb
48
+ - lib/ooz/base/field/date.rb
49
+ - lib/ooz/base/field/file.rb
50
+ - lib/ooz/base/field/file/file.rb
51
+ - lib/ooz/base/field/gauge.rb
52
+ - lib/ooz/base/field/gauge/stop.rb
53
+ - lib/ooz/base/field/image_gallery.rb
54
+ - lib/ooz/base/field/image_gallery/image.rb
55
+ - lib/ooz/base/field/number.rb
56
+ - lib/ooz/base/field/people.rb
57
+ - lib/ooz/base/field/plain_text.rb
58
+ - lib/ooz/base/field/rich_text.rb
59
+ - lib/ooz/base/field/select.rb
60
+ - lib/ooz/base/field/select/option.rb
61
+ - lib/ooz/base/field/tag_field.rb
62
+ - lib/ooz/base/field/undefined.rb
63
+ - lib/ooz/base/field_factory.rb
64
+ - lib/ooz/base/force.rb
65
+ - lib/ooz/base/force/binding.rb
66
+ - lib/ooz/base/model.rb
67
+ - lib/ooz/base/model_factory.rb
68
+ - lib/ooz/base/ooze.rb
69
+ - lib/ooz/base/section.rb
70
+ - lib/ooz/base/stage.rb
71
+ - lib/ooz/base/stage/task.rb
72
+ - lib/ooz/base/stage/task/action.rb
73
+ - lib/ooz/base/stage/task/action/escalate.rb
74
+ - lib/ooz/base/stage/task/action/reminder.rb
75
+ - lib/ooz/base/stage/task/action/tag.rb
76
+ - lib/ooz/base/stage/task/action_factory.rb
77
+ - lib/ooz/base/stage/task/completion.rb
78
+ - lib/ooz/base/stage/task/priority.rb
79
+ - lib/ooz/base/stage/task/review.rb
80
+ - lib/ooz/base/stage/task/scheduled_callback.rb
81
+ - lib/ooz/base/stage/task/strategy.rb
82
+ - lib/ooz/base/stage/task/strategy/direct.rb
83
+ - lib/ooz/base/stage/task/strategy/editable.rb
84
+ - lib/ooz/base/stage/task/strategy/prior.rb
85
+ - lib/ooz/base/stage/task/strategy/prior_supervisor.rb
86
+ - lib/ooz/base/stage/task/strategy/scheduler.rb
87
+ - lib/ooz/base/stage/task/strategy/supervisor.rb
88
+ - lib/ooz/base/stage/task/strategy_factory.rb
89
+ - lib/ooz/common.rb
90
+ - lib/ooz/common/base_class.rb
91
+ - lib/ooz/common/base_factory.rb
92
+ - lib/ooz/common/base_model.rb
93
+ - lib/ooz/common/hash_diff.rb
94
+ - lib/ooz/model.rb
95
+ - lib/ooz/model/evolution.rb
96
+ - lib/ooz/model/field.rb
97
+ - lib/ooz/model/field/checklist.rb
98
+ - lib/ooz/model/field/checklist/item.rb
99
+ - lib/ooz/model/field/cross_reference.rb
100
+ - lib/ooz/model/field/date.rb
101
+ - lib/ooz/model/field/file.rb
102
+ - lib/ooz/model/field/file/file.rb
103
+ - lib/ooz/model/field/gauge.rb
104
+ - lib/ooz/model/field/gauge/stop.rb
105
+ - lib/ooz/model/field/image_gallery.rb
106
+ - lib/ooz/model/field/image_gallery/image.rb
107
+ - lib/ooz/model/field/number.rb
108
+ - lib/ooz/model/field/people.rb
109
+ - lib/ooz/model/field/plain_text.rb
110
+ - lib/ooz/model/field/rich_text.rb
111
+ - lib/ooz/model/field/select.rb
112
+ - lib/ooz/model/field/select/option.rb
113
+ - lib/ooz/model/field/tag_field.rb
114
+ - lib/ooz/model/field/undefined.rb
115
+ - lib/ooz/model/field_factory.rb
116
+ - lib/ooz/model/force.rb
117
+ - lib/ooz/model/force/binding.rb
118
+ - lib/ooz/model/ooze.rb
119
+ - lib/ooz/model/section.rb
120
+ - lib/ooz/model/stage.rb
121
+ - lib/ooz/version.rb
122
+ - lib/ooze-parser.rb
123
+ - ooze-parser.gemspec
124
+ homepage: https://www.ecoportal.com
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.6.14.1
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: ooze-parser to boost data integration and treatment
148
+ test_files: []