emr_ohsp_interface 1.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c906580f753b4ecd4247310a6e86515ba23ac8f34a022d17c2d133eb8e35ce8
|
4
|
+
data.tar.gz: 0343e303c83d845d8e6764797157e056fdc4a34d3060e28d0978b80c32ed292a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363dcd8068deb4bab8a6ce38463a173e7e32ea958eb0699fae6c9f8a9685ade0d5248227fd7584a3d562462941e6c270a40585aab5621faa7efee3b04191a8df
|
7
|
+
data.tar.gz: 447c8cbb8205eac3365d78b7105674829888ae55c8de36dbf4e4fdb917735ec0263db733d601ec5c10f55237b92b45c52f8f2fee5a956355ddca7473d7baea17
|
@@ -11,6 +11,10 @@ module EmrOhspInterface
|
|
11
11
|
config = JSON.parse(file)
|
12
12
|
end
|
13
13
|
|
14
|
+
def server_config
|
15
|
+
config =YAML.load_file("#{Rails.root}/config/application.yml")
|
16
|
+
end
|
17
|
+
|
14
18
|
def get_ohsp_facility_id
|
15
19
|
file = File.open(Rails.root.join("db","idsr_metadata","emr_ohsp_facility_map.csv"))
|
16
20
|
data = CSV.parse(file,headers: true)
|
@@ -129,11 +133,11 @@ module EmrOhspInterface
|
|
129
133
|
|
130
134
|
#under_five
|
131
135
|
under_five = data.select{|record| calculate_age(record["birthdate"]) < 5}.\
|
132
|
-
collect{|record| record.person_id}
|
136
|
+
collect{|record| record.person_id}.uniq
|
133
137
|
options["<5yrs"] = under_five
|
134
138
|
#above 5 years
|
135
139
|
over_five = data.select{|record| calculate_age(record["birthdate"]) >=5 }.\
|
136
|
-
collect{|record| record.person_id}
|
140
|
+
collect{|record| record.person_id}.uniq
|
137
141
|
|
138
142
|
options[">=5yrs"] = over_five
|
139
143
|
|
@@ -450,7 +454,8 @@ module EmrOhspInterface
|
|
450
454
|
"Referals from other institutions",
|
451
455
|
"OPD total attendance",
|
452
456
|
"Referal to other institutions",
|
453
|
-
"Malaria 5 years and older - new"
|
457
|
+
"Malaria 5 years and older - new",
|
458
|
+
"HIV/AIDS - new"
|
454
459
|
]
|
455
460
|
|
456
461
|
special_under_five_indicators = [
|
@@ -504,27 +509,18 @@ module EmrOhspInterface
|
|
504
509
|
end
|
505
510
|
|
506
511
|
if key.eql?("OPD total attendance")
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
select('encounter.encounter_type, n.family_name, n.given_name,
|
520
|
-
obs.value_coded, obs.obs_datetime, p.*, c.name visit_type,
|
521
|
-
a.state_province district, a.township_division ta, a.city_village village').\
|
522
|
-
order('n.date_created DESC').group('n.person_id, encounter.encounter_id')
|
523
|
-
|
524
|
-
all = data.collect{|record| record.person_id}
|
525
|
-
|
526
|
-
options["ids"] = all
|
527
|
-
|
512
|
+
programID = Program.find_by_name 'OPD Program'
|
513
|
+
data = Encounter.find_by_sql(
|
514
|
+
"SELECT patient_id, DATE_FORMAT(encounter_datetime,'%Y-%m-%d') enc_date
|
515
|
+
FROM encounter e
|
516
|
+
LEFT OUTER JOIN person p ON p.person_id = e.patient_id
|
517
|
+
WHERE e.voided = 0 AND encounter_datetime BETWEEN '" + start_date.to_date.strftime('%Y-%m-%d 00:00:00') +"'
|
518
|
+
AND '" + end_date.to_date.strftime('%Y-%m-%d 23:59:59') + "'
|
519
|
+
AND program_id ='" + programID.program_id.to_s + "'
|
520
|
+
GROUP BY enc_date"
|
521
|
+
).map{|e| e. patient_id}
|
522
|
+
|
523
|
+
options["ids"] = data
|
528
524
|
collection[key] = options
|
529
525
|
end
|
530
526
|
|
@@ -534,11 +530,19 @@ module EmrOhspInterface
|
|
534
530
|
end_date.to_date.strftime('%Y-%m-%d 23:59:59'),'7414').\
|
535
531
|
joins('LEFT JOIN location l ON l.location_id = obs.value_text').\
|
536
532
|
select('obs.person_id').order('obs_datetime DESC')
|
537
|
-
|
538
533
|
all = data.collect{|record| record.person_id}
|
534
|
+
options["ids"] = all
|
535
|
+
collection[key] = options
|
536
|
+
end
|
539
537
|
|
538
|
+
if key.eql?("HIV/AIDS - new")
|
539
|
+
data = ActiveRecord::Base.connection.select_all(
|
540
|
+
"SELECT * FROM temp_earliest_start_date
|
541
|
+
WHERE date_enrolled BETWEEN '#{start_date}' AND '#{end_date}'
|
542
|
+
AND date_enrolled = earliest_start_date
|
543
|
+
GROUP BY patient_id" ).to_hash
|
544
|
+
all = data.collect{|record| record["patient_id"]}
|
540
545
|
options["ids"] = all
|
541
|
-
|
542
546
|
collection[key] = options
|
543
547
|
end
|
544
548
|
|
@@ -632,7 +636,7 @@ module EmrOhspInterface
|
|
632
636
|
def weeks_generator
|
633
637
|
|
634
638
|
weeks = Hash.new
|
635
|
-
first_day = (
|
639
|
+
first_day = (Date.today - (11).month).at_beginning_of_month
|
636
640
|
wk_of_first_day = first_day.cweek
|
637
641
|
|
638
642
|
if wk_of_first_day > 1
|
@@ -671,7 +675,7 @@ module EmrOhspInterface
|
|
671
675
|
def send_data(data,type)
|
672
676
|
# method used to post data to the server
|
673
677
|
#prepare payload here
|
674
|
-
conn =
|
678
|
+
conn = server_config['ohsp']
|
675
679
|
payload = {
|
676
680
|
"dataSet" =>get_data_set_id(type),
|
677
681
|
"period"=>(type.eql?("weekly") ? weeks_generator.last[0] : months_generator.first[0]),
|
@@ -733,18 +737,18 @@ module EmrOhspInterface
|
|
733
737
|
headers:{'Content-Type'=> 'application/json'},
|
734
738
|
payload: payload.to_json,
|
735
739
|
#headers: {accept: :json},
|
736
|
-
user: conn["
|
737
|
-
password: conn["
|
740
|
+
user: conn["username"],
|
741
|
+
password: conn["password"])
|
738
742
|
|
739
743
|
puts send
|
740
744
|
end
|
741
745
|
|
742
746
|
def send_data_to_sms_portal(data, concept_name_collection)
|
743
|
-
conn2 =
|
747
|
+
conn2 = server_config['idsr_sms']
|
744
748
|
data = data.select {|k,v| v.select {|kk,vv| vv.length > 0}.length > 0}
|
745
749
|
payload = {
|
746
|
-
"email"=> conn2["
|
747
|
-
"password" => conn2["
|
750
|
+
"email"=> conn2["username"],
|
751
|
+
"password" => conn2["password"],
|
748
752
|
"emr_facility_id" => Location.current_health_center.id,
|
749
753
|
"emr_facility_name" => Location.current_health_center.name,
|
750
754
|
"payload" => data,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emr_ohsp_interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Justin Manda, Petros Kayange,
|
7
|
+
- Justin Manda, Petros Kayange, Dominic Kasanga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 5.2.4.3
|
19
|
+
version: 7.0.6
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 5.2.4.3
|
26
|
+
version: 7.0.6
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rspec
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,14 +44,14 @@ dependencies:
|
|
50
44
|
requirements:
|
51
45
|
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1'
|
47
|
+
version: '2.1'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: '1'
|
54
|
+
version: '2.1'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: mysql2
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +66,26 @@ dependencies:
|
|
72
66
|
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.6
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '1.3'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.3.6
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.3'
|
75
89
|
description:
|
76
90
|
email:
|
77
91
|
- justinmandah@gmail.com, kayangepetros@gmail.com, dominickasanga@gmail.com
|
@@ -120,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
134
|
- !ruby/object:Gem::Version
|
121
135
|
version: '0'
|
122
136
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.4.10
|
124
138
|
signing_key:
|
125
139
|
specification_version: 4
|
126
140
|
summary: This in a gem that facilitates interfacing of EMR, One Health Surveillance
|