isdrugallergic 0.0.4 → 0.0.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isdrugallergic.rb +42 -23
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e76900a45bb9fabcc2ae1a212dfd0a0d3238ecff777da24a697a3f758e35b82
4
- data.tar.gz: ef43fac52bd85f501c2deb047486666a65614bc91724422366646f072d43f10c
3
+ metadata.gz: dd6d2367362b2ff209b5aff069fb9ead527fb1635c6afb1eab613686d37ee910
4
+ data.tar.gz: c9b450897a4c2079f88626c82a2c3ca3e90ddb8134af32beafe0b3a7686d0323
5
5
  SHA512:
6
- metadata.gz: 640bfff99eeaff71ced201add9ac581e7cb1e596b5a2e20dd84104cfd922a78563704e45bcabbd99531206f1041a3e2b761c5e7ccbbec8bb73387990d2c1c3c1
7
- data.tar.gz: 9474be382b40dea9943b51fc9f776a3d5b88d908d298b6965bfbdae3aa39011f8e5edf59c6a3bb7192aecfd5d0d8f844e3490ccb2826bdad9d91175d0b2b1659
6
+ metadata.gz: 74d4c2b18991942c466c6162340442ad94b217ef2350d0e3ef9403288ab846d71d797bef1f7e412f899a962bf66f7e7f03d7dc894ca041d120db7f945494457f
7
+ data.tar.gz: 971cf2d8898c7bbc85990d2630a116138f4155f1b2cf5ef376b28a6a9deba3d12ba7cae51b816cc51af370cf77767ce8e3c6adcd19a46dc9b8f9f1cd5e502f48
@@ -2,31 +2,50 @@ class Checkallergy
2
2
 
3
3
  def self.check_allergy(presc_drug, allergies)
4
4
 
5
+ #initialize variables
6
+ @presc_drug = presc_drug
7
+ @allergies allergies
5
8
 
6
- #initialize variables
7
- @presc_drug = presc_drug
8
- @allergies = allergies
9
-
10
-
11
- #loop through each patient allergy
12
- @allergies.each do |allergy|
13
-
14
- # puts("\n\n\n"+allergy.allergy_name.downcase+" <==> "+@presc_drug.downcase+"\n\n\n")
15
- if allergy.allergy_name.downcase.eql? @presc_drug.downcase
16
- # puts("Allergic Conflict Found")
17
- @status_code = 0
18
- @status_message = "There was an allergy conflict with the proposed drug:"+@presc_drug
19
- break
20
- else
21
- # puts("Allergic conflict not found")
22
- @status_code = 1
23
- @status_message = "No allergy conflicts found with drug:"+@presc_drug
24
- end
9
+ #if patient allergies are nil return false
10
+ if allergies.nil?
25
11
 
26
- end
12
+ status_code = 0
13
+ status_message = "No allergy conflicts found with drug:"+@presc_drug
14
+
15
+ #if patient has allergies
16
+ else
27
17
 
28
- #return response to the caller with the allergy conflict status
29
- return({"status_code":@status_code, "status_message":@status_message})
18
+ #if allergy_match? method returns true: return with conflict error
19
+ if allergy_match?
20
+ status_code = 1
21
+ status_message = "There was an allergy conflict with the proposed drug:"+@presc_drug
22
+
23
+ #if allergy_match? method returns flase: return no conflict
24
+ else
25
+ status_code = 0
26
+ status_message = "No allergy conflicts found with drug:"+@presc_drug
27
+ end
28
+ end
29
+
30
+ #return response to the caller with the allergy conflict status
31
+ return({"status_code":status_code, "status_message":status_message})
30
32
 
31
33
  end
32
- end #end module
34
+ end
35
+
36
+
37
+ def allergy_match?
38
+ #iterate through each patient allergy and compare to prescription drug
39
+ @allergies.each do |allergy|
40
+
41
+ # puts("\n\n\n"+allergy.downcase+" <==> "+@presc_drug.downcase+"\n\n\n")
42
+ if allergy.allergy_name.downcase.eql? @presc_drug.downcase
43
+ return true
44
+ break
45
+ else
46
+ # puts("Allergic conflict not found")
47
+ return false
48
+ end
49
+
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isdrugallergic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - PaulByrne