view · edit · sidebar · attach · print · history

20111031-replace-doctor-link-format-oddb_org

<< | Index | >>


  1. Replace Doctor link with ean-code
  2. Replace Doctor korrigieren button link
  3. Replace Email URL when korrigieren button is clicked
  4. Replace Spital link

Goal/Estimate/Evaluation
  • Replace Doctor link with Eancode / 100% / 90%
Commit

Replace Doctor link with ean-code

Link

Note

  • There are 4058 doctors who do not have ean code
ch.oddb> doctors.values.length
-> 34663
ch.oddb> doctors.values.select{|d| !d.ean13}.length
-> 4058

Algorithm

  • Basically ean-code link is used but if there is no ean-code for a doctor then oid link is used instead of ean-code link

Updates

  • src/util/validator.rb
   alias :ean :ean13
  • src/state/global.rb
      def doctor
        model = if ean = @session.user_input(:ean)
                   @session.search_doctors(ean).first
                 elsif oid = @session.user_input(:oid)
                   @session.search_doctor(oid)
                 end
        if model
          State::Doctors::Doctor.new(@session, model)
        end
      end
  • src/state/admin/root.rb
  def doctor
    model = if ean = @session.user_input(:ean)
               @session.search_doctors(ean).first
             elsif oid = @session.user_input(:oid)
               @session.search_doctor(oid)
             end
    if model
      State::Doctors::RootDoctor.new(@session, model)
    end
  end
  • src/view/doctors/doctor_list.rb
  def name(model)
    link = View::PointerLink.new(:name, model, @session, self)
    if ean = @model.ean13
      link.href = @lookandfeel._event_url(:doctor, {:ean => ean})
    else
      link.href = @lookandfeel._event_url(:doctor, {:oid => doctor_id})
    end
    link
  end

Note(IMPORTANT)

  • We believe that ean code is not duplicated and actually there is no duplicated eancode at the moment, but it is not certified in the code
  • eancode should not be checked when doctor data is updated

VCard link

Update

  • src/state/global.rb
      def vcard
        doctor = if ean_or_oid = @session.user_input(:doctor)
                   @session.search_doctors(ean_or_oid).first or @session.app.doctor(ean_or_oid)
                 elsif pointer = @session.user_input(:pointer)
                   pointer.resolve(@session)
                 end
        State::Doctors::VCard.new(@session, doctor) if doctor
      end
  • src/view/doctors/doctor_list.rb
 def name(model)
    link = View::PointerLink.new(:name, model, @session, self)
    if ean = model.ean13 and ean.to_s.strip != ""
      link.href = @lookandfeel._event_url(:doctor, {:ean => ean})
    else
      link.href = @lookandfeel._event_url(:doctor, {:oid => model.oid})
    end
    link
 end
  • src/view/doctors/doctor.rb
 def vcard(model)
    link = View::PointerLink.new(:vcard, model, @session, self)
    ean_or_oid = if ean = model.ean13 and ean.to_s.strip != ""
                   ean
                 else
                   model.oid
                 end
    link.href = @lookandfeel._event_url(:vcard, {:doctor => ean_or_oid})
    link
 end

Commit

Replace Doctor korrigieren button link

Update

  • src/state/global.rb
      def suggest_address
        keys = [:pointer]
        input = user_input(keys, keys)
        if pointer = input[:pointer]
          if(!error?)
            addr = pointer.resolve(@session)
            if(addr.nil?)
              ## simulate an address
              addr = Address2.new
              if(parent = pointer.parent.resolve(@session))
                addr.name = parent.fullname
              end
              addr.pointer = pointer
            end
            SuggestAddress.new(@session, addr)
          end
        else
          doctor = if oid_or_ean = @session.user_input(:doctor)
                     @session.search_doctor(oid_or_ean) || @session.search_doctors(oid_or_ean).first
                   end
          if doctor and addr = doctor.address(@session.user_input(:address))
            SuggestAddress.new(@session, addr)
          end
        end
      end 
  • src/view/address.rb
 def correct(model)
    button = HtmlGrid::Button.new(:correct,
      model, @session, self)
    args = if ean = @session.user_input(:ean) and doctors = @session.search_doctors(ean) and doctor = doctors.first \
             and address = doctor.addresses.index(model)
      [
        :doctor, ean,
        :address, address,
        :zone, @session.zone,
      ]
    elsif doctor_oid = @session.persistent_user_input(:oid) and doctor = @session.search_doctor(doctor_oid)       and address = doctor.addresses.index(model)
      [
        :doctor, doctor_oid,
        :address, address,
        :zone, @session.zone,
      ]
    else
      {
        :pointer  =>  model.pointer,
        :zone     =>  @session.zone,
      }
    end
    url = @lookandfeel._event_url(:suggest_address, args)
    button.set_attribute('onclick',
      "document.location.href='#{url}'")
    button
 end

Commit

Replace Email URL when korrigieren button is clicked

Links

Process

  1. Search a doctor
  2. Korrigieren
  3. Vorschlag senden (Email is sent) ODDB::State::SuggestAddress
  4. Confirmation

Note

  • ODDB::State::SuggestAddress is used before 'vorschlag senden'
  • ODDB::State::Admin::AddressSuggestion is used after getting an email
  • App#update now uses a pointer instance for the update
  • State::SuggestAddress#save_suggestion still uses Pointer instance

Commit

Replace Spital link

Link

Update

  • src/state/global.rb
  • src/state/admin/root.rb
  • src/util/validator.rb
view · edit · sidebar · attach · print · history
Page last modified on November 01, 2011, at 01:15 PM