mml-ruby 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/LICENSE +199 -10
  2. data/lib/mml.rb +288 -5
  3. data/lib/mml/common.rb +26 -268
  4. data/lib/mml/version.rb +1 -1
  5. data/lib/xml/address.xml.builder +12 -0
  6. data/lib/xml/baseclinic.xml.builder +36 -0
  7. data/lib/xml/creatorinfo.xml.builder +6 -0
  8. data/lib/xml/creatorlicense.xml.builder +3 -0
  9. data/lib/xml/department.xml.builder +8 -0
  10. data/lib/xml/extref.xml.builder +5 -0
  11. data/lib/xml/facility.xml.builder +8 -0
  12. data/lib/xml/firstclinic.xml.builder +47 -0
  13. data/lib/xml/id.xml.builder +4 -0
  14. data/lib/xml/insurance.xml.builder +82 -0
  15. data/lib/xml/lifestyle.xml.builder +6 -0
  16. data/lib/xml/name.xml.builder +10 -0
  17. data/lib/xml/patientinfo.xml.builder +51 -0
  18. data/lib/xml/personalizedinfo.xml.builder +25 -0
  19. data/lib/xml/phone.xml.builder +10 -0
  20. data/lib/xml/progresscourse.xml.builder +89 -0
  21. data/lib/xml/registereddiagnosis.xml.builder +27 -0
  22. data/lib/xml/staffinfo.xml.builder +6 -0
  23. data/lib/xml/summary.xml.builder +125 -0
  24. data/lib/xml/surgery.xml.builder +81 -0
  25. data/spec/mml/admission_spec.rb +45 -0
  26. data/spec/mml/allergy_item_spec.rb +35 -0
  27. data/spec/mml/anesthesia_procedure_spec.rb +15 -0
  28. data/spec/mml/anesthesiologist_spec.rb +22 -0
  29. data/spec/mml/base_clinic_module_spec.rb +58 -0
  30. data/spec/mml/birth_info_spec.rb +90 -0
  31. data/spec/mml/blood_type_spec.rb +40 -0
  32. data/spec/mml/clinical_record_spec.rb +37 -0
  33. data/spec/mml/creator_info_spec.rb +3 -3
  34. data/spec/mml/creator_license_spec.rb +7 -0
  35. data/spec/mml/death_flag_spec.rb +11 -0
  36. data/spec/mml/death_info_spec.rb +19 -0
  37. data/spec/mml/department_spec.rb +3 -3
  38. data/spec/mml/diagnostic_category_spec.rb +23 -0
  39. data/spec/mml/discharge_spec.rb +29 -0
  40. data/spec/mml/dx_item_spec.rb +19 -0
  41. data/spec/mml/family_history_item_spec.rb +36 -0
  42. data/spec/mml/first_clinic_module_spec.rb +105 -0
  43. data/spec/mml/infection_item_spec.rb +39 -0
  44. data/spec/mml/inpatient_item_spec.rb +49 -0
  45. data/spec/mml/insurance_class_spec.rb +24 -0
  46. data/spec/mml/insurance_client_spec.rb +36 -0
  47. data/spec/mml/insurance_spec.rb +182 -0
  48. data/spec/mml/lifestyle_module_spec.rb +50 -0
  49. data/spec/mml/nationality_spec.rb +19 -0
  50. data/spec/mml/objective_spec.rb +51 -0
  51. data/spec/mml/operation_element_item_spec.rb +31 -0
  52. data/spec/mml/organization_info_spec.rb +35 -0
  53. data/spec/mml/other_blood_type_spec.rb +31 -0
  54. data/spec/mml/outpatient_item_spec.rb +48 -0
  55. data/spec/mml/past_history_item_spec.rb +23 -0
  56. data/spec/mml/past_history_spec.rb +17 -0
  57. data/spec/mml/patient_info_spec.rb +126 -0
  58. data/spec/mml/phone_spec.rb +5 -1
  59. data/spec/mml/physical_exam_item_spec.rb +40 -0
  60. data/spec/mml/plan_spec.rb +45 -0
  61. data/spec/mml/problem_item_spec.rb +35 -0
  62. data/spec/mml/procedure_item_spec.rb +44 -0
  63. data/spec/mml/progress_course_module_spec.rb +79 -0
  64. data/spec/mml/public_insurance_item_spec.rb +64 -0
  65. data/spec/mml/race_spec.rb +19 -0
  66. data/spec/mml/registered_diagnosis_spec.rb +124 -0
  67. data/spec/mml/related_doc_spec.rb +15 -0
  68. data/spec/mml/service_history_spec.rb +53 -0
  69. data/spec/mml/staff_info_spec.rb +31 -0
  70. data/spec/mml/subject_spec.rb +16 -0
  71. data/spec/mml/subjective_item_spec.rb +23 -0
  72. data/spec/mml/summary_module_spec.rb +239 -0
  73. data/spec/mml/surgery_item_spec.rb +132 -0
  74. data/spec/mml/surgery_module_spec.rb +90 -0
  75. data/spec/mml/surgical_staff_spec.rb +34 -0
  76. data/spec/mml/test_result_spec.rb +24 -0
  77. data/spec/mml/vaccination_item_spec.rb +38 -0
  78. data/spec/mml/value_with_link_spec.rb +15 -0
  79. data/spec/spec_helper.rb +1 -1
  80. metadata +137 -5
  81. checksums.yaml +0 -7
