view · edit · sidebar · attach · print · history

20111028-replace-analysen-arzt-link-format-oddb_org

<< | Index | >>


  1. Replace Analysen link
  2. Replace Arzt link
  3. Replace Wirkstoff link

Goal/Estimate/Evaluation
  • Replace pointer link in Analysen / 100% / 100%
  • Replace Arzt link / 100% / 80%
  • Replace Wirkstoff link / 30% / 50%
Commit
ToDo
  1. Arzt
  2. Spital
  3. Wirkstoff

Replace Analysen link

Link

Update

  • src/state/global.rb
      def analysis
        if group_cd = @session.user_input(:group) and group = @session.app.analysis_group(group_cd) and position = group.position(@session.user_input(:position))
          State::Analysis::Position.new(@session, position)
        end
      end
  • src/util/validator.rb
    EVENTS = [
      :analysis,
...
    STRINGS = [
      :group,
      :position,
  • src/view/analysis/result.rb
 def description(model)

    link.href = @lookandfeel._event_url(:analysis, [:group, model.groupcd, :position, model.poscd]) if model.is_a?(ODDB::Analysis::Position)

Group Link

Update

  • src/state/global.rb
      def analysis
        if group_cd = @session.user_input(:group) and group = @session.app.analysis_group(group_cd) 
          if position = group.position(@session.user_input(:position))
            State::Analysis::Position.new(@session, position)
          else
            State::Analysis::Group.new(@session, group)
          end
        end
      end
  • src/view/analysis/group.rb
 def description(model, key = :description)

    link.href = @lookandfeel._event_url(:analysis, [:group, model.groupcd, :position, model.poscd])

Backtracking Link (in Analysis::Position view)

Update

  • src/view/analysis/position.rb
 class PointerSteps < ODDB::View::PointerSteps
   def pointer_descr(model, session=@session)
    event = :analysis
    link = PointerLink.new(:pointer_descr, model, @session, self)
    link.href = @lookandfeel._event_url(event, {:group => model.groupcd})
    link
   end
 end
 class Position < View::PrivateTemplate
   CONTENT = PositionComposite
   SNAPBACK_EVENT = :result
   def backtracking(model, session=@session)
    ODDB::View::Analysis::PointerSteps.new(model, @session, self)
   end
 end

Commit

Alphabetical Group link

Update

  • src/view/analysis/result.rb
  def code(model, session=@session)
    link = PointerLink.new(:code, model, session)
    link.href = @lookandfeel._event_url(:analysis, {:group => model.groupcd})
    link
  end

Note

  • This is not committed

Replace Arzt link

Link

Note

  • view will change depending on a login user

Update

  • src/state/global.rb
      def doctor
        if oid = @session.user_input(:oid) and model = @session.app.doctor(oid)
          State::Doctors::Doctor.new(@session, model)
        end
      end
  • src/util/validator.rb
    EVENTS = [
      :doctor,
  • src/state/admin/root.rb
  def doctor
    if oid = @session.user_input(:oid) and model = @session.app.doctor(oid)
      State::Doctors::RootDoctor.new(@session, model)
    end
  end
  • src/state/doctors/doctorlist.rb
 def name(model)
    #View::PointerLink.new(:name, model, @session, self)
    link = View::PointerLink.new(:name, model, @session, self)
    link.href = @lookandfeel._event_url(:doctor, {:oid => model.oid})
    link
 end

vCard link

Update

  • src/state/global.rb
      def vcard
        if oid = @session.user_input(:doctor) and doctor = @session.search_doctor(oid)
          State::Doctors::VCard.new(@session, doctor)
        end
      end
  • src/util/session.rb
    def search_doctor(oid)
      @persistent_user_input[:oid] ||= oid
      @app.doctor(oid)
    end
  • src/util/validator.rb
    STRINGS = [
      :doctor,
  • src/state/doctors/vcard.rb
 def init
    if pointer = @session.user_input(:pointer)
      @model = pointer.resolve(@session)
    end
    super
 end
  • src/view/doctors/doctorlist.rb
  def vcard(model)
    link = View::PointerLink.new(:vcard, model, @session, self)
    link.href = @lookandfeel._event_url(:vcard, {:doctor => model.oid})
    link
  end
  • src/view/doctors/doctors.rb
  def vcard(model)
    link = View::PointerLink.new(:vcard, model, @session, self)
    link.href = @lookandfeel._event_url(:vcard, {:doctor => model.oid})
    link
  end

Korrigieren button

Note

  • Email contents pointer 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
        elsif oid = @session.user_input(:doctor) and doctor = @session.app.doctor(oid) and addr = doctor.address(@session.user_input(:address))
          SuggestAddress.new(@session, addr)
        end
      end
  • src/view/address.rb
    def correct(model)
    button = HtmlGrid::Button.new(:correct,
      model, @session, self)
    args = if 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)

Commit

Email suggest address link

Note

  • the data is saved when 'send' button is clicked
  • src/state/admin/address_suggestion.rb#init set @active_address
  • probably suggested address is called in src/view/admin/address_suggestion
  • pointer.parent method is used
  • Where is the email message creating part?

To be updated

  • src/util/validator.rb
  • src/state/admin/root.rb
  • src/state/global.rb
  • src/state/admin/address_suggestion.rb
  • src/view/admin/address_suggestion.rb

suspend

Replace Wirkstoff link

Note

  • Wirkstoff menu is shown only for admin

ToDo

  1. Wirkformen (Active Agents)
  2. Wirkstoffe (Effective Substance)

Wirkformen link

Note

  • The value of oddbapp.rb#@substances.keys is not always 'oid'

Check

ch.oddb> open('/home/masa/work/test.dat', 'w'){|out| each_substance{|k,v| out.print k, "\n" if k.to_i.to_s != v.oid.to_s}}
masa@masa ~/work $ ls -l test.dat 
-rw-r--r-- 1 masa masa 0 28. Okt 16:43 test.dat

Note

  • for the moment, every key is oid

Update

  • src/state/global.rb
      def substance
        if oid = @session.user_input(:oid) and substance = @session.app.substance(oid)
          State::Admin::TransparentLogin.new(@session, substance)
        end
      end
  • src/state/admin/root.rb
  def substance
    if oid = @session.user_input(:oid) and substance = @session.app.substance(oid)
      State::Substances::Substance.new(@session, substance)
    end
  end
  • src/util/validator.rb
    EVENTS = [
      :substance,
  • src/view/substances/substances.rb
 def name(model, session)
    link = View::PointerLink.new(:name, model, session, self)
    link.href = @lookandfeel._event_url(:substance, {:key => model.oid })
    link
 end
  • src/view/substances/resultlist.rb
 def name(model, session)
    link = View::PointerLink.new(:name, model, session, self)
    link.href = @lookandfeel._event_url(:substance, {:key => model.oid })
    link
 end

Note(IMPORTANT)

  • According to App#substance method (src/util/oddbapp.rb), @session.app.substance(oid) may fail
  • But for the moment all the substances are saved in App#@subsutances (Hash) with its oid as the key
view · edit · sidebar · attach · print · history
Page last modified on October 28, 2011, at 04:57 PM