Class: FHIR::SmokingStatus

Inherits:
Rubrics
  • Object
show all
Defined in:
lib/rubrics/smoking_status.rb

Constant Summary collapse

SMOKING_CODES =
[
  '449868002', #Current every day smoker  
  '428041000124106', #Current some day smoker 
  '8517006', #Former smoker 
  '266919005', #Never smoker  
  '77176002', #Smoker, current status unknown  
  '266927001', #Unknown if ever smoked  
  '428071000124103', #Current Heavy tobacco smoker  
  '428061000124105' #Current Light tobacco smoker
]

Class Method Summary collapse

Methods inherited from Rubrics

apply, response, rubric

Class Method Details

.smoking_code?(codeableconcept) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
40
# File 'lib/rubrics/smoking_status.rb', line 37

def self.smoking_code?(codeableconcept)
  return false if codeableconcept.nil? || codeableconcept.coding.nil?
  codeableconcept.coding.any?{|x| x.system=='http://loinc.org' && x.code=='72166-2'}
end

.smoking_observation?(resource) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rubrics/smoking_status.rb', line 33

def self.smoking_observation?(resource)
  smoking_code?(resource.code) && smoking_value?(resource.valueCodeableConcept)
end

.smoking_value?(codeableconcept) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/rubrics/smoking_status.rb', line 42

def self.smoking_value?(codeableconcept)
  return false if codeableconcept.nil? || codeableconcept.coding.nil?
  codeableconcept.coding.any?{|x| x.system=='http://snomed.info/sct' && SMOKING_CODES.include?(x.code)}
end