quby-compiler 0.4.13 → 0.4.14

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: 864809e71abc58743617937e4cd9967afa23b80958a5c7fef3c7265d77404d08
4
+ data.tar.gz: b3abb8c5572b12ac98b0f8fb81258cbf621adc20c00f978d24f8251533c8279d
5
5
  SHA512:
6
- metadata.gz: fb6313ab623e76109aa94871bb192da9c95bbaa5809472b29bc88c2f7b61ebcb18b03b7433fe162209c33a1113aa7f359722c8927196d0d9b7ebf022e457e5b4
7
- data.tar.gz: 3b3c6aeb7d590570defc880d3b1743ff64c1cb4c6227da2bb779c93057a7c1c249563f0e2366a1e6e13b6760fa90c010f66b57757159b24e0073af71403b6098
6
+ metadata.gz: dd7c67aa581503fcc3451d2a62e182e22c3bbb38f27f61c7347dd4a2a743e47b524c5b667acdf36293225da1807ad439a10ef172eede13da526de71c6dc319cb
7
+ data.tar.gz: eedc2ae95790da8039f2f1b56c2526b710db523fe4eff4d47345a405c907331146852e5c8d526a9343577d4aaf261fd8d0f3843afffa89b20208f51897e6287c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.4.14
2
+
3
+ * DSL: Add `hide_pii_from_researchers` and `hide_values_from_professionals`
4
+ * roqua.json: Add anonymous_conditions
5
+
1
6
  # 0.4.13
2
7
 
3
8
  * 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
@@ -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.14"
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.14
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-09-21 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
@@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
260
  - !ruby/object:Gem::Version
260
261
  version: '0'
261
262
  requirements: []
262
- rubygems_version: 3.3.22
263
+ rubygems_version: 3.1.4
263
264
  signing_key:
264
265
  specification_version: 4
265
266
  summary: Quby::Compiler compiles a DSL for questionnaires to JSON