Changeset 258


Ignore:
Timestamp:
Sep 13, 2009, 7:56:57 AM (10 years ago)
Author:
Tatsukawa, Akimichi
Message:

trying to solve parsing problem on term coding

Location:
ruby/trunk/lib/adl_parser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/adl_parser/lib/parser.rb

    r257 r258  
    1616require 'am.rb'
    1717require 'rm.rb'
     18$DEBUG = true
    1819
    1920
     
    2324    class Parser < Racc::Parser
    2425
    25 module_eval(<<'...end parser.y/module_eval...', 'parser.y', 1187)
     26module_eval(<<'...end parser.y/module_eval...', 'parser.y', 1188)
    2627
    2728def assert_at(file,line, message = "")
  • ruby/trunk/lib/adl_parser/lib/parser.y

    r257 r258  
    11811181require 'am.rb'
    11821182require 'rm.rb'
     1183$DEBUG = true
    11831184
    11841185
  • ruby/trunk/lib/adl_parser/test/parser_test.rb

    r257 r258  
    55  def setup
    66    @parser = ::OpenEHR::ADL::Parser.new
    7     $DEBUG = false
    87  end
    98
     
    1312
    1413  def test_parse
    15 #    body_mass_index = File.read(File.dirname(__FILE__) + '/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl')
    16     body_mass_index = File.read('test/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl')
     14    body_mass_index =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl")
     15#    body_mass_index = File.read('test/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl')
    1716    assert_nothing_raised do
    1817      ast = @parser.parse(body_mass_index, 'openEHR-EHR-OBSERVATION.body_mass_index.v1.adl')
     
    2019    end
    2120
    22     laboratory_request = File.read('test/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
     21    laboratory_request = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl")
    2322    assert_nothing_raised do
    24       result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
     23      result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1')
    2524      assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
    2625      assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
     
    2827    end
    2928
    30     apgar = File.read('test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl')
     29    apgar = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl")
    3130    assert_nothing_raised do
    32       result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
     31      result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1')
    3332      assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
    3433      assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
     
    3635    end
    3736
    38     evaluation = File.read('test/adl/openEHR-EHR-EVALUATION.adverse.v1.adl')
     37    evaluation = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-EVALUATION.adverse.v1.adl")
    3938    assert_nothing_raised do
    40       @parser.parse(evaluation, 'openEHR-EHR-EVALUATION.adverse.v1.adl')
     39      @parser.parse(evaluation, 'openEHR-EHR-EVALUATION.adverse.v1')
    4140    end
    4241
    43 
    44 
    45     referral = File.read('test/adl/openEHR-EHR-ITEM_TREE.referral.v1.adl')
     42    referral = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.referral.v1.adl")
    4643    assert_nothing_raised do
    47       @parser.parse(referral, 'openEHR-EHR-ITEM_TREE.referral.v1.adl')
     44      @parser.parse(referral, 'openEHR-EHR-ITEM_TREE.referral.v1')
    4845    end
    4946
    50     exam_fetus = File.read('test/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
     47    exam_fetus = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl")
    5148    assert_nothing_raised do
    52       @parser.parse(exam_fetus, 'openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
     49      @parser.parse(exam_fetus, 'openEHR-EHR-CLUSTER.exam-fetus.v1')
    5350    end
    5451
    55     exam_uterine_cervix = File.read('test/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
     52    exam_uterine_cervix = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl")
    5653    assert_nothing_raised do
    57       @parser.parse(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
     54      @parser.parse(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1')
    5855    end
    5956
    60     imaging = File.read('test/adl/openEHR-EHR-ACTION.imaging.v1.adl')
     57    imaging = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.imaging.v1.adl")
    6158    assert_nothing_raised do
    62       @parser.parse(imaging, 'openEHR-EHR-ACTION.imaging.v1.adl')
     59      @parser.parse(imaging, 'openEHR-EHR-ACTION.imaging.v1')
    6360    end
    6461
    65     exam_nervous_system = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
     62    exam_nervous_system = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
    6663    assert_nothing_raised do
    67       @parser.parse(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
     64      @parser.parse(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1')
    6865    end
    6966
    70     exam_generic = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl')
     67    exam_generic = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl")
    7168    assert_nothing_raised do
    72       @parser.parse(exam_generic, 'openEHR-EHR-CLUSTER.exam-generic.v1.adl')
     69      @parser.parse(exam_generic, 'openEHR-EHR-CLUSTER.exam-generic.v1')
    7370    end
    7471
    75 #     exam_generic_mass = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
     72    exam_generic_mass = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl")
     73    assert_nothing_raised do
     74      @parser.parse(exam_generic_mass, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1')
     75    end
     76
     77#     exam_generic_lymphnode = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl")
    7678#     assert_nothing_raised do
    77 #       @parser.parse(exam_generic_mass, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
     79#       @parser.parse(exam_generic_lymphnode, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1')
    7880#     end
    79 #     exam_generic_lymphnode = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
     81
     82#     exam_generic_joint = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl")
    8083#     assert_nothing_raised do
    81 #       @parser.parse(exam_generic_lymphnode, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
     84#       @parser.parse(exam_generic_joint, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1')
    8285#     end
    83 #     exam_generic_joint = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
     86
     87#     exam_chest = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl")
    8488#     assert_nothing_raised do
    85 #       @parser.parse(exam_generic_joint, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
     89#       @parser.parse(exam_chest, 'openEHR-EHR-CLUSTER.exam-chest.v1')
    8690#     end
    87 #     exam_chest = File.read('test/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl')
     91
     92#     exam_abdomen = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl")
    8893#     assert_nothing_raised do
    89 #       @parser.parse(exam_chest, 'openEHR-EHR-CLUSTER.exam-chest.v1.adl')
     94#       @parser.parse(exam_abdomen, 'openEHR-EHR-CLUSTER.exam-abdomen.v1')
    9095#     end
    91 #     exam_abdomen = File.read('test/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
     96
     97#     cluster_auscultation = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl")
    9298#     assert_nothing_raised do
    93 #       @parser.parse(exam_abdomen, 'openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
     99#       @parser.parse(cluster_auscultation, 'openEHR-EHR-CLUSTER.auscultation.v1')
    94100#     end
    95 #     cluster_auscultation = File.read('test/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl')
     101
     102#     cluster_auscultation_chest = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl")
    96103#     assert_nothing_raised do
    97 #       @parser.parse(cluster_auscultation, 'openEHR-EHR-CLUSTER.auscultation.v1.adl')
     104#       @parser.parse(cluster_auscultation_chest, 'openEHR-EHR-CLUSTER.auscultation-chest.v1')
    98105#     end
    99 #     cluster_auscultation_chest = File.read('test/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
    100 #     assert_nothing_raised do
    101 #       @parser.parse(cluster_auscultation_chest, 'openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
    102 #     end
    103 #     vital_signs = File.read('test/adl/openEHR-EHR-SECTION.vital_signs.v1.adl')
     106
     107#     vital_signs = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.vital_signs.v1.adl")
    104108#     assert_nothing_raised do
    105109#       @parser.parse(vital_signs, 'openEHR-EHR-SECTION.vital_signs.v1')
    106110#     end
    107 #     summary = File.read('test/adl/openEHR-EHR-SECTION.summary.v1.adl')
     111
     112#     summary = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.summary.v1.adl")
    108113#     assert_nothing_raised do
    109 #       @parser.parse(summary, 'openEHR-EHR-SECTION.summary.v1.adl')
     114#       @parser.parse(summary, 'openEHR-EHR-SECTION.summary.v1')
    110115#     end
    111116
    112 #     findings = File.read('test/adl/openEHR-EHR-SECTION.findings.v1.adl')
     117#     findings = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.findings.v1.adl")
    113118#     assert_nothing_raised do
    114 #       @parser.parse(findings, 'openEHR-EHR-SECTION.findings.v1.adl')
     119#       @parser.parse(findings, 'openEHR-EHR-SECTION.findings.v1')
    115120#     end
    116121
    117 #     reason_for_encounter = File.read('test/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
     122#     reason_for_encounter = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl")
    118123#     assert_nothing_raised do
    119 #       @parser.parse(reason_for_encounter, 'openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
     124#       @parser.parse(reason_for_encounter, 'openEHR-EHR-SECTION.reason_for_encounter.v1')
    120125#     end
    121126
    122 #     imaging = File.read('test/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl')
     127#     imaging = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl")
    123128#     assert_nothing_raised do
    124 #       @parser.parse(imaging, 'openEHR-EHR-ITEM_TREE.imaging.v1.adl')
    125 #     end
    126 #     instruction_referral = File.read('test/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl')
    127 #     assert_nothing_raised do
    128 #       @parser.parse(instruction_referral, 'openEHR-EHR-INSTRUCTION.referral.v1.adl')
    129 #     end
    130 #     instruction_medication = File.read('test/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl')
    131 #     assert_nothing_raised do
    132 #       @parser.parse(instruction_medication, 'openEHR-EHR-INSTRUCTION.medication.v1.adl')
    133 #     end
    134 #     action_referral = File.read('test/adl/openEHR-EHR-ACTION.referral.v1.adl')
    135 #     assert_nothing_raised do
    136 #       @parser.parse(action_referral, 'openEHR-EHR-ACTION.referral.v1.adl')
     129#       @parser.parse(imaging, 'openEHR-EHR-ITEM_TREE.imaging.v1')
    137130#     end
    138131
    139 #     dimensions_circumference = File.read('test/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl')
     132#     instruction_referral = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl")
    140133#     assert_nothing_raised do
    141 #       @parser.parse(dimensions_circumference, 'openEHR-EHR-CLUSTER.dimensions.v1.adl')
     134#       @parser.parse(instruction_referral, 'openEHR-EHR-INSTRUCTION.referral.v1')
    142135#     end
    143136
    144 #     discharge = File.read('test/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
     137#     instruction_medication = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl")
    145138#     assert_nothing_raised do
    146 #       @parser.parse(discharge, 'openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
     139#       @parser.parse(instruction_medication, 'openEHR-EHR-INSTRUCTION.medication.v1')
    147140#     end
    148141
    149 #     encounter = File.read('test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
     142#     action_referral = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.referral.v1.adl")
    150143#     assert_nothing_raised do
    151 #       @parser.parse(encounter, 'openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
     144#       @parser.parse(action_referral, 'openEHR-EHR-ACTION.referral.v1')
     145#     end
     146
     147#     dimensions_circumference = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl")
     148#     assert_nothing_raised do
     149#       @parser.parse(dimensions_circumference, 'openEHR-EHR-CLUSTER.dimensions.v1')
     150#     end
     151
     152#     discharge = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl")
     153#     assert_nothing_raised do
     154#       @parser.parse(discharge, 'openEHR-EHR-COMPOSITION.discharge.v1draft')
     155#     end
     156
     157#     encounter = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl")
     158#     assert_nothing_raised do
     159#       @parser.parse(encounter, 'openEHR-EHR-COMPOSITION.encounter.v1draft')
    152160#     end
    153161
    154162
    155 #     medication = File.read('test/adl/openEHR-EHR-ITEM_TREE.medication.v1.adl')
     163#     medication = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.medication.v1.adl")
    156164#     assert_nothing_raised do
    157 #       @parser.parse(medication, 'openEHR-EHR-ITEM_TREE.medication.v1.adl')
     165#       @parser.parse(medication, 'openEHR-EHR-ITEM_TREE.medication.v1.adl")
    158166#     end
    159167  end
  • ruby/trunk/lib/adl_parser/test/test_helper.rb

    r257 r258  
    11require 'test/unit'
    22
    3 $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
     3TEST_ROOT_DIR = File.dirname(__FILE__)
     4$LOAD_PATH << File.join(TEST_ROOT_DIR, '..', 'lib')
    45require "rubygems"
    56require 'adl_parser.rb'
    67require 'rm.rb'
    78require 'am.rb'
     9
     10
Note: See TracChangeset for help on using the changeset viewer.