Package: ambra-clone-eyork-rad
Ambra_CloneThe Clone account class can be used to copy Ambra data from one account into another. These accounts can be in different Ambra instances. This Module is intended to be used within the Ambra scripting platform (future release) but can be downloaded and run locally as well.The data that can be copied at this time is limited to the corresponding ambra api calls and can be specified with theclone_itemsparameter.Get started with cloning Ambra data from local machine.pip install Ambra_CloneImport the Clone class from the file labeled Clone.pyfromAmbra_Clone.CloneImportCloneCreate a cloning instance. Seeinitialization parametersfor more details. For this example I am creating a new account although you can copy/update records to an existing account by specifying it's uuid.example_clone=Clone(sid="e9d41c71-b8fb-4119-8456-xxxxxxxxxx",original_url="https://uat.ambrahealth.com/api/v3/",original_account_uuid="",clone_items="all")example_clone.run()Once satisfied with the Clone parameters (see methods section for other customizable parameters) use the .run() method to perform the cloning task.Initialization parameterssid (str): session id for original_urloriginal_url (str): the original url with "api/v3" included. ie.https://access.ambrahealth.com/api/v3original_account_uuid (str): original account uuidclone_items (str/list, optional): list of items to clone. Defaults to "all".["customfield",
  "role",
  "group",
  "location",
  "account/users",
  "webhook",
  "route",
  "group_location_users",
  "namespace_settings",
  "terminology",
  "hl7/template",
  "hl7/transform",
  "dictionary",
  "mail_templates",
  "account_settings",
  "radreport/template",
  "share_settings",
  "site"]copy_url_base (str, optional): [description]. Defaults to None.copy_account_uuid (str, optional): If unspecified a new account will be created. The uuid of the duplicate account if it already exists. Defaults to None.sid_copy (str, optional): If unspecified, same as original session id. The session id for the duplicate account. Defaults to None.account_name (str,optional): Account Name. If unspecified or "", Account name will be be "Copy of "Methodsadd_special_fieldInstead of copying the value for the specified field and apistr. Default a preset value. For example if you wanted to suspend all webhooks in the newly cloned account - apistr='webhook',field_key='suspended',value=1Args:field_key (str): field key for specified value. Use : to separate fields in a seeded json.apistr (str): api endpoint string ie. webhook, route, customfield, ect.value (any): value to default for the api endpoint valueadd_special_uuidFor a specific uuid. Instead of copying the original field data use the specified valueArgs:uuid (str): uuid of the original item with a special fieldfield_key (str): field key for the special value. separate seeded json fields by a :value (any): value of the uuid field.update_uuid_mapAmbra items are generally mapped to their new uuid by the name of the record. However you can manually map records with this parameter instead.
Args:
- dict (dictionary): map of uuids {original_uuid : new_uuid}Architectural DesignCopying records from original_account to copy_account. Items are mapped by name unless the item uuid is manually mapped prior to running. When the .run() method is used the script first prints out the cloning information to the terminal then for each clone_item listed a coorespondingclonemethod is called. These methods all operate simmilarly and follow this procedure.map records to the uuid_map parameter- orignal_account uuids are the key, copy_account uuids are the values.add records that don't exist and add them to the uuid_mapupdate mapped records to match the originaluuid substitutions are automatic and rely on the uuid_map. If a uuid cannot be found the item is skipped and an error is printed.RequirementsThe clone script requires up to date versions of the python requests package and ambra-sdk packagepip install requests
pip install ambra-sdk