Class: Renalware::UKRDC::CreatePatientXMLFile::Payload

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/ukrdc/create_patient_xml_file.rb

Instance Method Summary collapse

Instance Method Details

#time_neutral_payloadObject

Remove the time elements from SendingFacility e.g.

<SendingFacility channelName='Renalware' time='2018-02-26T13:18:02+00:00'/>

becomes

<SendingFacility channelName='Renalware'/>

This allows us to do payload comparisons independent of the time they were sent.



134
135
136
137
138
139
# File 'app/models/renalware/ukrdc/create_patient_xml_file.rb', line 134

def time_neutral_payload
  payload
    .gsub(%r{<Stream>[^<]*<\/Stream>}, "<Stream>removed</Stream>")
    .gsub(/ (time|start|stop)=["'][^'"]*['"]/, "")
    .gsub(%r{<UpdatedOn>[^<]*<\/UpdatedOn>}, "<UpdatedOn>removed</UpdatedOn>")
end

#to_md5_hashObject



124
125
126
# File 'app/models/renalware/ukrdc/create_patient_xml_file.rb', line 124

def to_md5_hash
  @to_md5_hash ||= Digest::MD5.hexdigest(time_neutral_payload)
end