echo_api package

Submodules

echo_api.api module

exception echo_api.api.APICallError

Bases: BaseException

exception echo_api.api.APITestFailError

Bases: BaseException

class echo_api.api.BaseConnection(settings=<echo_api.api.Settings object>, *args, **kwargs)

Bases: object

BaseConnection has the core functionality required to interact with Echo’s SOAP API.

API_CreateNoPenUser(email, body, subject, return_email, password, parameters, security_groups, send_mail)
Parameters:
  • email – the email address, this will also be the security login.
  • body – body of the email (usually a string built up of other information, like name, email and password.
  • subject – subject of the email.
  • return_email – the return email address for the email.
  • password – the password for the new user (not the API user password).
  • parameters – the parameters for the provider to add.
  • security_groups – (list, string) contains a list (or string separated by vertical bars ?|?) of security groups.
  • send_mail – (bool) do we send the registration mail?
Returns:

a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, Success, etc) and YYY is the specific description.

API_GeneralQuery(query, parameters='')
Parameters:
  • query – the SQL-style query to be run
  • parameters – optional set of parameters in form of @name|value|type, where the name is the parameter name, value is the value of the parameter and type specifies the type (int, string, guid, decimal).
Returns:

usually XML with the requested results. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_GetData(screen_name, name_space, parameters)
Parameters:
  • screen_name – the session id returned from a login.
  • name_space – name of the screen
  • parameters – the parameters for the select statement. It is possible to get the names of the parameters from the API_SelectParameters function, the values will need to be supplied by the programmer.
Returns:

usually the XML data. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_Login(username, password)
Parameters:
  • username – the base user name. No domain, actual login id, not the display name.
  • password – the password corresponding to the user name.
Returns:

if successful, a string containing the session id, in the format ?SessionID|XXX? where XXX corresponds to the session id. If not successful, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_Logout()
Returns:a string in the format ?XXX|YYY? where XXX is a general description (Success, Error, Denied, etc) and YYY is the specific description.
API_SelectParameters(screen_name, name_space='Symed')
Parameters:
  • screen_name – (string) name of the screen
  • name_space – (string) namespace that the screen belongs to
Returns:

(string) usually a string in the form @name|value|type, where the name is the parameter name, value is the value of the parameter and type specifies the type (int, string, bool, decimal). There may be multiple and not all values will be filled in. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_Test()
Returns:“Success|This message from WCF Service. You are connected!” or some kind of connection error probably
API_TreeDataCommand(tree_name, level_name, stored_proc, operation, param)
Parameters:
  • tree_name – the name of tree (for providers, this is ?Locations?)
  • level_name – the name of the level (for providers, this is ?Providers?)
  • stored_proc – the stored procedure that will perform the operation (for adding providers, this is PhysicianDetail_Create)
  • operation – an integer that specifies the operation (0, 5 or 6) is (execute, add, delete). you can run self.get_operation() (self.get_operation(‘add’) for example) to get the integer corresponding to your stored procedure.
Returns:

usually a string in the format of name|value|type where the name is the parameter name, value is the parameter value and type is the parameter type. If this format is returned, the parameter can be used directly with API_GetData to retrieve the newly added item. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_UpdateData(tree_name, level_name, screen_name, name_space, parameters, dsXML)
Parameters:
  • tree_name – the name of tree (for providers, this is ?Locations?)
  • level_name – the name of the level (for providers, this is ?Providers?)
  • screen_name – name of the screen.
  • name_space – the name space that the screen belongs to. Currently always ?Symed?.
  • parameters – the parameters for the select statement. It is possible to get the names of the parameters from the API_SelectParameters function, the values will need to be supplied by the programmer.
  • dsXML – the XML data containing the updates.
Returns:

usually the XML data. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

static get_operations(key=None)
Parameters:key – (str) key corresponding to a stored procedure. If empty will show all stored procedures
Returns:integer corresponding to stored procedure
class echo_api.api.EchoConnection(settings=<echo_api.api.Settings object>, *args, **kwargs)

Bases: echo_api.api.Helpers, echo_api.api.BaseConnection

