module Medreg

Constants

ARCHIVE_PATH
BA_types
BetriebeURL
BetriebeXLS_URL
COL

GLN Person Name Vorname PLZ Ort Bewilligungskanton Land Diplom BTM Berechtigung Bewilligung Selbstdispensation Bemerkung Selbstdispensation

COMPANY_COL

GLN Person Name Vorname PLZ Ort Bewilligungskanton Land Diplom BTM Berechtigung Bewilligung Selbstdispensation Bemerkung Selbstdispensation

Companies_CSV
Companies_YAML
Companies_curr
CompanyInfo
ExampleUsage

ResilientLoop is a helper class for running long lasting jobs like imports It has the following characterstics

  • Possible to restart a failed job at the failing id

  • Retry an import after a timeout (e.g. of 10 seconds)


requirements:


Needed is state-id (e.g. an EAN13 code) which allows to distingish whether a loop item was already processed or not


implementation:


the state is saved in a text file

ID
LOG_PATH
Mechanize_Log
MedRegOmURL
MedRegPerson_XLS_URL
PersonInfo
Personen_CSV
Personen_Candidates
Personen_YAML
RegExpBetriebDetail
TimeStamp
VERSION

Public Class Methods

log(msg) click to toggle source
# File lib/medreg/medreg.rb, line 15
def Medreg.log(msg)
  $stdout.puts    "#{Time.now}:  #{ID} #{msg}" # unless defined?(Minitest)
  $stdout.flush
  @@logfile ||= File.open(File.join(LOG_PATH, "#{ID}.log"), 'a+')
  @@logfile.puts "#{Time.now}: #{msg}"
end
run(only_run=false) click to toggle source
# File lib/medreg/medreg.rb, line 22
def Medreg.run(only_run=false)
  Medreg.log("Starting with only_run #{only_run}")
  import_company = (not only_run or only_run.match(/compan/i))
  import_person  = (not only_run or only_run.match(/person/i))
  if import_company
    importer = Medreg::CompanyImporter.new
    importer.update
  end
  if import_person
    importer = Medreg::PersonImporter.new
    importer.update
  end
  Medreg.log("Finished.")
end