quby-compiler 0.4.13 → 0.4.15

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: f13fa5a2d4c4da7b41e4a32905226d0523709bac245a9d7cba3d28fd927d2b6a
4
- data.tar.gz: 4e8f0dfab2c05e6166176f5ddb951e5f4e51962b9902e75ea3e8561e9cda3392
3
+ metadata.gz: dc2baf7860d3a8c906f3e3cafef35525bdad0e02ed5fc78848061e9ed4ffe7cc
4
+ data.tar.gz: 9d53e98b35d034369731244fac42869ab7e90c06e30696e11f673e749ee8195f
5
5
  SHA512:
6
- metadata.gz: fb6313ab623e76109aa94871bb192da9c95bbaa5809472b29bc88c2f7b61ebcb18b03b7433fe162209c33a1113aa7f359722c8927196d0d9b7ebf022e457e5b4
7
- data.tar.gz: 3b3c6aeb7d590570defc880d3b1743ff64c1cb4c6227da2bb779c93057a7c1c249563f0e2366a1e6e13b6760fa90c010f66b57757159b24e0073af71403b6098
6
+ metadata.gz: c89d1de0be9a9d7959d072f1e473ae597ff3c00b90da846dff1c1c9da03492988f289687d8f800fd40be7895cf720c857d95f50efcaa09f7d3dbb6af5e87ff2e
7
+ data.tar.gz: 9d95cd492d5ef6fb4ebaafa242d9855d71fe7fbc9f8c0f89e30a76b341636b8cbcc57f5ffaa8de8a11c10ebcfe6544b2e23b3ffade8179433a3ad95a83624628
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.4.15
2
+
3
+ * quby2.json: Question#size is now always an integer/nil
4
+
5
+ # 0.4.14
6
+
7
+ * DSL: Add `hide_pii_from_researchers` and `hide_values_from_professionals`
8
+ * roqua.json: Add anonymous_conditions
9
+
1
10
  # 0.4.13
2
11
 
3
12
  * quby2.json:
data/exe/quby-compile CHANGED
@@ -40,7 +40,7 @@ paths.each do |path|
40
40
  definition = Quby::Compiler.validate(key, sourcecode, lookup_tables: lookup_tables)
41
41
  if definition.errors.any?
42
42
  error = definition.errors[:sourcecode].first
43
- STDERR.puts error[:message], error[:backtrace], ''
43
+ STDERR.puts(error)
44
44
  validation_errors_found = true
45
45
  next # let's not create new output files for questionnaires with errors
46
46
  end
@@ -147,6 +147,14 @@ module Quby
147
147
  @questionnaire.default_answer_value = value
148
148
  end
149
149
 
150
+ def hide_pii_from_researchers(value)
151
+ @questionnaire.anonymous_conditions = @questionnaire.anonymous_conditions.new(hide_pii_from_researchers: value)
152
+ end
153
+
154
+ def hide_values_from_professionals(value)
155
+ @questionnaire.anonymous_conditions = @questionnaire.anonymous_conditions.new(hide_values_from_professionals: value)
156
+ end
157
+
150
158
  def panel(title = nil, options = {}, &block)
151
159
  panel = PanelBuilder.build(title, **options, **default_panel_options, &block)
152
160
  @questionnaire.add_panel(panel)
@@ -0,0 +1,23 @@
1
+ module Quby
2
+ module Compiler
3
+ module Entities
4
+ class AnonymousConditions < Dry::Struct
5
+ class ConstantRule < Dry::Struct
6
+ attribute :type, Types::String.constrained(eql: "constant")
7
+ attribute :value, Types::Bool
8
+ end
9
+
10
+ class BasedOnValueRule < Dry::Struct
11
+ attribute :type, Types::String.constrained(eql: "based_on_value")
12
+ attribute :question_key, Types::String
13
+ attribute :question_value, Types::String
14
+ end
15
+
16
+ Rule = ConstantRule | BasedOnValueRule
17
+
18
+ attribute? :hide_pii_from_researchers, Rule.optional
19
+ attribute? :hide_values_from_professionals, Rule.optional
20
+ end
21
+ end
22
+ end
23
+ end
@@ -240,7 +240,7 @@ module Quby
240
240
  title: Quby::MarkdownParser.new(title).to_html,
241
241
  description: Quby::MarkdownParser.new(description).to_html,
242
242
  type: type,
243
- size: size,
243
+ size: size.presence && Integer(size), # 2022-11: 4k string and 7k integer
244
244
  hidden: hidden?,
245
245
  displayModes: display_modes,
246
246
  defaultInvisible: default_invisible,
@@ -53,6 +53,7 @@ module Quby
53
53
  @lookup_tables = {}
54
54
  @versions = []
55
55
  @seeds_patch = {}
56
+ @anonymous_conditions = Entities::AnonymousConditions.new
56
57
  end
57
58
 
58
59
  attr_accessor :key
@@ -100,6 +101,7 @@ module Quby
100
101
  attr_accessor :outcome_tables
101
102
  attr_accessor :score_schemas
102
103
  attr_accessor :lookup_tables
104
+ attr_accessor :anonymous_conditions
103
105
 
104
106
  delegate :question_hash, :input_keys, :answer_keys, :expand_input_keys, to: :fields
105
107
 
@@ -7,6 +7,7 @@ require 'quby/compiler/entities/version'
7
7
  require 'quby/compiler/entities/question_option'
8
8
  require 'quby/compiler/entities/item'
9
9
  require 'quby/compiler/entities/score_calculation'
10
+ require 'quby/compiler/entities/anonymous_conditions'
10
11
 
11
12
  require 'quby/compiler/entities/subscore_schema'
12
13
  require 'quby/compiler/entities/score_schema'
@@ -36,6 +36,7 @@ module Quby
36
36
  outcome_tables_schema: outcome_tables_schema,
37
37
  questions: questions,
38
38
  scores: scores,
39
+ anonymous_conditions: questionnaire.anonymous_conditions,
39
40
  license: questionnaire.license,
40
41
  licensor: questionnaire.licensor,
41
42
  }
@@ -271,6 +272,7 @@ module Quby
271
272
  end \
272
273
  .text
273
274
  .gsub(/\s+/, ' ')
275
+ .strip
274
276
  .presence
275
277
  end
276
278
  end
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.4.13"
3
+ VERSION = "0.4.15"
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.13
4
+ version: 0.4.15
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-09-13 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -186,6 +186,7 @@ files:
186
186
  - lib/quby/compiler/dsl/standardized_panel_generators.rb
187
187
  - lib/quby/compiler/dsl/table_builder.rb
188
188
  - lib/quby/compiler/entities.rb
189
+ - lib/quby/compiler/entities/anonymous_conditions.rb
189
190
  - lib/quby/compiler/entities/charting/bar_chart.rb
190
191
  - lib/quby/compiler/entities/charting/chart.rb
191
192
  - lib/quby/compiler/entities/charting/charts.rb