EchoConnection has numerous methods to facilitate the usage of the BaseConnection class.

add_contact_log_entry(physician_id, **kwargs)
Parameters:
  • physician_id – id of the physician to whom the note will be attached
  • kwargs

    keyword arguments corresponding to fields added to the log

    • FollowUpCompleted (boolean string) :: true/false
    • ContactLogTypeId (int string)
    • Notes (string)
    • Subject (string)
    • ContactID (int string)
    • ContactDate (isoformat datetime string YYYY-MM-DDTHH:mm:ss)
Returns:

add_medical_license(physician_id, **kwargs)
Parameters:
  • physician_id – (int) physician to whom to medical license belongs
  • kwargs

    (kwargs) values that you want the new physician to have (ex:

    • LicenseStateOfIssue
    • LicenseNumber
    • LicenseDateOfIssue
    • LicenseExpirationDate
    • LicenseType
    • Notified
    • Active
    • TimeEdited
    • DateUpdated
    • LicenseTypeSpecialty
    • ProviderTypeID
    • LicenseStatus
    • LicenseRenewalDate
    • LicenseCountry
Returns:

add_nopen_account(physician_id, send_email=0, **kwargs)

Adds a No Pen account for an existing user and sets them to “In Process” so that they can login.

Parameters:
  • physician_id – (int) ID of physician record in Echo Database
  • send_email – {bool (0 or 1)} Whether or not to have Echo send the invitation email informing the user
  • kwargs – password and security_groups (pipe delimited) are required
Returns:

(str) description of changes made

add_office(practice_id='')

This method does not yet have the capability to modify the newly created office; There does not yet exist an edit_office method.

Parameters:practice_id – (int) practice with which to associate this new office
Returns:
add_physician(office_id, **kwargs)
Parameters:
  • office_id – (int) office that the new physician belongs to
  • kwargs

    (kwargs) values that you want the new physician to have, ex: LastName=”Jones”

    • LastName
    • FirstName
    • DegreeID
    • EMail
    • Language
    • TimeEdited
    • PhysicianPhoto
    • DoctorNumber
    • Inactive
    • DateAdded
    • ProviderTypeID
    • DateUpdated
    • BirthState
    • EmailAllowed
    • AlternateEmailAllowed
    • CAQHPassword
    • MiddleName
    • Sex
    • MaritalStatus
    • SpouseName
    • HomeAddress
    • HomeCity
    • HomeState
    • HomeZip
    • SSN
    • DateOfBirth
    • BirthCity
    • Citizenship
    • Title
    • MobilePhone
    • NPI
    • StreetName
    • StreetNumber
    • DriverLicenseNumber
    • DriverLicenseExpiration
    • DriverLicenseState
    • HomePhone
    • BirthCountry
    • HomeCountry
    • CAQHID
    • PhysicianPhotoSecondary
    • UPIN
    • MaidenName
    • HomeAddress2
    • VISAStatus
    • OtherNameStart
    • OtherNameStop
    • AlternateEmail
    • VisaNumber
    • PreferredContactMethod
    • Beeper
    • BirthCounty
    • HomeCounty
    • SuffixName
    • Medicare
    • AlliedHealthProfessional
    • EnrollmentStatusID
    • CAQHLogin
    • HomeFax
Returns:

delete_contact_log_entry(physician_id, call_id='', limit=2, **kwarg)
Parameters:
  • physician_id – (int) id of physician that the log entry belongs to
  • call_id – (int, optional) id of the call log entry to be deleted
  • limit – (int) limits the number of logs to be deleted so you don’t accidentally delete more than you meant to
  • kwarg

    (kwarg) search term that tells the XMLSchema object which items need to be deleted, allows almost all default python comparison methods (__lt__, __gt__, __ge__, __ne__, __eq__, etc.), though not all of them are guaranteed to work in every situation. This feature might break with some searches.

    • connection.delete_contact_log_entry(1, call_id=2) will delete the call log with CallID=2
      • connection.delete_contact_log_entry(1, CallID=2) will do the same
      • connection.delete_contact_log_entry(1, CallID__eq=2) will also
    • connection.delete_contact_log_entry(1, limit=20, CallID__ne=’-1’) will delete up to 20 call log entries where the CallID is not -1 (so it deletes all of them)
    • connection.delete_contact_log_entry(1, TimeEdited__lt=<insert isoformat timestampe>) will fail to delete the call log with edited before the date unless there is only one that matches the query
    • note that only CallID and TimeEdited searches will ever work due to a combination of factors.
Returns:

delete_office(office_id='')
Parameters:office_id – (int) id of office to be deleted
Returns:
delete_physician(physician_id='', office_id='')
Parameters:
  • physician_id – (int) id of physician that will be deleted
  • office_id – (int) id of office that physician is being removed from. will delete physician if it’s the last office
Returns:

edit_physician(physician_id, **kwargs)
Parameters:
  • physician_id – (int) id of physician to be edited
  • kwargs
    • see add_physician for full list of kwargs
Returns:

get_contact_log(physician_id)

equivalent of self.API_GetData(*args) for the contact logs of the indicated physician

Parameters:physician_id – (int) id of whichever physician’s logs we desire
Returns:
get_medical_licenses(physician_id)

equivalent of self.API_GetData(*args) for the medical licenses of the indicated physician

Parameters:physician_id – (int) id of whichever physician’s licenses we desire
Returns:(xml string) whatever self.API_GetData(*args) returns
get_office(office_id)

equivalent of self.API_GetData(*args) for the indicated office

Parameters:office_id – (int) id of whichever office we desire
Returns:(xml string) whatever self.API_GetData(*args) returns
get_physician(physician_id)

equivalent of self.API_GetData(*args) for the indicated physician

Parameters:physician_id – (int) id of physician whose data we desire
Returns:(xml string) whatever self.API_GetData(*args) returns
show_contact_logs(show_all=True)
Parameters:show_all – (boolean) if True shows all, if False shows last created
Returns:xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info
show_medical_licenses(show_all=True)
Parameters:show_all – (boolean) if True shows all, if False shows last created
Returns:xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info
show_office(office_id)
Parameters:office_id – (int) id of desired office
Returns:xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info
show_offices(show_all=True)
Parameters:show_all – (boolean) if True shows all, if False shows last created
Returns:xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info
show_physician(physician_id)
Parameters:physician_id – (int) id of desired physician
Returns:xmlmanip.InnerSchemaDict (can be used as dict) of info
show_physician_contact_log(physician_id, show_all=True)
Parameters:
  • physician_id – (int) id of desired physician
  • show_all – (boolean) if True shows all, if False shows last created
Returns:

xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info

show_physician_medical_licenses(physician_id, show_all=True)
Parameters:
  • physician_id – (int) id of desired physician
  • show_all – (boolean) if True shows all, if False shows last created
Returns:

xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info

show_physicians(show_all=True)
Parameters:show_all – (boolean) if True shows all, if False shows last created
Returns:xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info
show_practices(show_all=True)
Parameters:show_all – (boolean) if True shows all, if False shows last created
Returns:xmlmanip.InnerSchemaDict or xmlmanip.SearchableList (can be used as dict) of info
class echo_api.api.EchoDebug(settings=<echo_api.api.Settings object>, show_xml=True, show_signature=True, show_args=True, *args, **kwargs)

Bases: echo_api.api.EchoConnection

This class adds some quality-of-life improvements to the BaseConnection class.

  • WRAPPED_METHODS are wrapped by WRAPPER_METHOD_NAMES
  • wrappers can be toggled on and off during PaycomConnection instanciation.

example: - paycom = PaycomConnection(show_messages=True, log_errors=False, keep_authenticated=False, serialize=False)

default: - paycom = PaycomConnection(show_messages=False, log_errors=True, keep_authenticated=True, serialize=True)

API_CreateNoPenUser(email, body, subject, return_email, password, parameters, security_groups, send_mail)
Parameters:
  • email – the email address, this will also be the security login.
  • body – body of the email (usually a string built up of other information, like name, email and password.
  • subject – subject of the email.
  • return_email – the return email address for the email.
  • password – the password for the new user (not the API user password).
  • parameters – the parameters for the provider to add.
  • security_groups – (list, string) contains a list (or string separated by vertical bars ?|?) of security groups.
  • send_mail – (bool) do we send the registration mail?
Returns:

a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, Success, etc) and YYY is the specific description.

API_GeneralQuery(query, parameters='')
Parameters:
  • query – the SQL-style query to be run
  • parameters – optional set of parameters in form of @name|value|type, where the name is the parameter name, value is the value of the parameter and type specifies the type (int, string, guid, decimal).
Returns:

usually XML with the requested results. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_GetData(screen_name, name_space, parameters)
Parameters:
  • screen_name – the session id returned from a login.
  • name_space – name of the screen
  • parameters – the parameters for the select statement. It is possible to get the names of the parameters from the API_SelectParameters function, the values will need to be supplied by the programmer.
Returns:

usually the XML data. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_Login(username, password)
Parameters:
  • username – the base user name. No domain, actual login id, not the display name.
  • password – the password corresponding to the user name.
Returns:

if successful, a string containing the session id, in the format ?SessionID|XXX? where XXX corresponds to the session id. If not successful, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_Logout()
Returns:a string in the format ?XXX|YYY? where XXX is a general description (Success, Error, Denied, etc) and YYY is the specific description.
API_SelectParameters(screen_name, name_space='Symed')
Parameters:
  • screen_name – (string) name of the screen
  • name_space – (string) namespace that the screen belongs to
Returns:

(string) usually a string in the form @name|value|type, where the name is the parameter name, value is the value of the parameter and type specifies the type (int, string, bool, decimal). There may be multiple and not all values will be filled in. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_TreeDataCommand(tree_name, level_name, stored_proc, operation, param)
Parameters:
  • tree_name – the name of tree (for providers, this is ?Locations?)
  • level_name – the name of the level (for providers, this is ?Providers?)
  • stored_proc – the stored procedure that will perform the operation (for adding providers, this is PhysicianDetail_Create)
  • operation – an integer that specifies the operation (0, 5 or 6) is (execute, add, delete). you can run self.get_operation() (self.get_operation(‘add’) for example) to get the integer corresponding to your stored procedure.
Returns:

usually a string in the format of name|value|type where the name is the parameter name, value is the parameter value and type is the parameter type. If this format is returned, the parameter can be used directly with API_GetData to retrieve the newly added item. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

API_UpdateData(tree_name, level_name, screen_name, name_space, parameters, dsXML)
Parameters:
  • tree_name – the name of tree (for providers, this is ?Locations?)
  • level_name – the name of the level (for providers, this is ?Providers?)
  • screen_name – name of the screen.
  • name_space – the name space that the screen belongs to. Currently always ?Symed?.
  • parameters – the parameters for the select statement. It is possible to get the names of the parameters from the API_SelectParameters function, the values will need to be supplied by the programmer.
  • dsXML – the XML data containing the updates.
Returns:

usually the XML data. If there was an error, a string in the format ?XXX|YYY? where XXX is a general description (Error, Denied, etc) and YYY is the specific description.

MESSAGE_OVERRIDE_MAP = {}
WRAPPED_METHODS = ['API_SelectParameters', 'API_GeneralQuery', 'API_GetData', 'API_UpdateData', 'API_TreeDataCommand', 'API_CreateNoPenUser', 'API_Login', 'API_Logout']
WRAPPER_METHOD_NAMES = ['show_signature']
show_signature(method, *args, **kwargs)
show_xml(method, *args, **kwargs)
class echo_api.api.Helpers

Bases: object

Helper Methods

class Meta

Bases: object

abstract = True
exception echo_api.api.ImproperlyConfigured

Bases: BaseException

class echo_api.api.Settings(secrets_location='/home/docs/checkouts/readthedocs.org/user_builds/echo-api/checkouts/latest/echo.conf')

Bases: object

This class only exists to collect settings for the BaseConnection object.

echo_api.api.handle_response(method)
echo_api.api.keep_warm(method)

echo_api.tests module

Module contents