mml-ruby 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +199 -10
- data/lib/mml.rb +288 -5
- data/lib/mml/common.rb +26 -268
- data/lib/mml/version.rb +1 -1
- data/lib/xml/address.xml.builder +12 -0
- data/lib/xml/baseclinic.xml.builder +36 -0
- data/lib/xml/creatorinfo.xml.builder +6 -0
- data/lib/xml/creatorlicense.xml.builder +3 -0
- data/lib/xml/department.xml.builder +8 -0
- data/lib/xml/extref.xml.builder +5 -0
- data/lib/xml/facility.xml.builder +8 -0
- data/lib/xml/firstclinic.xml.builder +47 -0
- data/lib/xml/id.xml.builder +4 -0
- data/lib/xml/insurance.xml.builder +82 -0
- data/lib/xml/lifestyle.xml.builder +6 -0
- data/lib/xml/name.xml.builder +10 -0
- data/lib/xml/patientinfo.xml.builder +51 -0
- data/lib/xml/personalizedinfo.xml.builder +25 -0
- data/lib/xml/phone.xml.builder +10 -0
- data/lib/xml/progresscourse.xml.builder +89 -0
- data/lib/xml/registereddiagnosis.xml.builder +27 -0
- data/lib/xml/staffinfo.xml.builder +6 -0
- data/lib/xml/summary.xml.builder +125 -0
- data/lib/xml/surgery.xml.builder +81 -0
- data/spec/mml/admission_spec.rb +45 -0
- data/spec/mml/allergy_item_spec.rb +35 -0
- data/spec/mml/anesthesia_procedure_spec.rb +15 -0
- data/spec/mml/anesthesiologist_spec.rb +22 -0
- data/spec/mml/base_clinic_module_spec.rb +58 -0
- data/spec/mml/birth_info_spec.rb +90 -0
- data/spec/mml/blood_type_spec.rb +40 -0
- data/spec/mml/clinical_record_spec.rb +37 -0
- data/spec/mml/creator_info_spec.rb +3 -3
- data/spec/mml/creator_license_spec.rb +7 -0
- data/spec/mml/death_flag_spec.rb +11 -0
- data/spec/mml/death_info_spec.rb +19 -0
- data/spec/mml/department_spec.rb +3 -3
- data/spec/mml/diagnostic_category_spec.rb +23 -0
- data/spec/mml/discharge_spec.rb +29 -0
- data/spec/mml/dx_item_spec.rb +19 -0
- data/spec/mml/family_history_item_spec.rb +36 -0
- data/spec/mml/first_clinic_module_spec.rb +105 -0
- data/spec/mml/infection_item_spec.rb +39 -0
- data/spec/mml/inpatient_item_spec.rb +49 -0
- data/spec/mml/insurance_class_spec.rb +24 -0
- data/spec/mml/insurance_client_spec.rb +36 -0
- data/spec/mml/insurance_spec.rb +182 -0
- data/spec/mml/lifestyle_module_spec.rb +50 -0
- data/spec/mml/nationality_spec.rb +19 -0
- data/spec/mml/objective_spec.rb +51 -0
- data/spec/mml/operation_element_item_spec.rb +31 -0
- data/spec/mml/organization_info_spec.rb +35 -0
- data/spec/mml/other_blood_type_spec.rb +31 -0
- data/spec/mml/outpatient_item_spec.rb +48 -0
- data/spec/mml/past_history_item_spec.rb +23 -0
- data/spec/mml/past_history_spec.rb +17 -0
- data/spec/mml/patient_info_spec.rb +126 -0
- data/spec/mml/phone_spec.rb +5 -1
- data/spec/mml/physical_exam_item_spec.rb +40 -0
- data/spec/mml/plan_spec.rb +45 -0
- data/spec/mml/problem_item_spec.rb +35 -0
- data/spec/mml/procedure_item_spec.rb +44 -0
- data/spec/mml/progress_course_module_spec.rb +79 -0
- data/spec/mml/public_insurance_item_spec.rb +64 -0
- data/spec/mml/race_spec.rb +19 -0
- data/spec/mml/registered_diagnosis_spec.rb +124 -0
- data/spec/mml/related_doc_spec.rb +15 -0
- data/spec/mml/service_history_spec.rb +53 -0
- data/spec/mml/staff_info_spec.rb +31 -0
- data/spec/mml/subject_spec.rb +16 -0
- data/spec/mml/subjective_item_spec.rb +23 -0
- data/spec/mml/summary_module_spec.rb +239 -0
- data/spec/mml/surgery_item_spec.rb +132 -0
- data/spec/mml/surgery_module_spec.rb +90 -0
- data/spec/mml/surgical_staff_spec.rb +34 -0
- data/spec/mml/test_result_spec.rb +24 -0
- data/spec/mml/vaccination_item_spec.rb +38 -0
- data/spec/mml/value_with_link_spec.rb +15 -0
- data/spec/spec_helper.rb +1 -1
- metadata +137 -5
- checksums.yaml +0 -7
@@ -0,0 +1,40 @@
|
|
1
|
+
describe MML::PhysicalExamItem do
|
2
|
+
let(:extref) {MML::ExtRef.new(href: 'snd://localhost/chest.wav')}
|
3
|
+
let(:physical_item) {MML::PhysicalExamItem.new(title: 'Chest auscultation', result: 'Respiratory sounds vesicular', interpretation: 'no rale', referenceInfo: [extref])}
|
4
|
+
|
5
|
+
it 'is an instance of MML::PhysicalItem' do
|
6
|
+
expect(physical_item).to be_an_instance_of MML::PhysicalExamItem
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'title should be assigned properly' do
|
10
|
+
expect(physical_item.title).to eq 'Chest auscultation'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'title is mandatory' do
|
14
|
+
expect {physical_item.title = nil}.to raise_error ArgumentError
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'result should be assigned properly' do
|
18
|
+
expect(physical_item.result).to eq 'Respiratory sounds vesicular'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'result is mandatory' do
|
22
|
+
expect {physical_item.result = nil}.to raise_error ArgumentError
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'interpretation should be assigned properly' do
|
26
|
+
expect(physical_item.interpretation).to eq 'no rale'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'interpretation is optional' do
|
30
|
+
expect {physical_item.interpretation}.not_to raise_error
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'referenceInfo should be assigned properly' do
|
34
|
+
expect(physical_item.referenceInfo[0].href).to eq 'snd://localhost/chest.wav'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'referenceInfo is optional' do
|
38
|
+
expect {physical_item.referenceInfo = nil}.not_to raise_error
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
describe MML::Plan do
|
2
|
+
let(:test_ref) {MML::ExtRef.new(href: 'http://testserer/laborder')}
|
3
|
+
let(:test_order) {MML::ValueWithLink.new(value: 'Full Blood Count', link: [test_ref])}
|
4
|
+
let(:rx_ref) {MML::ExtRef.new(href: 'http://rxorder/injection')}
|
5
|
+
let(:rx_order) {MML::ValueWithLink.new(value:'Rp1. Ampicilin 3.0g div', link: [rx_ref])}
|
6
|
+
let(:tx_ref) {MML::ExtRef.new(href: 'http://txorder/care')}
|
7
|
+
let(:tx_order) {MML::ValueWithLink.new(value: 'cooling', link: [tx_ref])}
|
8
|
+
let(:plan) {MML::Plan.new(testOrder: test_order, rxOrder: rx_order, txOrder: tx_order, planNotes: 'Antibiotics administration')}
|
9
|
+
|
10
|
+
it 'is an instance of MML::Plan' do
|
11
|
+
expect(plan).to be_an_instance_of MML::Plan
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'testOrder should be assigned properly' do
|
15
|
+
expect(plan.testOrder.value).to eq 'Full Blood Count'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'testOrder is optional' do
|
19
|
+
expect {plan.testOrder = nil}.not_to raise_error
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'rxOrder should be assigned properly' do
|
23
|
+
expect(plan.rxOrder.value).to eq 'Rp1. Ampicilin 3.0g div'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'rxOrder is optional' do
|
27
|
+
expect {plan.rxOrder = nil}.not_to raise_error
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'txOrder should be assigned properly' do
|
31
|
+
expect(plan.txOrder.value).to eq 'cooling'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'txOrder is optional' do
|
35
|
+
expect {plan.txOrder = nil}.not_to raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'planNotes should be assigned properly' do
|
39
|
+
expect(plan.planNotes).to eq 'Antibiotics administration'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'planNotes is optional' do
|
43
|
+
expect {plan.planNotes = nil}.not_to raise_error
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
describe MML::ProblemItem do
|
2
|
+
let(:subjective) {MML::Subjective.new(freeNotes: 'headache from 5 years ago')}
|
3
|
+
let(:objective) {MML::Objective.new(objectiveNotes: 'looks pale')}
|
4
|
+
let(:assessmentItem) {'Acute bronchitis'}
|
5
|
+
let(:plan) {MML::Plan.new(planNotes: 'Antibiotics administration')}
|
6
|
+
let(:problem_item) {MML::ProblemItem.new(problem: 'headache', dxUid: '0012-3330-abdc', subjective: subjective, objective: objective, assessment: [assessmentItem], plan: plan)}
|
7
|
+
|
8
|
+
it 'problem item is an instance of MML::ProblemItem' do
|
9
|
+
expect(problem_item).to be_an_instance_of MML::ProblemItem
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'problem should be assigned properly' do
|
13
|
+
expect(problem_item.problem).to eq 'headache'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'dxUid should be assigned properly' do
|
17
|
+
expect(problem_item.dxUid).to eq '0012-3330-abdc'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'subjective should be assigned properly' do
|
21
|
+
expect(problem_item.subjective.freeNotes).to eq 'headache from 5 years ago'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'objective should be assigned properly' do
|
25
|
+
expect(problem_item.objective.objectiveNotes).to eq 'looks pale'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'assessment should be assigned properly' do
|
29
|
+
expect(problem_item.assessment[0]).to eq 'Acute bronchitis'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'plan should be assigned properly' do
|
33
|
+
expect(problem_item.plan.planNotes).to eq 'Antibiotics administration'
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
describe MML::ProcedureItem do
|
2
|
+
let(:operation_element_item) {MML::OperationElementItem.new(title: 'coronary artery bipass grafting', code: 'K552', system: 'MHLW')}
|
3
|
+
let(:procedure_item) {MML::ProcedureItem.new(operation: 'right lobectomy', code: 'K511', system: 'MHLW', operationElement: [operation_element_item], procedureMemo: 'off pump')}
|
4
|
+
|
5
|
+
it 'is an instance of MML::ProcedureItem' do
|
6
|
+
expect(procedure_item).to be_an_instance_of MML::ProcedureItem
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'operation should be assigned properly' do
|
10
|
+
expect(procedure_item.operation).to eq 'right lobectomy'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'code should be assigned properly' do
|
14
|
+
expect(procedure_item.code).to eq 'K511'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'code is optional' do
|
18
|
+
expect {procedure_item.code = nil}.not_to raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'system should be assigned properly' do
|
22
|
+
expect(procedure_item.system).to eq 'MHLW'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'system is optional' do
|
26
|
+
expect {procedure_item.system = nil}.not_to raise_error
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'operationElement should be assigned properly' do
|
30
|
+
expect(procedure_item.operationElement[0].title).to eq 'coronary artery bipass grafting'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'operationElement is optional' do
|
34
|
+
expect {procedure_item.operationElement = nil}.not_to raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'procedureMemo should be assigned properly' do
|
38
|
+
expect(procedure_item.procedureMemo).to eq 'off pump'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'procedureMemo is optional' do
|
42
|
+
expect {procedure_item.procedureMemo = nil}.not_to raise_error
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
describe MML::ProgressCourse do
|
2
|
+
let(:subjective_item) {MML::SubjectiveItem.new(timeExpression: '5 years ago', eventExpression: ['headache'])}
|
3
|
+
let(:subjective) {MML::Subjective.new(freeNotes: 'headache from 5 years ago', subjectiveItem: [subjective_item])}
|
4
|
+
let(:phys_extref) {MML::ExtRef.new(href: 'snd://localhost/chest.wav')}
|
5
|
+
let(:physical_exam_item) {MML::PhysicalExamItem.new(title: 'Chest auscultation', result: 'Respiratory sounds vesicular', interpretation: 'no rale', referenceInfo: [phys_extref])}
|
6
|
+
let(:test_extref) {MML::ExtRef.new(href: 'http://record.net/result')}
|
7
|
+
let(:test_result) {MML::ValueWithLink.new(value: 'WBC 9000/microl', link: [test_extref] )}
|
8
|
+
let(:rx_extref) { MML::ExtRef.new(href: 'http://druginfo/recipie')}
|
9
|
+
let(:rx_record) {MML::ValueWithLink.new(value: 'Ampcilin 1200mg/day', link: [rx_extref])}
|
10
|
+
let(:tx_extref) {MML::ExtRef.new(href: 'http://treatment/fig1')}
|
11
|
+
let(:tx_record) {MML::ValueWithLink.new(value: 'antibiotics, p.o.', link: [tx_extref])}
|
12
|
+
let(:objective) {MML::Objective.new(objectiveNotes: 'looks pale', physicalExam: [physical_exam_item], testResult: test_result, rxRecord: rx_record, txRecord: tx_record)}
|
13
|
+
let(:assessmentItem) {'Acute bronchitis'}
|
14
|
+
let(:test_ref) {MML::ExtRef.new(href: 'http://testserer/laborder')}
|
15
|
+
let(:test_order) {MML::ValueWithLink.new(value: 'Full Blood Count', link: [test_ref])}
|
16
|
+
let(:rx_ref) {MML::ExtRef.new(href: 'http://rxorder/injection')}
|
17
|
+
let(:rx_order) {MML::ValueWithLink.new(value:'Rp1. Ampicilin 3.0g div', link: [rx_ref])}
|
18
|
+
let(:tx_ref) {MML::ExtRef.new(href: 'http://txorder/care')}
|
19
|
+
let(:tx_order) {MML::ValueWithLink.new(value: 'cooling', link: [tx_ref])}
|
20
|
+
let(:plan) {MML::Plan.new(testOrder: test_order, rxOrder: rx_order, txOrder: tx_order, planNotes: 'Antibiotics administration')}
|
21
|
+
let(:problem_item) {MML::ProblemItem.new(problem: 'headache', dxUid: '0012-3330-abdc', subjective: subjective, objective: objective, assessment: [assessmentItem], plan: plan)}
|
22
|
+
let(:extref) {MML::ExtRef.new(href: 'ehr://1023.4355.922/head/value')}
|
23
|
+
let(:progress_course) {MML::ProgressCourse.new(freeExpression: '12/10 consciousness clear', extRef: [extref], structuredExpression: [problem_item])}
|
24
|
+
|
25
|
+
it 'is an instance of MML::ProgressCourse' do
|
26
|
+
expect(progress_course).to be_an_instance_of MML::ProgressCourse
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'freeExpression should be assigned properly' do
|
30
|
+
expect(progress_course.freeExpression).to eq '12/10 consciousness clear'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'extref should be assigned properly' do
|
34
|
+
expect(progress_course.extRef[0].href).to eq 'ehr://1023.4355.922/head/value'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'problem_item should be assigned to stracturedExpression' do
|
38
|
+
expect(progress_course.structuredExpression[0].problem).to eq 'headache'
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#to_xml' do
|
42
|
+
subject {progress_course.to_xml}
|
43
|
+
|
44
|
+
it {should match '<mmlPc:ProgressCourseModule>'}
|
45
|
+
it {should match '<mmlPc:FreeExpression>12/10 consciousness clear<mmlCm:extRef mmlCm:href="ehr://1023.4355.922/head/value"/></mmlPc:FreeExpression>'}
|
46
|
+
it {should match '<mmlPc:structuredExpression>'}
|
47
|
+
it {should match '<mmlPc:problemItem>'}
|
48
|
+
it {should match '<mmlPc:problem mmlPc:dxUid="0012-3330-abdc">headache</mmlPc:problem>'}
|
49
|
+
it {should match '<mmlPc:subjective><mmlPc:freeNotes>headache from 5 years ago</mmlPc:freeNotes>'}
|
50
|
+
it {should match '<mmlPc:subjectiveItem><mmlPc:timeExpression>5 years ago</mmlPc:timeExpression>'}
|
51
|
+
it {should match '<mmlPc:eventExpression>headache</mmlPc:eventExpression></mmlPc:subjectiveItem></mmlPc:subjective>'}
|
52
|
+
it {should match '<mmlPc:objective>'}
|
53
|
+
it {should match '<mmlPc:objectiveNotes>looks pale</mmlPc:objectiveNotes>'}
|
54
|
+
it {should match '<mmlPc:physicalExam>'}
|
55
|
+
it {should match '<mmlPc:physicalExamItem>'}
|
56
|
+
it {should match '<mmlPc:title>Chest auscultation</mmlPc:title>'}
|
57
|
+
it {should match '<mmlPc:result>Respiratory sounds vesicular</mmlPc:result>'}
|
58
|
+
it {should match '<mmlPc:referenceInfo><mmlCm:extRef mmlCm:href="snd://localhost/chest.wav"/></mmlPc:referenceInfo>'}
|
59
|
+
it {should match '<mmlPc:interpretation>no rale</mmlPc:interpretation>'}
|
60
|
+
it {should match '</mmlPc:physicalExamItem>'}
|
61
|
+
it {should match '</mmlPc:physicalExam>'}
|
62
|
+
it {should match '<mmlPc:testResult>WBC 9000/microl<mmlCm:extRef mmlCm:href="http://record.net/result"/></mmlPc:testResult>'}
|
63
|
+
it {should match '<mmlPc:rxRecord>Ampcilin 1200mg/day<mmlCm:extRef mmlCm:href="http://druginfo/recipie"/></mmlPc:rxRecord>'}
|
64
|
+
it {should match '<mmlPc:txRecord>antibiotics, p.o.<mmlCm:extRef mmlCm:href="http://treatment/fig1"/></mmlPc:txRecord>'}
|
65
|
+
it {should match '</mmlPc:objective>'}
|
66
|
+
it {should match '<mmlPc:assessment>'}
|
67
|
+
it {should match '<mmlPc:assessmentItem>Acute bronchitis</mmlPc:assessmentItem>'}
|
68
|
+
it {should match '</mmlPc:assessment>'}
|
69
|
+
it {should match '<mmlPc:plan>'}
|
70
|
+
it {should match '<mmlPc:testOrder>Full Blood Count<mmlCm:extRef mmlCm:href="http://testserer/laborder"/></mmlPc:testOrder>'}
|
71
|
+
it {should match '<mmlPc:rxOrder>Rp1. Ampicilin 3.0g div<mmlCm:extRef mmlCm:href="http://rxorder/injection"/></mmlPc:rxOrder>'}
|
72
|
+
it {should match '<mmlPc:txOrder>cooling<mmlCm:extRef mmlCm:href="http://txorder/care"/></mmlPc:txOrder>'}
|
73
|
+
it {should match '<mmlPc:planNotes>Antibiotics administration</mmlPc:planNotes>'}
|
74
|
+
it {should match '</mmlPc:plan>'}
|
75
|
+
it {should match '</mmlPc:problemItem>'}
|
76
|
+
it {should match '</mmlPc:structuredExpression>'}
|
77
|
+
it {should match '</mmlPc:ProgressCourseModule>'}
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
describe MML::PublicInsuranceItem do
|
3
|
+
let(:public_insurance_item) {MML::PublicInsuranceItem.new(priority: '1', providerName: '公費', provider: '15450034', recipient: '0009043', startDate: '1997-09-30', expiredDate: '1999-09-30', paymentRatio: 10_000, ratioType: 'fix')}
|
4
|
+
|
5
|
+
it 'should be an instance of PublicInsurance' do
|
6
|
+
expect(public_insurance_item).to be_an_instance_of MML::PublicInsuranceItem
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'priority should be assigned properly' do
|
10
|
+
expect(public_insurance_item.priority).to eq '1'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'prioriti is mandatory' do
|
14
|
+
expect{public_insurance_item.priority=nil}.to raise_error ArgumentError
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'providerName should be assigned properly' do
|
18
|
+
expect(public_insurance_item.providerName).to eq '公費'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'providerName is optional' do
|
22
|
+
expect{public_insurance_item.providerName = nil}.not_to raise_error
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'provider should be assigned properly' do
|
26
|
+
expect(public_insurance_item.provider).to eq '15450034'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'provider is mandatory' do
|
30
|
+
expect{public_insurance_item.provider = nil}.to raise_error ArgumentError
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'recipient should be assigned properly' do
|
34
|
+
expect(public_insurance_item.recipient).to eq '0009043'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'recipient is mandatory' do
|
38
|
+
expect{public_insurance_item.recipient = nil}.to raise_error ArgumentError
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'startDate should be assigned properly' do
|
42
|
+
expect(public_insurance_item.startDate).to eq '1997-09-30'
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'startDate is mandatory' do
|
46
|
+
expect{public_insurance_item.startDate = nil}.to raise_error ArgumentError
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'expiredDate should be assigned properly' do
|
50
|
+
expect(public_insurance_item.expiredDate).to eq '1999-09-30'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'expiredDate is mandatory' do
|
54
|
+
expect{public_insurance_item.expiredDate=nil}.to raise_error ArgumentError
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'paymentRatio should be assigned properly' do
|
58
|
+
expect(public_insurance_item.paymentRatio).to eq 10_000
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'ratioType should be assigned properly' do
|
62
|
+
expect(public_insurance_item.ratioType).to eq 'fix'
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe MML::Race do
|
2
|
+
let(:race) { MML::Race.new(value: 'Japanese', raceCode: '2039-6', raceCodeId: 'Race & Ethnicity - CDC') }
|
3
|
+
|
4
|
+
it 'is an instance of MML::Race' do
|
5
|
+
expect(race).to be_an_instance_of MML::Race
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'value should be assigned properly' do
|
9
|
+
expect(race.value).to eq 'Japanese'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'raceCode should be assigned properly' do
|
13
|
+
expect(race.raceCode).to eq '2039-6'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'raceCodeId should be assigned properly' do
|
17
|
+
expect(race.raceCodeId).to eq 'Race & Ethnicity - CDC'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
describe MML::RegisteredDiagnosis do
|
2
|
+
let(:dx_item1) {MML::DxItem.new(name: 'carcinoid', code: 'C189.1', system: 'ICD10r')}
|
3
|
+
let(:dx_item2) {MML::DxItem.new(name: 'colon')}
|
4
|
+
let(:category1) {MML::DiagnosticCategory.new(value: 'mainDiagnosis', tableId: 'MML0012')}
|
5
|
+
let(:category2) {MML::DiagnosticCategory.new(value: 'academicDiagnosis', tableId: 'MML0013')}
|
6
|
+
let(:registered_diagnosis) {MML::RegisteredDiagnosis.new(diagnosis: 'colon carcinoid', code: 'C189', system: 'ICD10', diagnosisContents: [dx_item1, dx_item2], categories: [category1, category2], startDate: '2013-10-01', endDate: '2018-03-31', outcome: 'fullyRecovered', firstEncounterDate: '2013-04-01', relatedHealthInsurance: '0aae5960-667c-11d3-9751-00105a6792e8')}
|
7
|
+
|
8
|
+
it 'is an instance of MML::RegisteredDiagnosis' do
|
9
|
+
expect(registered_diagnosis).to be_an_instance_of MML::RegisteredDiagnosis
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'diagnosis should be assigned properly' do
|
13
|
+
expect(registered_diagnosis.diagnosis).to eq 'colon carcinoid'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'diagnosis is mandatory' do
|
17
|
+
expect {registered_diagnosis.diagnosis = nil}.to raise_error ArgumentError
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'code should be assigned properly' do
|
21
|
+
expect(registered_diagnosis.code).to eq 'C189'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'code is optional' do
|
25
|
+
expect{registered_diagnosis.code = nil}.not_to raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'system should be assigned properly' do
|
29
|
+
expect(registered_diagnosis.system).to eq 'ICD10'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'system is optional' do
|
33
|
+
expect{registered_diagnosis.system = nil}.not_to raise_error
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'diangosisContents should be assigned properly' do
|
37
|
+
it 'the 1st DxItem name is cartinoid' do
|
38
|
+
expect(registered_diagnosis.diagnosisContents[0].name).to eq 'carcinoid'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'the 2nd DxItem name is colon' do
|
42
|
+
expect(registered_diagnosis.diagnosisContents[1].name).to eq 'colon'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'category should be assigned properly' do
|
47
|
+
it '1st category is mainDiagnosis' do
|
48
|
+
expect(registered_diagnosis.categories[0].value).to eq 'mainDiagnosis'
|
49
|
+
end
|
50
|
+
|
51
|
+
it '2nd category tableId is MML0013' do
|
52
|
+
expect(registered_diagnosis.categories[1].tableId).to eq 'MML0013'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'startDate should be asigned properly' do
|
57
|
+
expect(registered_diagnosis.startDate).to eq '2013-10-01'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'startDate is optional' do
|
61
|
+
expect{registered_diagnosis.startDate = nil}.not_to raise_error
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'endDate should be assigned properly' do
|
65
|
+
expect(registered_diagnosis.endDate).to eq '2018-03-31'
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'endDate is optional' do
|
69
|
+
expect{registered_diagnosis.endDate = nil}.not_to raise_error
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'outcome should be assigned properly' do
|
73
|
+
expect(registered_diagnosis.outcome).to eq 'fullyRecovered'
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'outcome is optional' do
|
77
|
+
expect{registered_diagnosis.outcome = nil}.not_to raise_error
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'firstEncounterDate' do
|
81
|
+
expect(registered_diagnosis.firstEncounterDate).to eq '2013-04-01'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'firstEncounterDate is optional' do
|
85
|
+
expect{registered_diagnosis.firstEncounterDate = nil}.not_to raise_error
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'relatedHealthInsurance should be assigned properly' do
|
89
|
+
expect(registered_diagnosis.relatedHealthInsurance).to eq '0aae5960-667c-11d3-9751-00105a6792e8'
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'relatedHealthInsurance is optional' do
|
93
|
+
expect{registered_diagnosis.relatedHealthInsurance=nil}.not_to raise_error
|
94
|
+
end
|
95
|
+
|
96
|
+
describe '#to_xml' do
|
97
|
+
subject {registered_diagnosis.to_xml}
|
98
|
+
|
99
|
+
it {should match '<mmlRd:RegisteredDiagnosisModule>'}
|
100
|
+
it {should match '<mmlRd:diagnosis'}
|
101
|
+
it {should match 'mmlRd:code="C189"'}
|
102
|
+
it {should match 'mmlRd:system="ICD10"'}
|
103
|
+
it {should match '>colon carcinoid</mmlRd:diagnosis>'}
|
104
|
+
it {should match '<mmlRd:diagnosisContens>'}
|
105
|
+
it {should match '<mmlRd:dxItem>'}
|
106
|
+
it {should match '<mmlRd:name'}
|
107
|
+
it {should match 'mmlRd:code="C189.1"'}
|
108
|
+
it {should match 'mmlRd:system="ICD10r'}
|
109
|
+
it {should match '>carcinoid</mmlRd:name>'}
|
110
|
+
it {should match '</mmlRd:dxItem>'}
|
111
|
+
it {should match '<mmlRd:dxItem><mmlRd:name>colon</mmlRd:name></mmlRd:dxItem>'}
|
112
|
+
it {should match '</mmlRd:diagnosisContens>'}
|
113
|
+
it {should match '<mmlRd:categories>'}
|
114
|
+
it {should match '<mmlRd:category mmlRd:tableId="MML0012">mainDiagnosis</mmlRd:category>'}
|
115
|
+
it {should match '<mmlRd:category mmlRd:tableId="MML0013">academicDiagnosis</mmlRd:category>'}
|
116
|
+
it {should match '</mmlRd:categories>'}
|
117
|
+
it {should match '<mmlRd:startDate>2013-10-01</mmlRd:startDate>'}
|
118
|
+
it {should match '<mmlRd:endDate>2018-03-31</mmlRd:endDate>'}
|
119
|
+
it {should match '<mmlRd:outcome>fullyRecovered</mmlRd:outcome>'}
|
120
|
+
it {should match '<mmlRd:firstEncounterDate>2013-04-01</mmlRd:firstEncounterDate>'}
|
121
|
+
it {should match '<mmlRd:relatedHealthInsurance mmlRd:uid="0aae5960-667c-11d3-9751-00105a6792e8"/>'}
|
122
|
+
it {should match '</mmlRd:RegisteredDiagnosisModule>'}
|
123
|
+
end
|
124
|
+
end
|