File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ module BelongsToProgramme
1515
1616 if disease_types . present?
1717 enum_values = disease_types . map { |dt | Vaccine . disease_types [ dt ] }
18- query . where ( "disease_types && ARRAY[?]::integer[]" , enum_values )
18+ query . where (
19+ "array_sort(disease_types) = ARRAY[?]::integer[]" ,
20+ enum_values . sort
21+ )
1922 else
2023 query
2124 end
Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ class Programme
88 TYPES_SUPPORTING_DELEGATION = %w[ flu ] . freeze
99 MIN_MMRV_ELIGIBILITY_DATE = Date . new ( 2020 , 1 , 1 ) . freeze
1010
11+ DISEASE_TYPES = {
12+ "flu" => %w[ influenza ] ,
13+ "hpv" => %w[ human_papillomavirus ] ,
14+ "mmr" => %w[ measles mumps rubella ] ,
15+ "td_ipv" => %w[ tetanus diphtheria polio ] ,
16+ "menacwy" => %w[ meningitis_a meningitis_c meningitis_w meningitis_y ]
17+ } . freeze
18+
1119 attr_accessor :type
1220
1321 def initialize ( type :)
@@ -118,7 +126,7 @@ def is_catch_up?(year_group:)
118126 end
119127
120128 def vaccines
121- @vaccines ||= Vaccine . where_programme ( self )
129+ @vaccines ||= Vaccine . where_programme ( self , DISEASE_TYPES [ type ] )
122130 end
123131
124132 def vaccine_methods
Original file line number Diff line number Diff line change 33class ProgrammeVariant < SimpleDelegator
44 attr_reader :variant_type
55
6- DISTINGUISHING_DISEASE_TYPES = {
7- "mmrv" => [ "varicella" ] # MMR + Varicella = MMRV
8- } . freeze
6+ DISEASE_TYPES = { "mmrv" => %w[ measles mumps rubella varicella ] } . freeze
97
108 SNOMED_PROCEDURE_TERMS = { "mmrv" => "TBC" } . freeze
119
@@ -25,8 +23,7 @@ def name_in_sentence
2523 end
2624
2725 def vaccines
28- @vaccines ||=
29- Vaccine . where_programme ( self , DISTINGUISHING_DISEASE_TYPES [ variant_type ] )
26+ @vaccines ||= Vaccine . where_programme ( self , DISEASE_TYPES [ variant_type ] )
3027 end
3128
3229 def snomed_procedure_term
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ vaxpro:
186186
187187# MMRV
188188
189- pro_quad :
189+ pro_quad :
190190 type : mmr
191191 brand : ProQuad
192192 method : injection
Original file line number Diff line number Diff line change @@ -349,8 +349,6 @@ def create_menacwy_health_questions(vaccine)
349349end
350350
351351def create_mmr_health_questions ( vaccine )
352- Flipper . enable ( :mmrv )
353-
354352 bleeding =
355353 vaccine . health_questions . create! (
356354 title : "Does your child have a bleeding disorder?"
Original file line number Diff line number Diff line change 3434 transient { programme { nil } }
3535
3636 programme_type { programme &.type || Programme ::TYPES . sample }
37-
37+ disease_types { Programme :: DISEASE_TYPES [ programme_type ] }
3838 brand { Faker ::Commerce . product_name }
3939 manufacturer { Faker ::Company . name }
4040 sequence ( :nivs_name ) { |n | "#{ brand . parameterize } -#{ n } " }
You can’t perform that action at this time.
0 commit comments