Class: ODDB::AnalysisParse::TestAnonymousListParser

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/analysisparse/test/test_anonymous_list_parser.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



12
13
14
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 12

def setup
  @parser = AnonymousListParser.new
end

- (Object) test_fr_parse_line__1



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 215

def test_fr_parse_line__1
  src = "8485.00   45  Prostate, antig\303\250ne sp\303\251cifique (PSA)  ?  9800.20\n"
  begin
    result = @parser.parse_line(src)
  end
  expected =  {
    :code            =>  '8485.00',
    :group         =>  '8485',
    :position        =>  '00',
    :taxpoints     =>  45,
    :description   => 'Prostate, antigène spécifique (PSA)',
    :anonymousgroup  => '9800',
    :anonymouspos    =>  '20',
    :list_title      => nil,
    :permission      => nil,
    :taxpoint_type =>  nil,
  } 
  assert_equal(expected, result)
end

- (Object) test_fr_parse_line__2



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 237

def test_fr_parse_line__2
  src = "8810.09     20  D\303\251termination du sexe, utilisation\nlors de maladies h\303\251r\303\251ditaires li\303\251es\nau chromosome X..........................?  9800.10\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code              => '8810.09',
    :group           => '8810',
    :position          => '09',
    :taxpoints       => 20,
    :description     =>  'Détermination du sexe, utilisation lors de maladies héréditaires liées au chromosome X',
    :anonymousgroup    =>  '9800',
    :anonymouspos      => '10',
    :list_title        =>  nil,
    :permission        =>  nil,
    :taxpoint_type   => nil,
  }
  assert_equal(expected, result)
end

- (Object) test_fr_parse_line__3



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 261

def test_fr_parse_line__3
  src = "8810.13     50  Maladies d'h\303\251mostase; recherche\nd'une mutation ou d'un polymor-\nphisme li\303\251 lors d'h\303\251mophilies A et\nB, troubles du facteur II et du\nfacteur V.........................................?  9800.22\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code            =>  '8810.13',
    :group         =>  '8810',
    :position        =>  '13',
    :taxpoints     =>  50,
    :description   => 'Maladies d\'hémostase; recherche d\'une mutation ou d\'un polymorphisme lié lors d\'hémophilies A et B, troubles du facteur II et du facteur V',
    :anonymousgroup  => '9800',
    :anonymouspos    =>  '22',
    :list_title      => nil,
    :taxpoint_type =>  nil,
    :permission      => nil,
  }
  assert_equal(expected, result)
end

- (Object) test_fr_parse_line__4



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 287

def test_fr_parse_line__4
  src = "8810.23     50  Dystrophies musculaires; recherche\nd'une mutation ou d'un polymor-\nphisme li\303\251 lors de dystrophies de\nDuchenne et de Becker, troubles\ndes prot\303\251ines associ\303\251s \303\240 la dystro-\nphine dans d'autres types de dys-\ntrophies musculaires, dystrophie\nmusculaire facio-scapulo-hum\303\251ral  ?  9800.22\n\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code              => '8810.23',
    :group           => '8810',
    :position          => '23',
    :taxpoints       => 50,
    :description     =>  'Dystrophies musculaires; recherche d\'une mutation ou d\'un polymorphisme lié lors de dystrophies de Duchenne et de Becker, troubles des protéines associés à la dystrophine dans d\'autres types de dystrophies musculaires, dystrophie musculaire facio-scapulo-huméral',  
    :anonymousgroup    =>  '9800',
    :anonymouspos      => '22',
    :list_title        =>  nil,
    :taxpoint_type   => nil,
    :permission        =>  nil,
  }
  assert_equal(expected, result)
end

- (Object) test_fr_parse_line__5



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 317

def test_fr_parse_line__5
  src = "9116.07    60  HIV 1, test de confirmation des anti-\ncorps p24 + gp41 (par EIA), ql        ?  9800.24\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code            =>  '9116.07',
    :group         =>  '9116',
    :position        =>  '07',
    :taxpoints     =>  60,
    :description   => 'HIV 1, test de confirmation des anticorps p24 + gp41 (par EIA), ql',
    :anonymousgroup  => '9800',
    :anonymouspos    =>  '24',
    :list_title      => nil,
    :permission      => nil,
    :taxpoint_type =>  nil,
  }
  assert_equal(expected, result)
