quby-compiler 0.4.10 → 0.4.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a76be7d6ec0fbd4f1fabe4beeacd159210a050fe62ab79b69198f472dfefd42
4
- data.tar.gz: 01a6a867ec3680ae24f49447000bd0d95dcb465cd1c9cba5fd71d66079c5c150
3
+ metadata.gz: f13fa5a2d4c4da7b41e4a32905226d0523709bac245a9d7cba3d28fd927d2b6a
4
+ data.tar.gz: 4e8f0dfab2c05e6166176f5ddb951e5f4e51962b9902e75ea3e8561e9cda3392
5
5
  SHA512:
6
- metadata.gz: 4a863660e2399ca7472cd1e2353c72444405fb8bd859da2c5b259097e77d0522493867ccd0b6b690a2c6c5000c65fc829ff4e85ac69f46a7b0ddd0dd960a756c
7
- data.tar.gz: b96591eb23810f2e66cbf1111e9232a691b3bf508efe8402cf3473e5201a734818c0f459b6fb959a6b54303c81f83e7c41019b8815a94fda7ac424410fb43c36
6
+ metadata.gz: fb6313ab623e76109aa94871bb192da9c95bbaa5809472b29bc88c2f7b61ebcb18b03b7433fe162209c33a1113aa7f359722c8927196d0d9b7ebf022e457e5b4
7
+ data.tar.gz: 3b3c6aeb7d590570defc880d3b1743ff64c1cb4c6227da2bb779c93057a7c1c249563f0e2366a1e6e13b6760fa90c010f66b57757159b24e0073af71403b6098
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # 0.4.13
2
+
3
+ * quby2.json:
4
+ * string-questions: Don't pass a size of 30, when no size had been specified
5
+ * rename date type to date_parts, switch to use `date_parts: [{part: year, key: 'yyyy'}, ..]`
6
+
7
+ # 0.4.12
8
+
9
+ * roqua.json: Add questionnaire license
10
+ * roqua.json: Add `unchecks_all_others` for radio/checkbox question options
11
+
12
+ # 0.4.11
13
+
14
+ * roqua.json: Baseline for a chart now always exports as a hash of gender/age => value
15
+
1
16
  # 0.4.10
2
17
 
3
18
  * quby2.json: Fix validations json (regex-serialization and key-capitalization)
@@ -24,7 +24,8 @@ module Quby
24
24
  def initialize(key, options = {})
25
25
  super
26
26
 
27
- @components = options[:components] || DEFAULT_COMPONENTS
27
+ # only possible order we support.
28
+ @components = options[:components] ? POSSIBLE_COMPONENTS & options[:components] : DEFAULT_COMPONENTS
28
29
  @required_components = options[:required_components] || @components
29
30
  @optional_components = @components - @required_components
30
31
 
@@ -39,7 +40,8 @@ module Quby
39
40
  def add_date_validation(explanation)
40
41
  @validations << {type: :valid_date,
41
42
  subtype: :"valid_date_#{components.sort.join('_')}",
42
- explanation: explanation}
43
+ explanation: explanation,
44
+ requiredParts: required_components}
43
45
  end
44
46
 
45
47
  def claimed_keys
@@ -60,10 +62,16 @@ module Quby
60
62
  end
61
63
 
62
64
  def as_json(options = {})
63
- component_keys = components.each_with_object({}) do |component, hash|
64
- hash["#{component}Key"] = send("#{component}_key")
65
- end
66
- super.merge(components: components).merge(component_keys)
65
+ super.merge(
66
+ type: 'date_parts',
67
+ as: 'date_parts',
68
+ dateParts: components.map { |component|
69
+ {
70
+ part: component,
71
+ key: send("#{component}_key")
72
+ }
73
+ }
74
+ )
67
75
  end
68
76
  end
69
77
  end
@@ -6,7 +6,7 @@ module Quby
6
6
  module Questions
7
7
  class StringQuestion < Question
8
8
  def as_json(options = {})
9
- super.merge(autocomplete: @autocomplete, size: @size || 30)
9
+ super.merge(autocomplete: @autocomplete, size: @size)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Quby
6
6
  module Questions
7
7
  class TextQuestion < Question
8
8
  def as_json(options = {})
9
- super.merge(autocomplete: @autocomplete, lines: lines, cols: cols)
9
+ super.merge(autocomplete: @autocomplete, lines: lines)
10
10
  end
11
11
  end
12
12
  end
@@ -36,6 +36,8 @@ module Quby
36
36
  outcome_tables_schema: outcome_tables_schema,
37
37
  questions: questions,
38
38
  scores: scores,
39
+ license: questionnaire.license,
40
+ licensor: questionnaire.licensor,
39
41
  }
40
42
  end
41
43
 
@@ -60,9 +62,8 @@ module Quby
60
62
  case chart
61
63
  when Quby::Compiler::Entities::Charting::LineChart
62
64
  {
63
- y_label: chart.y_label,
64
65
  tonality: chart.tonality,
65
- baseline: YAML.dump(chart.baseline),
66
+ baseline: chart_baseline(chart.baseline),
66
67
  clinically_relevant_change: chart.clinically_relevant_change,
67
68
  }
68
69
  when Quby::Compiler::Entities::Charting::OverviewChart
@@ -89,6 +90,17 @@ module Quby
89
90
  }
90
91
  end
91
92
 
93
+ def chart_baseline(baseline)
94
+ case baseline
95
+ when nil
96
+ nil
97
+ when Float, Integer
98
+ {default: {default: baseline}}
99
+ when Hash
100
+ baseline
101
+ end
102
+ end
103
+
92
104
  # configuration for outcome tables.
93
105
  # tables:
94
106
  # <outcome_table_name:Symbol>: # each entry is a table.
@@ -220,7 +232,8 @@ module Quby
220
232
  key: option.key,
221
233
  value: (option.value.to_s unless question.type == :check_box),
222
234
  description: option.context_free_description || parse_markdown_and_strip_tags(option.description),
223
- child_question_keys: option.questions.map(&:key).presence
235
+ child_question_keys: option.questions.map(&:key).presence,
236
+ unchecks_all_others: question.try(:uncheck_all_option) && question.uncheck_all_option == option.key
224
237
  }.compact
225
238
  }
226
239
  end
@@ -137,14 +137,14 @@ module Quby
137
137
  unknown_questions = flag.shows_questions.select { |key| !questionnaire.key_in_use?(key) }
138
138
  return if unknown_questions.blank?
139
139
 
140
- fail ArgumentError, "Flag '#{key}' has unknown shows_questions keys #{unknown_questions}"
140
+ fail ArgumentError, "Flag '#{flag.key}' has unknown shows_questions keys #{unknown_questions}"
141
141
  end
142
142
 
143
143
  def validate_flag_hides(questionnaire, flag)
144
144
  unknown_questions = flag.hides_questions.select { |key| !questionnaire.key_in_use?(key) }
145
145
  return if unknown_questions.blank?
146
146
 
147
- fail ArgumentError, "Flag '#{key}' has unknown hides_questions keys #{unknown_questions}"
147
+ fail ArgumentError, "Flag '#{flag.key}' has unknown hides_questions keys #{unknown_questions}"
148
148
  end
149
149
 
150
150
  def validate_flag_depends_on(questionnaire, flag)
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.4.10"
3
+ VERSION = "0.4.13"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quby-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-18 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.1.4
262
+ rubygems_version: 3.3.22
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: Quby::Compiler compiles a DSL for questionnaires to JSON