 pg = require 'pg'
 pgurl = dbconf.postgres
 
-DEBUG_updateRowsLimit =  null  # set for debugging
-OMIT_NULL_VALUE_FIELDS_IN_COMMITMENTS_JSON = true
- 
-PATH = "data/imports/"
-TEMP_DIR = "temp"
-AIDDATA_TEMP_FILE = PATH + TEMP_DIR + "/aiddata.json"
-LOCATIONS_TEMP_FILE = PATH + TEMP_DIR + "/locations.json"
-IMPORT_COMMITMENT_DATES_AS_DATES = true
-
-USE_MONGOIMPORT = true
 
 mongodb = pgclient = null
 

console.log ">>>>>>>>>> Importing AidData >>>>>>>>>>"

fs = require 'fs'

    fd = fs.openSync(AIDDATA_TEMP_FILE, 'w')

    dateFieldQ = (field, q) ->
      switch IMPORT_COMMITMENT_DATES_AS_
        when "date", "epoch" then "EXTRACT(EPOCH FROM #{q})*1000 AS #{field}"
        when "string" then "#{q} AS #{field}"

    dateFields = 
      "date" : "COALESCE(commitment_date, start_date, to_timestamp(to_char(year, '9999'), 'YYYY'))"
