Module: AllscriptsApi::NamedMagicMethods

Included in:
Client
Defined in:
lib/allscripts_api/named_magic_methods.rb

Overview

A collection of named convenience methods that map to Allscripts magic actions. These methods are included in ‘AllscriptsApi::Client` and can be accessed from instances of that class.

Instance Method Summary collapse

Instance Method Details

#get_dictionary(dictionary_name) ⇒ Array<Hash>, ...

a wrapper around GetDictionary, which returnsentries from a specific dictionary.

a “TableName” value from ‘get_list_of_dictionaries` an empty array, or an error

Parameters:

  • dictionary_name (String)

    the name of the desired dictionary,

Returns:

  • (Array<Hash>, Array, MagicError)

    a list dictionary entries,



114
115
116
117
118
119
120
121
# File 'lib/allscripts_api/named_magic_methods.rb', line 114

def get_dictionary(dictionary_name)
  params = MagicParams.format(
    user_id: @allscripts_username,
    parameter1: dictionary_name
  )
  results = magic("GetDictionary", magic_params: params)
  results["getdictionaryinfo"]
end

#get_encounter_list(patient_id = "", encounter_type = "", when_or_limit = "", nostradamus = 0, show_past_flag = "Y", billing_provider_user_name = "") ⇒ Array<Hash>, ...

a wrapper around GetEncounterList

Parameters:

  • patient_id (String) (defaults to: "")

    patient id

  • encounter_type (String) (defaults to: "")

    encounter type to filter on from Encounter_Type_DE

  • when_or_limit (String) (defaults to: "")

    filter by specified date

  • nostradamus (String) (defaults to: 0)

    how many days to look into the future. Defaults to 0.

  • show_past_flag (String) (defaults to: "Y")

    show previous encounters, “Y” or “N”. Defaults to Y

  • billing_provider_user_name (String) (defaults to: "")

    filter by user name (if specified)

Returns:

  • (Array<Hash>, Array, MagicError)

    a list of encounters



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/allscripts_api/named_magic_methods.rb', line 78

def get_encounter_list(patient_id = "", encounter_type = "",
                       when_or_limit = "", nostradamus = 0,
                       show_past_flag = "Y",
                       billing_provider_user_name = "")
  params =
    MagicParams.format(
      user_id: @allscripts_username,
      patient_id: patient_id,
      parameter1: encounter_type, # from Encounter_Type_DE
      parameter2: when_or_limit,
      parameter3: nostradamus,
      parameter4: show_past_flag,
      parameter5: billing_provider_user_name,
    )
  results = magic("GetEncounterList", magic_params: params)
  results["getencounterlistinfo"]
end

#get_list_of_dictionariesArray<Hash>, ...

a wrapper around GetListOfDictionaries, which returns list of all dictionaries

an empty array, or an error

Returns:

  • (Array<Hash>, Array, MagicError)

    a list of found dictionaries,



101
102
103
104
105
# File 'lib/allscripts_api/named_magic_methods.rb', line 101

def get_list_of_dictionaries
  params = MagicParams.format(user_id: @allscripts_username)
  results = magic("GetListOfDictionaries", magic_params: params)
  results["getlistofdictionariesinfo"]
end

#get_patient_problems(patient_id, show_by_encounter = "N", assessed = nil, encounter_id = nil, filter_on_id = nil, display_in_progress = nil) ⇒ Array<Hash>, ...

a wrapper around GetPatientProblems

an empty array, or an error

Parameters:

  • patient_id (String)

    patient id

  • show_by_encounter (String) (defaults to: "N")

    Y or N (defaults to ‘N`)

  • assessed (String) (defaults to: nil)
  • encounter_id (String) (defaults to: nil)

    id for a specific patient encounter

  • filter_on_id (String) (defaults to: nil)
  • display_in_progress (String) (defaults to: nil)

Returns:

  • (Array<Hash>, Array, MagicError)

    a list of found problems,



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/allscripts_api/named_magic_methods.rb', line 34

def get_patient_problems(patient_id,
                         show_by_encounter = "N",
                         assessed = nil,
                         encounter_id = nil,
                         filter_on_id = nil,
                         display_in_progress = nil)
  params = MagicParams.format(
    user_id: @allscripts_username,
    patient_id: patient_id,
    parameter1: show_by_encounter,
    parameter2: assessed,
    parameter3: encounter_id,
    parameter4: filter_on_id,
    parameter5: display_in_progress
  )
  results = magic("GetPatientProblems", magic_params: params)
  results["getpatientproblemsinfo"]
end

#get_provider(provider_id = nil, user_name = nil) ⇒ Array<Hash>, ...

a wrapper around GetProvider

Parameters:

  • provider_id (String) (defaults to: nil)

    optional Allscripts user id

  • user_name (String) (defaults to: nil)

    optional Allscripts user_name

Returns:

  • (Array<Hash>, Array, MagicError)

    a list of providers



14
15
16
17
18
19
20
21
22
# File 'lib/allscripts_api/named_magic_methods.rb', line 14

def get_provider(provider_id = nil, user_name = nil)
  params =
    MagicParams.format(
      parameter1: provider_id,
      parameter2: user_name
    )
  results = magic("GetProvider", magic_params: params)
  results["getproviderinfo"]
end

#get_schedule(start_date, end_date) ⇒ Array<Hash>, ...

a wrapper around GetSchedule, returns appointments scheduled under the the user for a given date range

Parameters:

  • start_date (Date)

    start date inclusive

  • end_date (Date)

    end date inclusive

Returns:

  • (Array<Hash>, Array, MagicError)

    a list of scheduled appointments, an empty array, or an error



59
60
61
62
63
64
65
66
67
# File 'lib/allscripts_api/named_magic_methods.rb', line 59

def get_schedule(start_date, end_date)
  params =
    MagicParams.format(
      user_id: @allscripts_username,
      parameter1: format_date_range(start_date, end_date)
    )
  results = magic("GetSchedule", magic_params: params)
  results["getscheduleinfo"]
end