dde_mahis 0.1.4 → 0.1.6
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/services/dde_service.rb +11 -11
- data/app/services/merging_service.rb +3 -3
- data/app/services/rollback_service.rb +2 -2
- data/lib/dde_mahis/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: 69b7d105c7767e5989ec3b1617f6c985c322c298447cf33dd3560e9a8426d77d
|
4
|
+
data.tar.gz: 03351fd8551cbb69ea2dde9e6a1411d4330bf91c6e9708955a5863b8cf9e5de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5736f44a360881606509b037ca814e96021a07db82a7ccff8d00815042a427619da7d6b0e126c4e232b105797e8b0e9fe75c9a198f33f70a396483f91d0e96fa
|
7
|
+
data.tar.gz: 4b4811eb1462631b358ac2a5468c5cd9cee3cdbb3eb96bf264bbae15d9371db43a387dd9665e0d0b43ffbf71c1d95e0174526b7615d4995743036d2cd8c92dcc
|
data/app/services/dde_service.rb
CHANGED
@@ -48,8 +48,8 @@ class DdeService
|
|
48
48
|
# Registers local OpenMRS patient in DdeMahis
|
49
49
|
#
|
50
50
|
# On success patient get two identifiers under the types
|
51
|
-
# '
|
52
|
-
# '
|
51
|
+
# 'Dde Person Document ID' and 'National id'. The
|
52
|
+
# 'Dde Person Document ID' is the patient's record ID in the local
|
53
53
|
# DdeMahis instance and the 'National ID' is the national unique identifier
|
54
54
|
# for the patient.
|
55
55
|
def create_patient(patient)
|
@@ -139,7 +139,7 @@ class DdeService
|
|
139
139
|
|
140
140
|
# Import patients from DdeMahis using doc id
|
141
141
|
def import_patients_by_doc_id(doc_id)
|
142
|
-
doc_id_type = patient_identifier_type('
|
142
|
+
doc_id_type = patient_identifier_type('Dde Person Document ID')
|
143
143
|
locals = patient_service.find_patients_by_identifier(doc_id, doc_id_type).limit(PATIENT_SEARCH_RESULTS_LIMIT)
|
144
144
|
remotes = find_remote_patients_by_doc_id(doc_id)
|
145
145
|
|
@@ -189,7 +189,7 @@ class DdeService
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def find_patient_updates(local_patient_id)
|
192
|
-
dde_doc_id_type = PatientIdentifierType.where(name: '
|
192
|
+
dde_doc_id_type = PatientIdentifierType.where(name: 'Dde Person Document ID')
|
193
193
|
doc_id = PatientIdentifier.find_by(patient_id: local_patient_id, identifier_type: dde_doc_id_type)
|
194
194
|
&.identifier
|
195
195
|
return nil unless doc_id
|
@@ -225,7 +225,7 @@ class DdeService
|
|
225
225
|
response.collect do |match|
|
226
226
|
doc_id = match['person']['id']
|
227
227
|
patient = patient_service.find_patients_by_identifier(
|
228
|
-
doc_id, patient_identifier_type('
|
228
|
+
doc_id, patient_identifier_type('Dde Person Document ID')
|
229
229
|
).first
|
230
230
|
match['person']['patient_id'] = patient&.id
|
231
231
|
match
|
@@ -455,7 +455,7 @@ class DdeService
|
|
455
455
|
# Checks if patient only exists on local database
|
456
456
|
def local_only_patient?(patient)
|
457
457
|
!(patient.patient_identifiers.where(identifier_type: patient_identifier_type('National id')).exists?\
|
458
|
-
&& patient.patient_identifiers.where(identifier_type: patient_identifier_type('
|
458
|
+
&& patient.patient_identifiers.where(identifier_type: patient_identifier_type('Dde Person Document ID')).exists?)
|
459
459
|
end
|
460
460
|
|
461
461
|
# Matches local and remote patient
|
@@ -501,7 +501,7 @@ class DdeService
|
|
501
501
|
[PatientIdentifier.new(identifier: remote_patient['npid'],
|
502
502
|
identifier_type: patient_identifier_type('National ID')),
|
503
503
|
PatientIdentifier.new(identifier: remote_patient['doc_id'],
|
504
|
-
identifier_type: patient_identifier_type('
|
504
|
+
identifier_type: patient_identifier_type('Dde Person Document ID'))]
|
505
505
|
end
|
506
506
|
|
507
507
|
def localise_remote_patient_names(remote_patient)
|
@@ -578,7 +578,7 @@ class DdeService
|
|
578
578
|
}
|
579
579
|
)
|
580
580
|
|
581
|
-
doc_id = patient.patient_identifiers.where(identifier_type: patient_identifier_type('
|
581
|
+
doc_id = patient.patient_identifiers.where(identifier_type: patient_identifier_type('Dde Person Document ID')).first
|
582
582
|
dde_patient[:doc_id] = doc_id.identifier if doc_id
|
583
583
|
|
584
584
|
LOGGER.debug "Converted openmrs person to dde_patient: #{dde_patient}"
|
@@ -607,19 +607,19 @@ class DdeService
|
|
607
607
|
def patient_doc_id(patient)
|
608
608
|
PatientIdentifier
|
609
609
|
.joins(:identifier_type)
|
610
|
-
.merge(PatientIdentifierType.where(name: '
|
610
|
+
.merge(PatientIdentifierType.where(name: 'Dde Person Document ID'))
|
611
611
|
.where(patient: patient)
|
612
612
|
.first
|
613
613
|
&.identifier
|
614
614
|
end
|
615
615
|
|
616
616
|
def dde_doc_id_type
|
617
|
-
PatientIdentifierType.find_by_name('
|
617
|
+
PatientIdentifierType.find_by_name('Dde Person Document ID')
|
618
618
|
end
|
619
619
|
|
620
620
|
def find_patients_by_doc_id(doc_ids)
|
621
621
|
identifiers = PatientIdentifier.joins(:identifier_type)
|
622
|
-
.merge(PatientIdentifierType.where(name: '
|
622
|
+
.merge(PatientIdentifierType.where(name: 'Dde Person Document ID'))
|
623
623
|
.where(identifier: doc_ids)
|
624
624
|
Patient.joins(:identifiers).merge(identifiers).distinct
|
625
625
|
end
|
@@ -81,7 +81,7 @@ class MergingService
|
|
81
81
|
|
82
82
|
national_id_type = patient_identifier_type('National id')
|
83
83
|
old_identifier = patient_identifier_type('Old Identification Number')
|
84
|
-
doc_id_type = patient_identifier_type('
|
84
|
+
doc_id_type = patient_identifier_type('Dde Person Document ID')
|
85
85
|
|
86
86
|
local_patient.patient_identifiers.where(type: [national_id_type, doc_id_type, old_identifier]).each do |identifier|
|
87
87
|
# We are now voiding all ids
|
@@ -93,7 +93,7 @@ class MergingService
|
|
93
93
|
identifier.void("Assigned new id: #{remote_patient['doc_id']}")
|
94
94
|
end
|
95
95
|
|
96
|
-
create_local_patient_identifier(local_patient, remote_patient['doc_id'], '
|
96
|
+
create_local_patient_identifier(local_patient, remote_patient['doc_id'], 'Dde Person Document ID')
|
97
97
|
create_local_patient_identifier(local_patient, find_remote_patient_npid(remote_patient), 'National id')
|
98
98
|
|
99
99
|
local_patient.reload
|
@@ -107,7 +107,7 @@ class MergingService
|
|
107
107
|
end
|
108
108
|
|
109
109
|
identifier_exists['National id',
|
110
|
-
remote_patient['npid']] && identifier_exists['
|
110
|
+
remote_patient['npid']] && identifier_exists['Dde Person Document ID', remote_patient['doc_id']]
|
111
111
|
end
|
112
112
|
|
113
113
|
private
|
@@ -18,7 +18,7 @@ class RollbackService
|
|
18
18
|
@merge_type = record['merge_type']
|
19
19
|
Rails.logger.debug("Processing rollback for patients: #{primary_patient} <=> #{secondary_patient}")
|
20
20
|
process_rollback
|
21
|
-
MergeAudit.find(record['id']).void("Rolling back to #{secondary_patient}")
|
21
|
+
::MergeAudit.find(record['id']).void("Rolling back to #{secondary_patient}")
|
22
22
|
@common_void_reason = nil
|
23
23
|
end
|
24
24
|
end
|
@@ -47,7 +47,7 @@ class RollbackService
|
|
47
47
|
SELECT identifier
|
48
48
|
FROM patient_identifier
|
49
49
|
WHERE patient_id = #{patient_id}
|
50
|
-
AND identifier_type = #{PatientIdentifierType.find_by_name!('
|
50
|
+
AND identifier_type = #{PatientIdentifierType.find_by_name!('Dde Person Document ID').id}
|
51
51
|
SQL
|
52
52
|
result.blank? ? nil : result['identifier']
|
53
53
|
end
|
data/lib/dde_mahis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dde_mahis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brian-mw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|