his_emr_api_lab 2.5.0 → 2.5.1
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.
- checksums.yaml +4 -4
- data/app/serializers/lab/lab_order_serializer.rb +21 -44
- data/lib/lab/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1d2b63e22a684d77087a2aad3c2d1c227188b0b2e1b838969b168310db5a614
|
|
4
|
+
data.tar.gz: 43ff9bbf4c1f1d2dffe73e2331385401fe77f80562a3238a7ffd63309b1212fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc9732083f82839c088453895f5fbdecee50be704584a4bcaf8a98e2bc475b6279c8b5a403432bc6abb54d5bdbf3f1346b996483f02b369df87e17d39b3e9ec2
|
|
7
|
+
data.tar.gz: 25269446cc1c3e1d00866f3304d06a90a8ce5c12c41c0a53892cf26c934395ea5fa9db825ceaf174af8ad8d688d47e301205f9cd4d756e5cbb32ad8c03253a86
|
|
@@ -100,64 +100,41 @@ module Lab
|
|
|
100
100
|
Observation.unscoped.find_by(order_id: order.order_id, concept_id: concept, voided: 0)
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
# The trail methods load the whole association (a handful of rows per
|
|
104
|
+
# order/test) and the "latest" methods take the last loaded row. Calling
|
|
105
|
+
# `.last` on an unloaded association instead issues
|
|
106
|
+
# `ORDER BY obs_datetime DESC, obs_id DESC LIMIT 1`, and with LIMIT 1 MySQL
|
|
107
|
+
# may walk an obs_datetime index (obs_datetime_idx / idx_obs_adherence_lookup)
|
|
108
|
+
# backwards across the whole obs table rather than use obs_order. Loading
|
|
109
|
+
# also caches the rows on the record, so the trail and the latest status
|
|
110
|
+
# share a single query.
|
|
103
111
|
def self.latest_order_status(order)
|
|
104
|
-
|
|
105
|
-
latest_obs = order.status_trail_observations.last
|
|
106
|
-
return nil unless latest_obs
|
|
107
|
-
|
|
108
|
-
updated_by = parse_comments_json(latest_obs.comments)
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
status_id: 0, # status_id not used with text values
|
|
112
|
-
status: latest_obs.value_text,
|
|
113
|
-
timestamp: latest_obs.obs_datetime,
|
|
114
|
-
updated_by: updated_by
|
|
115
|
-
}
|
|
112
|
+
serialize_status_obs(order.status_trail_observations.to_a.last)
|
|
116
113
|
end
|
|
117
114
|
|
|
118
115
|
def self.serialize_order_status_trail(order)
|
|
119
|
-
|
|
120
|
-
order.status_trail_observations.map do |obs|
|
|
121
|
-
updated_by = parse_comments_json(obs.comments)
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
status_id: 0, # status_id not used with text values
|
|
125
|
-
status: obs.value_text,
|
|
126
|
-
timestamp: obs.obs_datetime,
|
|
127
|
-
updated_by: updated_by
|
|
128
|
-
}
|
|
129
|
-
end
|
|
116
|
+
order.status_trail_observations.to_a.map { |obs| serialize_status_obs(obs) }
|
|
130
117
|
end
|
|
131
118
|
|
|
132
119
|
def self.latest_test_status(test)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return nil unless latest_obs
|
|
120
|
+
serialize_status_obs(test.status_trail_observations.to_a.last)
|
|
121
|
+
end
|
|
136
122
|
|
|
137
|
-
|
|
123
|
+
def self.serialize_test_status_trail(test)
|
|
124
|
+
test.status_trail_observations.to_a.map { |obs| serialize_status_obs(obs) }
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def self.serialize_status_obs(obs)
|
|
128
|
+
return nil unless obs
|
|
138
129
|
|
|
139
130
|
{
|
|
140
131
|
status_id: 0, # status_id not used with text values
|
|
141
|
-
status:
|
|
142
|
-
timestamp:
|
|
143
|
-
updated_by:
|
|
132
|
+
status: obs.value_text,
|
|
133
|
+
timestamp: obs.obs_datetime,
|
|
134
|
+
updated_by: parse_comments_json(obs.comments)
|
|
144
135
|
}
|
|
145
136
|
end
|
|
146
137
|
|
|
147
|
-
def self.serialize_test_status_trail(test)
|
|
148
|
-
# Query obs table for test status trail
|
|
149
|
-
test.status_trail_observations.map do |obs|
|
|
150
|
-
updated_by = parse_comments_json(obs.comments)
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
status_id: 0, # status_id not used with text values
|
|
154
|
-
status: obs.value_text,
|
|
155
|
-
timestamp: obs.obs_datetime,
|
|
156
|
-
updated_by: updated_by
|
|
157
|
-
}
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
|
|
161
138
|
# Helper to parse updated_by from obs comments field
|
|
162
139
|
def self.parse_comments_json(comments)
|
|
163
140
|
return {} if comments.blank?
|
data/lib/lab/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: his_emr_api_lab
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.
|
|
4
|
+
version: 2.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elizabeth Glaser Pediatric Foundation Malawi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: couchrest
|