@@ -0,0 +1,81 @@
1
+ xml.mmlSg :SurgeryModule do
2
+ surgeryItem.each do |sitem|
3
+ xml.mmlSg :surgeryItem do
4
+ attribute = Hash.new
5
+ attribute = {'mmlSg:type' => sitem.type} if sitem.type
6
+ xml.mmlSg :surgicalInfo, attribute do
7
+ xml.mmlSg :date, sitem.date
8
+ xml.mmlSg :startTime, sitem.startTime if sitem.startTime
9
+ xml.mmlSg :duration, sitem.duration if sitem.duration
10
+ xml.mmlSg :surgicalDepartment do
11
+ xml << sitem.surgicalDepartment.to_xml
12
+ end if sitem.surgicalDepartment
13
+ xml.mmlSg :patientDepartment do
14
+ xml << sitem.patientDepartment.to_xml
15
+ end if sitem.patientDepartment
16
+ end
17
+ xml.mmlSg :surgicalDiagnosis do
18
+ sitem.surgicalDiagnosis.each do |ditem|
19
+ xml << ditem.to_xml
20
+ end
21
+ end
22
+ xml.mmlSg :surgicalProcedure do
23
+ sitem.surgicalProcedure.each do |pitem|
24
+ xml.mmlSg :procedureItem do
25
+ attributes = Hash.new
26
+ attributes = {'mmlSg:code' => pitem.code} if pitem.code
27
+ attributes['mmlSg:system'] = pitem.system if pitem.system
28
+ xml.mmlSg :operation, pitem.operation, attributes if pitem.operation
29
+ xml.mmlSg :operationElement do
30
+ pitem.operationElement.each do |oitem|
31
+ xml.mmlSg :operationElementItem do
32
+ attributes = Hash.new
33
+ attributes = {'mmlSg:code' => oitem.code}
34
+ attributes['mmlSg:system'] = oitem.system
35
+ xml.mmlSg :title, oitem.title, attributes
36
+ end
37
+ end
38
+ end if pitem.operationElement
39
+ xml.mmlSg :procedureMemo, pitem.procedureMemo if pitem.procedureMemo
40
+ end
41
+ end
42
+ end
43
+ xml.mmlSg :surgicalStaffs do
44
+ sitem.surgicalStaffs.each do |staff|
45
+ attributes = Hash.new
46
+ attributes = {'mmlSg:staffClass' => staff.staffClass} if staff.staffClass
47
+ attributes['mmlSg:superiority'] = staff.superiority if staff.superiority
48
+ xml.mmlSg :staff, attributes do
49
+ xml << staff.staffInfo.to_xml
50
+ end
51
+ end
52
+ end if sitem.surgicalStaffs
53
+ xml.mmlSg :anesthesiaProcedure do
54
+ sitem.anesthesiaProcedure.each do |aproc|
55
+ attributes = Hash.new
56
+ attributes['mmlSg:code'] = aproc.code if aproc.code
57
+ attributes['mmlSg:system'] = aproc.system if aproc.system
58
+ xml.mmlSg :title, aproc.title, attributes
59
+ end
60
+ end if sitem.anesthesiaProcedure
61
+ xml.mmlSg :anesthesiologists do
62
+ sitem.anesthesiologists.each do |staff|
63
+ attributes = Hash.new
64
+ attributes['mmlSg:staffClass'] = staff.staffClass if staff.staffClass
65
+ attributes['mmlSg:superiority'] = staff.superiority if staff.superiority
66
+ xml.mmlSg :staff, attributes do
67
+ xml << staff.staffInfo.to_xml
68
+ end
69
+ end
70
+ end if sitem.anesthesiologists
71
+ xml.mmlSg :anesthesiaDuration, sitem.anesthesiaDuration if sitem.anesthesiaDuration
72
+ xml.mmlSg :operativeNotes, sitem.operativeNotes if sitem.operativeNotes
73
+ xml.mmlSg :referenceInfo do
74
+ sitem.referenceInfo.each do |ref|
75
+ xml << ref.to_xml
76
+ end
77
+ end if sitem.referenceInfo
78
+ xml.mmlSg :memo, sitem.memo if sitem.memo
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,45 @@
1
+ describe MML::Admission do
2
+ let(:referer_id) {MML::Id.new(type: 'facility', tableId: 'MML0024', value: '23234567')}
3
+ let(:referer_name) {MML::Name.new(repCode: 'A', tableId: 'MML0025', family: 'Ono', given: 'Yoko', degree: 'M.D.')}
4
+ let(:referer_facility_name) {MML::FacilityName.new(repCode: 'A', tableId: 'MML0025', value: 'New Millenium Medical College Hospital')}
5
+ let(:referer_facility_id) {MML::Id.new(type: 'insurance', tableId: 'MML0027', value: '801.006.3')}
6
+ let(:referer_facility) {MML::Facility.new(id: referer_facility_id, name: [referer_facility_name])}
7
+ let(:referer) {MML::PersonalizedInfo.new(id: referer_id, personName: [referer_name], facility: referer_facility)}
8
+ let(:admission) {MML::Admission.new(date: '2013-12-08', admissionCondition: 'Emergency admission by ambulance', emergency: true, referFrom: referer)}
9
+
10
+ it 'is an instance of MML::Admission' do
11
+ expect(admission).to be_an_instance_of MML::Admission
12
+ end
13
+
14
+ it 'date should be assigned properly' do
15
+ expect(admission.date).to eq '2013-12-08'
16
+ end
17
+
18
+ it 'date is mandatory' do
19
+ expect {admission.date = nil}.to raise_error ArgumentError
20
+ end
21
+
22
+ it 'admissionCondition should be assigned properly' do
23
+ expect(admission.admissionCondition).to eq 'Emergency admission by ambulance'
24
+ end
25
+
26
+ it 'admissionCondition is optional' do
27
+ expect {admission.admissionCondition = nil}.not_to raise_error
28
+ end
29
+
30
+ it 'emergency should be assigned properly' do
31
+ expect(admission.emergency).to be_true
32
+ end
33
+
34
+ it 'emergency is optional' do
35
+ expect {admission.emergency = nil}.not_to raise_error
36
+ end
37
+
38
+ it 'referer should be assigned properly' do
39
+ expect(admission.referFrom.facility.name[0].value).to eq 'New Millenium Medical College Hospital'
40
+ end
41
+
42
+ it 'referFrom is optional' do
43
+ expect {admission.referFrom = nil}.not_to raise_error
44
+ end
45
+ end
@@ -0,0 +1,35 @@
1
+ describe MML::AllergyItem do
2
+ let(:allergy_item) {MML::AllergyItem.new(factor: 'crab', severity: 'mild', identifiedDate: 'since almost 20 years ago', memo: 'no reaction to shrimp')}
3
+
4
+ it 'is an instance of MML::AllergyItem' do
5
+ expect(allergy_item).to be_an_instance_of MML::AllergyItem
6
+ end
7
+
8
+ it 'factor should be assigned properly' do
9
+ expect(allergy_item.factor).to eq 'crab'
10
+ end
11
+
12
+ it 'factor is mandatory' do
13
+ expect {allergy_item.factor = nil}.to raise_error ArgumentError
14
+ end
15
+
16
+ it 'severity should be assigned properly' do
17
+ expect(allergy_item.severity).to eq 'mild'
18
+ end
19
+
20
+ it 'severity is optional' do
21
+ expect {allergy_item.severity = nil}.not_to raise_error
22
+ end
23
+
24
+ it 'identifiedDate should be assigned properly' do
25
+ expect(allergy_item.identifiedDate).to eq 'since almost 20 years ago'
26
+ end
27
+
28
+ it 'identifiedDate is optional' do
29
+ expect{allergy_item.identifiedDate = nil}.not_to raise_error
30
+ end
31
+
32
+ it 'memo should be assigned properly' do
33
+ expect(allergy_item.memo).to eq 'no reaction to shrimp'
34
+ end
35
+ end
@@ -0,0 +1,15 @@
1
+ describe MML::AnesthesiaProcedure do
2
+ let(:anesthesia_procedure){MML::AnesthesiaProcedure.new(title: 'general anesthesia', code: 'L002', system: 'MHLW')}
3
+
4
+ it 'is an instance of MML::Anesthesia' do
5
+ expect(anesthesia_procedure).to be_an_instance_of MML::AnesthesiaProcedure
6
+ end
7
+
8
+ it 'title should be assigned properly' do
9
+ expect(anesthesia_procedure.title).to eq 'general anesthesia'
10
+ end
11
+
12
+ it 'code should be assigned properly' do
13
+ expect {anesthesia_procedure.title = nil}.to raise_error ArgumentError
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ describe MML::Anesthesiologist do
2
+ let(:staff_id) {MML::Id.new(type: 'facility', tableId: 'MML0024', value: '00123')}
3
+ let(:staff_name) {MML::Name.new(repCode: 'A', fullname: 'Kenji ARAKI')}
4
+ let(:staff_info) {MML::PersonalizedInfo.new(id: staff_id, personName: [staff_name])}
5
+ let(:staff) {MML::Anesthesiologist.new(staffClass: 'main anesthesiologist', superiority: 1, staffInfo: staff_info)}
6
+
7
+ it 'is an instance of MML::Anesthesiologist' do
8
+ expect(staff).to be_an_instance_of MML::Anesthesiologist
9
+ end
10
+
11
+ it 'staffClass should be assigned properly' do
12
+ expect(staff.staffClass).to eq 'main anesthesiologist'
13
+ end
14
+
15
+ it 'superiolity should be assigned properly' do
16
+ expect(staff.superiority).to eq 1
17
+ end
18
+
19
+ it 'staffInfo should be assigned properly' do
20
+ expect(staff.staffInfo.personName[0].fullname).to eq 'Kenji ARAKI'
21
+ end
22
+ end
@@ -0,0 +1,58 @@
1
+ describe MML::BaseClinic do
2
+ let(:allergy_item) {MML::AllergyItem.new(factor: 'crab', severity: 'mild', identifiedDate: 'since almost 20 years ago', memo: 'no reaction to shrimp')}
3
+ let(:other_blood_type) {MML::OtherBloodType.new(typeName: 'MNS blood type', typeJudgement: 'MN', description: 'examination at 2 years ago')}
4
+ let(:bloodtype) {MML::BloodType.new(abo: 'a', rh: 'rhD+', others: [other_blood_type], memo: 'after BMT')}
5
+ let(:infection_item) {MML::InfectionItem.new(factor: 'Influenza', examValue: 'A+B-', identifiedDate: '2013-12-03', memo: 'drug resistance(-)')}
6
+ let(:base_clinic) {MML::BaseClinic.new(allergy: [allergy_item], bloodtype: bloodtype, infection: [infection_item])}
7
+
8
+ it 'is an instance of MML::BaseClinic' do
9
+ expect(base_clinic).to be_an_instance_of MML::BaseClinic
10
+ end
11
+
12
+ it 'allergy item should be assigned properly' do
13
+ expect(base_clinic.allergy[0].factor).to eq 'crab'
14
+ end
15
+
16
+ it 'blood type should be assigned properly' do
17
+ expect(base_clinic.bloodtype.abo).to eq 'a'
18
+ end
19
+
20
+ it 'infection should be assigned properly' do
21
+ expect(base_clinic.infection[0].factor).to eq 'Influenza'
22
+ end
23
+
24
+ describe '#to_xml' do
25
+ subject {base_clinic.to_xml}
26
+
27
+ it {should match '<mmlBc:BaseClinicModule>'}
28
+ it {should match '<mmlBc:allergy>'}
29
+ it {should match '<mmlBc:allergyItem>'}
30
+ it {should match '<mmlBc:factor>crab</mmlBc:factor>'}
31
+ it {should match '<mmlBc:severity>mild</mmlBc:severity>'}
32
+ it {should match '<mmlBc:identifiedDate>since almost 20 years ago</mmlBc:identifiedDate>'}
33
+ it {should match '<mmlBc:memo>no reaction to shrimp</mmlBc:memo>'}
34
+ it {should match '</mmlBc:allergyItem>'}
35
+ it {should match '</mmlBc:allergy>'}
36
+ it {should match '<mmlBc:bloodtype>'}
37
+ it {should match '<mmlBc:abo>a</mmlBc:abo>'}
38
+ it {should match '<mmlBc:rh>rhD\+</mmlBc:rh>'}
39
+ it {should match '<mmlBc:others>'}
40
+ it {should match '<mmlBc:other>'}
41
+ it {should match '<mmlBc:typeName>MNS blood type</mmlBc:typeName>'}
42
+ it {should match '<mmlBc:typeJudgement>MN</mmlBc:typeJudgement>'}
43
+ it {should match '<mmlBc:description>examination at 2 years ago</mmlBc:description>'}
44
+ it {should match '</mmlBc:other>'}
45
+ it {should match '</mmlBc:others>'}
46
+ it {should match '<mmlBc:memo>after BMT</mmlBc:memo>'}
47
+ it {should match '</mmlBc:bloodtype>'}
48
+ it {should match '<mmlBc:infection>'}
49
+ it {should match '<mmlBc:infectionItem>'}
50
+ it {should match '<mmlBc:factor>Influenza</mmlBc:factor>'}
51
+ it {should match '<mmlBc:examValue>A\+B-</mmlBc:examValue>'}
52
+ it {should match '<mmlBc:identifiedDate>2013-12-03</mmlBc:identifiedDate>'}
53
+ it {should match '<mmlBc:memo>drug resistance\(-\)</mmlBc:memo>'}
54
+ it {should match '</mmlBc:infectionItem>'}
55
+ it {should match '</mmlBc:infection>'}
56
+ it {should match '</mmlBc:BaseClinicModule>'}
57
+ end
58
+ end
@@ -0,0 +1,90 @@
1
+ describe MML::BirthInfo do
2
+ let(:id) { MML::Id.new(value: '12345', type: 'facility', tableId: 'MML0024', checkDigit: 5, checkDigitSchema: 'MML0001') }
3
+ let(:name) { MML::FacilityName.new(value: 'New Millenium Medical College Hospital', repCode: 'A', tableId: 'MML0025') }
4
+ let(:facility) { MML::Facility.new(name: [name], id: id) }
5
+ let(:birth_info) {MML::BirthInfo.new(facility: facility, deliveryWeeks: 'P38W', deliveryMethod: 'cesarean section', bodyWeight: 3370, bodyWeightUnit: 'g', bodyHeight: 50, bodyHeightUnit: 'cm', chestCircumference: 31.1, chestCircumferenceUnit: 'cm', headCircumference: 32.8, headCircumferenceUnit: 'cm', memo: 'intact')}
6
+
7
+ it 'is an instance of MML::BirthInfo' do
8
+ expect(birth_info).to be_an_instance_of MML::BirthInfo
9
+ end
10
+
11
+ it 'facility should be assigned properly' do
12
+ expect(birth_info.facility.id.value).to eq '12345'
13
+ end
14
+
15
+ it 'facility is optional' do
16
+ expect {birth_info.facility = nil}.not_to raise_error
17
+ end
18
+
19
+ it 'deliveryWeeks should be assigned properly' do
20
+ expect(birth_info.deliveryWeeks).to eq 'P38W'
21
+ end
22
+
23
+ it 'deliveryWeeks is optional' do
24
+ expect {birth_info.deliveryWeeks = nil}.not_to raise_error
25
+ end
26
+
27
+ it 'deliveryMethod should be assigned properly' do
28
+ expect(birth_info.deliveryMethod).to eq 'cesarean section'
29
+ end
30
+
31
+ it 'deliveryMethod is optional' do
32
+ expect {birth_info.deliveryMethod = nil}.not_to raise_error
33
+ end
34
+
35
+ it 'bodyWeight should be assigned properly' do
36
+ expect(birth_info.bodyWeight).to eq 3370
37
+ end
38
+
39
+ it 'bodyWeight is optional' do
40
+ expect{birth_info.bodyWeight = nil}.not_to raise_error
41
+ end
42
+
43
+ it 'bodyWeight unit should be assigned properly' do
44
+ expect(birth_info.bodyWeightUnit).to eq 'g'
45
+ end
46
+
47
+ it 'bodyHeight should be assigned properly' do
48
+ expect(birth_info.bodyHeight).to eq 50
49
+ end
50
+
51
+ it 'bodyHeight is optional' do
52
+ expect {birth_info.bodyHeight = nil}.not_to raise_error
53
+ end
54
+
55
+ it 'bodyHeightUnit should be assigned properly' do
56
+ expect(birth_info.bodyHeightUnit).to eq 'cm'
57
+ end
58
+
59
+ it 'chestCircumference should be assigned properly' do
60
+ expect(birth_info.chestCircumference).to eq 31.1
61
+ end
62
+
63
+ it 'chestCircumference is optional' do
64
+ expect {birth_info.chestCircumference = nil}.not_to raise_error
65
+ end
66
+
67
+ it 'chestCircumferenceUnit should be assigned properly' do
68
+ expect(birth_info.chestCircumferenceUnit).to eq 'cm'
69
+ end
70
+
71
+ it 'headCircumference should be assigned properly' do
72
+ expect(birth_info.headCircumference).to eq 32.8
73
+ end
74
+
75
+ it 'headCircumference is optional' do
76
+ expect {birth_info.headCircumference = nil}.not_to raise_error
77
+ end
78
+
79
+ it 'headCircumferenceUnit should be assigned properly' do
80
+ expect(birth_info.headCircumferenceUnit).to eq 'cm'
81
+ end
82
+
83
+ it 'memo should be assigned properly' do
84
+ expect(birth_info.memo).to eq 'intact'
85
+ end
86
+
87
+ it 'memo is optional' do
88
+ expect {birth_info.memo = nil}.not_to raise_error
89
+ end
90
+ end
@@ -0,0 +1,40 @@
1
+ describe MML::BloodType do
2
+ let(:other_blood_type) {MML::OtherBloodType.new(typeName: 'MNS blood type', typeJudgement: 'MN')}
3
+ let(:blood_type) {MML::BloodType.new(abo: 'a', rh: 'rhD+', others: [other_blood_type], memo: 'after BMT')}
4
+
5
+ it 'is an instance of MML::BloodType' do
6
+ expect(blood_type).to be_an_instance_of MML::BloodType
7
+ end
8
+
9
+ it 'ABO type should be assigned properly' do
10
+ expect(blood_type.abo).to eq 'a'
11
+ end
12
+
13
+ it 'ABO type is mandatory' do
14
+ expect{blood_type.abo = nil}.to raise_error ArgumentError
15
+ end
16
+
17
+ it 'Rh type indicates D' do
18
+ expect(blood_type.rh).to eq 'rhD+'
19
+ end
20
+
21
+ it 'Rh type is optional' do
22
+ expect {blood_type.rh = nil}.not_to raise_error
23
+ end
24
+
25
+ it 'others should be assigned properly' do
26
+ expect(blood_type.others[0].typeJudgement).to eq 'MN'
27
+ end
28
+
29
+ it 'others is optional' do
30
+ expect {blood_type.others = nil}.not_to raise_error
31
+ end
32
+
33
+ it 'memo should be assigned properly' do
34
+ expect(blood_type.memo).to eq 'after BMT'
35
+ end
36
+
37
+ it 'memo is optional' do
38
+ expect{blood_type.memo = nil}.not_to raise_error
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ describe MML::ClinicalRecord do
2
+ let(:ext_ref) {MML::ExtRef.new(href: 'img://file/angio/')}
3
+ let(:related_doc) {MML::RelatedDoc.new(value: '11D1AC5400A0C94A814796045F768ED5', relation: 'detail')}
4
+ let(:clinical_record) {MML::ClinicalRecord.new(value: 'Emergency coronary angiography was carried out.', date: '2013-12-20', extRef: [ext_ref], relatedDoc: [related_doc])}
5
+
6
+ it 'is an instance of MML::ClinicalRecord' do
7
+ expect(clinical_record).to be_an_instance_of MML::ClinicalRecord
8
+ end
9
+
10
+ it 'value should be assigned properly' do
11
+ expect(clinical_record.value).to eq 'Emergency coronary angiography was carried out.'
12
+ end
13
+
14
+ it 'value is mandatory' do
15
+ expect {clinical_record.value = nil}.to raise_error ArgumentError
16
+ end
17
+
18
+ it 'date should be assigned properly' do
19
+ expect(clinical_record.date).to eq '2013-12-20'
20
+ end
21
+
22
+ it 'date is optional' do
23
+ expect {clinical_record.date = nil}.not_to raise_error
24
+ end
25
+
26
+ it 'extRef should be assigned properly' do
27
+ expect(clinical_record.extRef[0].href).to eq 'img://file/angio/'
28
+ end
29
+
30
+ it 'relatedDoc should be assigned properly' do
31
+ expect(clinical_record.relatedDoc[0].relation).to eq 'detail'
32
+ end
33
+
34
+ it 'relatedDoc is optional' do
35
+ expect {clinical_record.relatedDoc = nil}.not_to raise_error
36
+ end
37
+ end
@@ -29,9 +29,9 @@ describe MML::CreatorInfo do
29
29
  expect {creator_info.creatorLicense = nil}.to raise_error ArgumentError
30
30
  end
31
31
 
32
- it 'should not be empty' do
33
- expect {creator_info.creatorLicense = []}.to raise_error ArgumentError
34
- end
32
+ # it 'should not be empty' do
33
+ # expect {creator_info.creatorLicense = []}.to raise_error ArgumentError
34
+ # end
35
35
  end
36
36
 
37
37
  describe '#to_xml' do