end

- (Object) test_fr_parse_page__1



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 340

def test_fr_parse_page__1
  src = "4.2  Positions anonymes\nR\303\251v. No pos. TP D\303\251nomination No anonyme\n\n8003.01  100 Cholin\303\251sterase, iso-enzymes de l'ac\303\251tyl~..........................................?  9800.30\n8017.00 45 Alpha-1-foetoprotein (AFP)..............?  9800.20\n8120.00 45 Beta-2- microglobuline.....................?  9800.20\n8140.00 50 CA 125.............................................?  9800.22\n8141.00 50 CA 15-3............................................?  9800.22\n8142.00 50 CA 19-9............................................?  9800.22\n8145.00 50 CA 72-4............................................?  9800.22\n8145.01 50 CYFRA 21-1.....................................?  9800.22\n8147.00 60 Calcitonine.......................................?  9800.24\n8152.00 45 Antig\303\250ne carcino-embryonnaire CEA ?  9800.20\n8194.00 25 Fibres \303\251lastiques apr\303\250s enrichisse-\nment (mat\303\251riel: lavage)..................?  9800.12\n8212.00 125 Estradiol, r\303\251cepteurs........................?  9800.34\n8238.00 20 Fluorures..........................................?  9800.10\n8345.00 12 Agglutinines froides, test de recherche.......................................?  9800.04\n8430.01 45 MCA (antig\303\250ne associ\303\251 au carcino-\nme de type mucine.........................?  9800.20\n8435.00 80 M\303\251thotrexate (sang).........................?  9800.28\n8461.01 70 Ph\303\251nytoine, libre, y compris dosage\nde la ph\303\251nytoine totale (sang)........?  9800.26\n8477.01 70 Primidone, y compris ph\303\251nobarbital\n(sang).............................................?  9800.26\n8480.00 125 Progest\303\251rone, r\303\251cepteurs.................?  9800.34\n8485.00 45 Prostate, antig\303\250ne sp\303\251cifique (PSA)  ?  9800.20\n8485.01 25 Prostate, antig\303\250ne sp\303\251cifique (PSA),\nlibre, uniquement en combinaison\navec un PSA total entre 3 et 10\n?g/l.................................................?  9800.12\n8531.00 50 Sqamous Cell Carcinoma (SCC)......?  9800.22\n8567.01 45 TPA (antig\303\250ne polypeptidique\ntissulaire)........................................?  9800.20\n8800.01  250 Culture cellulaire et pr\303\251paration\nchromosomique, caryotype\nconstitutionnel................................?  9800.44\n111\n"
  begin
    result = @parser.parse_page(src, 111)
  end
  expected_first = {
  :code             =>  '8003.01',
  :group            =>  '8003',
  :position         =>  '01',
  :description      => 'Cholinésterase, iso-enzymes de l\'acétyl~',
  :anonymouspos     =>  '30',
  :anonymousgroup   => '9800',
  :taxpoints        =>  100,
  :taxpoint_type    =>  nil,
  :list_title       => nil,
  :permission       => nil,
  }
  expected_last = {
  :code             =>  '8800.01',
  :group            =>  '8800',
  :position         =>  '01',
  :description      => 'Culture cellulaire et préparation chromosomique, caryotype constitutionnel',
  :anonymouspos     =>  '44',
  :anonymousgroup   => '9800',
  :taxpoints        =>  250,
  :taxpoint_type    =>  nil,
  :list_title       => nil,
  :permission       => nil,
  }
  assert_equal(expected_first, result.first)
  assert_equal(expected_last, result.last)
end

- (Object) test_parse_line__1



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 15

def test_parse_line__1
  src = "8531.00    50 Sqamous Cell Carcinoma (SCC).....?   9800.22\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code              => '8531.00',
    :group           => '8531',
    :position          => '00',
    :taxpoints       => 50,
    :description     =>  'Sqamous Cell Carcinoma (SCC)',
    :anonymousgroup    =>  '9800',
    :anonymouspos      => '22',
    :list_title        =>  nil,
    :permission        =>  nil,
    :taxpoint_type   => nil,
  }
  assert_equal(expected,result)
