Sasidhar commited on
Commit
325b9af
1 Parent(s): b8d77bb

Create text_extractor.py

Browse files
Files changed (1) hide show
  1. text_extractor.py +118 -0
text_extractor.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_paragraphs_for_summaries():
2
+ paras =[]
3
+ paras.append("""Stephen is a 53 year old gentleman who does general duties police work. He is married and has an
4
+ 18 year old daughter at home. He is right hand dominant. Cigarettes nil, alcohol rare, allergies nil.
5
+ DVTe nil. Past medical history hyperlipidemia and reflux testicular cancer in 2000 and right knee
6
+ reconstruction in 1987. Medications include Nexium and Crestor.""")
7
+ paras.append("""History presenting complaint: Right knee and right elbow injuries. On 12 January 2020, while at work
8
+ he was trying to apprehend a stolen vehicle. The deployed some road spikes onto the road. The
9
+ stolen vehicle went over the road spikes. He was attempting to retrieve the spikes to prevent
10
+ damage to civilian and police vehicles and while he was doing that, he was hit by a police vehicle
11
+ coming from behind. The police vehicle was approximately doing 50 km/hr. The headlight of the
12
+ police car stuck him on the lateral aspect of the right knee. He jumped in the air and flicked in the air
13
+ with his right elbow also hitting the police car before he flung over a barrier. He was able to mobilise
14
+ afterwards when the adrenaline was taking effect. After he cooled down that night he developed
15
+ significant pain in both the elbow and the knee. The elbow seemed to have settled with time but he
16
+ has got slight discomfort on the lateral epicondyle of the right elbow but otherwise no instability,
17
+ clicking, locking or catching of the elbow.""")
18
+ paras.append("""His knee has medial sided pain. It is an annoying type of pain that is present at rear and with activity.
19
+ It feels like it is getting slightly better but his main problem is that he cannot still fully flex his knee as
20
+ he used to do before the accident. He has noticed some clicking ad a little bit of swelling in the knee.
21
+ He has had no instability but he is still a little bit stiff when he first gets up. He has been treated with
22
+ 4 sessions of physiotherapy. He has had two operations on this knee before when it was
23
+ reconstructed which was an open procedure and an anthroscopy later to shave off the cartilage. He
24
+ never got back to playing rugby after his reconstruction but he was able to do martial arts and all his
25
+ policing duties without any problem.""")
26
+ paras.append("""He is mildly overweight, normal gait and no effusion in the knee and a range of motion of 0 to 110
27
+ degrees which cannot be improved passively. His right elbow has full range of motion and is stable.
28
+ He has had an Xray on right elbow showing no fracture and an xray of knee showed early medial
29
+ compartment osteoarthritis. He has got new clicking in his knee and has been advised to get an MRI
30
+ scan.""")
31
+ paras.append("""As far as his right elbow is concerned, he should reduce weight lifting activity and any repetitive right
32
+ upper limb activity that causes any discomfort. His right knee requires an MRI scan to look for any
33
+ loose bodies and I will see him with the results of the scan. In the meantime, he can continue with
34
+ his general policing duties which he has anyways been doing since the accident""")
35
+ return paras
36
+
37
+ def get_paragraphs_for_entities():
38
+ paras =[]
39
+ paras.append("""18 February2020
40
+ Dr Christine Fowler""")
41
+ paras.append("""Dear Christine,
42
+ Re: Stephen Parrot""")
43
+ paras.append("""Stephen is a 53 year old gentleman who does general duties police work. He is married and has an
44
+ 18 year old daughter at home. He is right hand dominant. Cigarettes nil, alcohol rare, allergies nil.
45
+ DVTe nil. Past medical history hyperlipidemia and reflux testicular cancer in 2000 and right knee
46
+ reconstruction in 1987. Medications include Nexium and Crestor.""")
47
+ paras.append("""History presenting complaint: Right knee and right elbow injuries. On 12 January 2020, while at work
48
+ he was trying to apprehend a stolen vehicle. The deployed some road spikes onto the road. The
49
+ stolen vehicle went over the road spikes. He was attempting to retrieve the spikes to prevent
50
+ damage to civilian and police vehicles and while he was doing that, he was hit by a police vehicle
51
+ coming from behind. The police vehicle was approximately doing 50 km/hr. The headlight of the
52
+ police car stuck him on the lateral aspect of the right knee. He jumped in the air and flicked in the air
53
+ with his right elbow also hitting the police car before he flung over a barrier. He was able to mobilise
54
+ afterwards when the adrenaline was taking effect. After he cooled down that night he developed
55
+ significant pain in both the elbow and the knee. The elbow seemed to have settled with time but he
56
+ has got slight discomfort on the lateral epicondyle of the right elbow but otherwise no instability,
57
+ clicking, locking or catching of the elbow.""")
58
+ paras.append("""His knee has medial sided pain. It is an annoying type of pain that is present at rear and with activity.
59
+ It feels like it is getting slightly better but his main problem is that he cannot still fully flex his knee as
60
+ he used to do before the accident. He has noticed some clicking ad a little bit of swelling in the knee.
61
+ He has had no instability but he is still a little bit stiff when he first gets up. He has been treated with
62
+ 4 sessions of physiotherapy. He has had two operations on this knee before when it was
63
+ reconstructed which was an open procedure and an anthroscopy later to shave off the cartilage. He
64
+ never got back to playing rugby after his reconstruction but he was able to do martial arts and all his
65
+ policing duties without any problem.""")
66
+ paras.append("""He is mildly overweight, normal gait and no effusion in the knee and a range of motion of 0 to 110
67
+ degrees which cannot be improved passively. His right elbow has full range of motion and is stable.
68
+ He has had an Xray on right elbow showing no fracture and an xray of knee showed early medial
69
+ compartment osteoarthritis. He has got new clicking in his knee and has been advised to get an MRI
70
+ scan.""")
71
+ paras.append("""As far as his right elbow is concerned, he should reduce weight lifting activity and any repetitive right
72
+ upper limb activity that causes any discomfort. His right knee requires an MRI scan to look for any
73
+ loose bodies and I will see him with the results of the scan. In the meantime, he can continue with
74
+ his general policing duties which he has anyways been doing since the accident""")
75
+ paras.append("""Kind regards,
76
+ Dr Jason Sanders""")
77
+ return paras
78
+
79
+ def get_text_from_ocr_engine():
80
+
81
+ return """18 February2020
82
+ Dr Christine Fowler
83
+ Dear Christine,
84
+ Re: Stephen Parrot
85
+ Stephen is a 53 year old gentleman who does general duties police work. He is married and has an
86
+ 18 year old daughter at home. He is right hand dominant. Cigarettes nil, alcohol rare, allergies nil.
87
+ DVTe nil. Past medical history hyperlipidemia and reflux testicular cancer in 2000 and right knee
88
+ reconstruction in 1987. Medications include Nexium and Crestor.
89
+ History presenting complaint: Right knee and right elbow injuries. On 12 January 2020, while at work
90
+ he was trying to apprehend a stolen vehicle. The deployed some road spikes onto the road. The
91
+ stolen vehicle went over the road spikes. He was attempting to retrieve the spikes to prevent
92
+ damage to civilian and police vehicles and while he was doing that, he was hit by a police vehicle
93
+ coming from behind. The police vehicle was approximately doing 50 km/hr. The headlight of the
94
+ police car stuck him on the lateral aspect of the right knee. He jumped in the air and flicked in the air
95
+ with his right elbow also hitting the police car before he flung over a barrier. He was able to mobilise
96
+ afterwards when the adrenaline was taking effect. After he cooled down that night he developed
97
+ significant pain in both the elbow and the knee. The elbow seemed to have settled with time but he
98
+ has got slight discomfort on the lateral epicondyle of the right elbow but otherwise no instability,
99
+ clicking, locking or catching of the elbow.
100
+ His knee has medial sided pain. It is an annoying type of pain that is present at rear and with activity.
101
+ It feels like it is getting slightly better but his main problem is that he cannot still fully flex his knee as
102
+ he used to do before the accident. He has noticed some clicking ad a little bit of swelling in the knee.
103
+ He has had no instability but he is still a little bit stiff when he first gets up. He has been treated with
104
+ 4 sessions of physiotherapy. He has had two operations on this knee before when it was
105
+ reconstructed which was an open procedure and an anthroscopy later to shave off the cartilage. He
106
+ never got back to playing rugby after his reconstruction but he was able to do martial arts and all his
107
+ policing duties without any problem.
108
+ He is mildly overweight, normal gait and no effusion in the knee and a range of motion of 0 to 110
109
+ degrees which cannot be improved passively. His right elbow has full range of motion and is stable.
110
+ He has had an Xray on right elbow showing no fracture and an xray of knee showed early medial
111
+ compartment osteoarthritis. He has got new clicking in his knee and has been advised to get an MRI
112
+ scan.
113
+ As far as his right elbow is concerned, he should reduce weight lifting activity and any repetitive right
114
+ upper limb activity that causes any discomfort. His right knee requires an MRI scan to look for any
115
+ loose bodies and I will see him with the results of the scan. In the meantime, he can continue with
116
+ his general policing duties which he has anyways been doing since the accident.
117
+ Kind regards,
118
+ Dr Jason Sanders"""