class PDS::Patient
Attributes
Public Class Methods
Source
# File app/models/pds/patient.rb, line 14 def find(nhs_number) response = NHS::PDS.get_patient(nhs_number) return unless response from_pds_fhir_response(response.body) end
Source
# File app/models/pds/patient.rb, line 21 def search( family_name:, given_name:, date_of_birth:, address_postcode:, history: true, fuzzy: false ) query = { "family" => family_name, "given" => given_name, "birthdate" => "eq#{date_of_birth}", "address-postalcode" => address_postcode, "_history" => history, # look up previous names and addresses, "_fuzzy-match" => fuzzy }.compact_blank response = NHS::PDS.search_patients(query) return unless response results = response.body return if results["total"].zero? from_pds_fhir_response(results["entry"].first["resource"]) end