end

- (Object) test_parse_line__2



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 37

def test_parse_line__2
  src = "8804.00  50 Chromosomenuntersuchung, Zuschlag f\303\274r Ben\303\274tzung von zus\303\244tzlicher F\303\244rbung (G-,Q-,R- oder C-B\303\244nderung, Ag-NOR, hohe Aufl\303\266sung, andere), pro F\303\244rbung...?   9800.22\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code            =>  '8804.00',
    :group         =>  '8804',
    :position        =>  '00',
    :taxpoints     =>  50,
    :description   => 'Chromosomenuntersuchung, Zuschlag für Benützung von zusätzlicher Färbung (G-,Q-,R- oder C-Bänderung, Ag-NOR, hohe Auflösung, andere), pro Färbung',
    :anonymousgroup => '9800',
    :anonymouspos    =>  '22',
    :list_title      => nil,
    :permission      => nil,
    :taxpoint_type =>  nil,

  }
  assert_equal(expected, result)
end

- (Object) test_parse_line__3



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 60

def test_parse_line__3
  src ="8485.00  45 Prostata spezifisches Antigen (PSA) ?   9800.20\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code            =>  '8485.00',
    :group         =>  '8485',
    :position        =>  '00',
    :taxpoints     =>  45,
    :description   => 'Prostata spezifisches Antigen (PSA)',
    :anonymousgroup  => '9800',
    :anonymouspos    =>  '20',
    :list_title      => nil,
    :permission      => nil,
    :taxpoint_type =>  nil,
  }
  assert_equal(expected, result)
end

- (Object) test_parse_line__4



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 82

def test_parse_line__4
  src = "8806.00 300 In situ-Hybridisierung an Inter- phasekernen inkl. Pr\303\244paration und Analyse von 20 oder mehr Zellen..? 9800.48\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code            =>  '8806.00',
    :group         =>  '8806',
    :position        =>  '00',
    :taxpoints     =>  300,
    :description   => 'In situ-Hybridisierung an Interphasekernen inkl. Präparation und Analyse von 20 oder mehr Zellen',
    :anonymousgroup  => '9800',
    :anonymouspos    =>  '48',
    :list_title      => nil,
    :permission      => nil,
    :taxpoint_type =>  nil,
  }
  assert_equal(expected, result)
end

- (Object) test_parse_line__5



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 104

def test_parse_line__5
  src = "8477.01 70 Primidon, inkl. Phenobarbital (Blut). ? 9800.26\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code            =>  '8477.01',
    :group         =>  '8477',
    :position        =>  '01',
    :taxpoints     =>  70,
    :description   => 'Primidon, inkl. Phenobarbital (Blut)',
    :anonymousgroup  => '9800',
    :anonymouspos    =>  '26',
    :list_title      => nil,
    :permission      => nil,
    :taxpoint_type =>  nil,
  }
  assert_equal(expected, result)
end

- (Object) test_parse_line__6



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 126

def test_parse_line__6
  src = "8810.19 50 1. Krebserkrankungen, famili\303\244re\nPr\303\244disposition; direkte oder\nindirekte Mutationsanalyse bei\n- heredit\303\244rem Brust- oder\nOvarialkrebs-Syndrom, Gene\nBRCA1 und BRCA2\n- Polyposis coli oder attenuierter\nForm der Polyposis coli, Gen\nAPC\n- heredit\303\244rem Colon-Carcinom-\nSyndrom ohne Polyposis\n(hereditary non polypotic colon\ncancer HNPCC), Gene MLH1,\nMSH2, MSH6 und PMS2\n- Multiplen endokrinen Neoplasien ? 9800.22\n"
  begin
    result = @parser.parse_line(src)
  end
  expected = {
    :code              => '8810.19',
    :group           => '8810',
    :position          => '19',
    :taxpoints       => 50,
    :description     =>  '1. Krebserkrankungen, familiäre Prädisposition; direkte oder indirekte Mutationsanalyse bei
- hereditärem Brust- oder Ovarialkrebs-Syndrom, Gene BRCA1 und BRCA2
- Polyposis coli oder attenuierter Form der Polyposis coli, Gen APC
- hereditärem Colon-Carcinom-Syndrom ohne Polyposis (hereditary non polypotic colon cancer HNPCC), Gene MLH1, MSH2, MSH6 und PMS2
- Multiplen endokrinen Neoplasien',
    :anonymousgroup    =>  '9800',
    :anonymouspos      => '22',
    :list_title        =>  nil,
    :taxpoint_type   => nil,
    :permission        =>  nil,
  }
  assert_equal(expected, result)
end

- (Object) test_parse_page__1



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'ext/analysisparse/test/test_anonymous_list_parser.rb', line 166

def test_parse_page__1
  src = "Rev. Pos.-Nr. TP Bezeichnung Anonyme Nr.\n8800.04 100 Chromosomenuntersuchung, maligne H\303\244mopathien, Zuschlag f\303\274r Zelltrennung und Einfrieren......? 9800.30\n8801.00 400 Chromosomenuntersuchung,konstitutioneller Karyotyp..............? 9800.56\n8801.01 50 Chromosomenuntersuchung, konstitutioneller Karyotyp, Zuschlag f\303\274r \303\274ber 25 analysierte Zellen.............................................? 9800.22\n8801.02 100 Chromosomenuntersuchung, konstitutioneller Karyotyp, Zuschlag f\303\274r \303\274ber 50 analysierte Zellen.............................................? 9800.30\n8802.00 600 Chromosomenuntersuchung, maligne H\303\244mopathien, 10 karyo- typisierte Metaphasen oder 5 karyotypisierte Metaphasen und 15 analysierte Metaphasen...........? 9800.68\n8802.01 300 Chromosomenuntersuchung,maligne H\303\244mopathien, Zuschlag f\303\274r zus\303\244tzliche analysierte Zellen, 5 karyotypisierte Metaphasen oder 10 analysierte Metaphasen...........? 9800.48\n8802.02 150 Chromosomenuntersuchung, maligne H\303\244mopathien, Zuschlag f\303\274r komplexe Anomalien (\302\263 3 Anomalien)....................................? 9800.36\n8802.03 150 Chromosomenuntersuchung, maligne H\303\244mopathien, Zuschlag f\303\274r schwierige Analyse...................? 9800.36\n8804.00 50 Chromosomenuntersuchung, Zuschlag f\303\274r Ben\303\274tzung von zus\303\244tzlicher F\303\244rbung (G-,Q-,R- oder C-B\303\244nderung, Ag-NOR, hohe Aufl\303\266sung, andere), pro F\303\244rbung...? 9800.22\n8805.00 250 Chromosomenuntersuchung, Zuschlag f\303\274r in-situ Hybridisierung, pro Sonde......................................? 9800.44\n8806.00 300 In situ-Hybridisierung an Inter- phasekernen inkl. Pr\303\244paration und Analyse von 20 oder mehr Zellen..? 9800.48 112\n"
  begin
    result = @parser.parse_page(src,112)
  rescue AmbigousParseException => e
  end
  expected_first = {
    :code              => '8800.04',
    :group           => '8800',
    :position          => '04',
    :taxpoints       => 100,
    :description     =>  'Chromosomenuntersuchung, maligne Hämopathien, Zuschlag für Zelltrennung und Einfrieren',
    :anonymousgroup    =>  '9800',
    :anonymouspos      => '30',
    :list_title        =>  nil,
    :permission        =>  nil,
    :taxpoint_type   => nil,
  }
  expected_last = {
    :code              => '8806.00',
    :group           => '8806',
    :position          => '00',
    :taxpoints       => 300,
    :description     =>  'In situ-Hybridisierung an Interphasekernen inkl. Präparation und Analyse von 20 oder mehr Zellen',
    :anonymousgroup    =>  '9800',
    :anonymouspos      => '48',
    :list_title        =>  nil,
    :permission        =>  nil,
    :taxpoint_type   => nil,
  }
  expected_size = 11
  assert_equal(expected_first, result.first)
  assert_equal(expected_last, result.last)
  assert_equal(expected_size, result.size)
end