Skip to main content

A simple Python package using Appen API

Project description

Module adapapi

Classes

Appen(api_key) :

### Methods

`bonus_contributor(self, job_id, worker_id, amount_in_cents)`
:   Max at one time is $20.00 or 2000 cents
    
    Args:
        job_id (int): ADAP Job ID
        worker_id (int): ADAP Contributor ID
        amount_in_cents (int): Amount in cents. The max amount to bonus per API request is $20.00. Function will split out your amount in max $20.00 chunks + remainder if more than $20.00 is to be bonused.

`delete_unit(self, job_id, unit_id)`
:   Units cannot be deleted from a running or paused job.
    
    Args:
        job_id (int): ADAP job ID
        unit_id (int): ADAP Unit ID

`deprecate_job(self, job_id)`
:   Deprecating an ADAP job.
    
    Args:
        job_id (int): ADAP job ID

`download_jobid(self, job_id, reporttype, to_csv=False)`
:   Recommended to regenerate report first. Downloads ADAP report to DataFrame object or CSV file.
    
    Args:
        job_id (int): ADAP Job ID
        reporttype (str): ADAP report type -- full, aggregated, json, gold_report, workset, source
        to_csv (bool): True if report should be saved to CSV, False if report to output as DataFrame object
    
    Returns:
        Pandas dataframe: Pandas dataframe of report

`download_jobid_list(self, list_job_ids, reporttype, outfile_concat=False)`
:   Download reports from a list of job IDs
    
    Args:
        list_job_ids (list): list of job IDs
        reporttype (str): ADAP report type -- full, aggregated, json, gold_report, workset, source
        outfile_concat (boolean): Option to concat all of the downloaded reports into one Pandas dataframe. Default is set to False.
    
    Returns:
        Pandas dataframe: Dependent on outfile_concat flag, will return concatenated dataframe of all listed job IDs

`duplicate_job(self, job_id, include_uploaded_rows=False, include_tq=False)`
:   Duplicate ADAP job
    
    Args:
        job_id (int): ADAP Job ID
        include_uploaded_rows (bool): Flag to include previously uploaded rows. Includes test questions if present. Default set to False. 
        include_tq (bool): Flag to include test questions only.
    
    Returns:
        int: New ADAP Job ID

`get_all_jobs(self):
    """Retrieves list of all jobs. 
    More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get

    Returns:
        list: List of all jobs.
    """

`filter_jobs_by_tag(self, tag)`
:   Retrieves list of job IDs with associated tag. 
    More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get
    
    Args:
        tag (str): For multiple tags, delimit by comma. eg. 'tag1, tag2'
    
    Returns:
        list: List of job IDs with tag

`filter_jobs_by_title(self, title):
    """Retrieves list of job IDs with associated title.
    More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get
    
    Args:
        title (str): keywords to search for in job title
    
    Returns:
        list: List of jobs with title
    """

`filter_jobs_by_copied_from(self, copied_from):
    """Retrieves list of job IDs with associated copied_from job_id.
    More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get
    
    Args:
        copied_from (int): fileter jobs by the job id they were copied from
    
    Returns:
        list: List of jobs copied from  the copied_from_id

`get_unit_state(self, job_id, unit_id)`
:   Retrieves current unit state within job
    
    Args:
        job_id (int): ADAP Job ID
        unit_id (int): ADAP Unit ID
    
    Returns:
        dict: Dictionary containing _unit_id and _unit_state

`get_unit_state_row(self, job_id, row)`
:   Retrieves current unit state within job. To be used when row data needs to be returned.
    
    Args:
        job_id (int): ADAP Job ID
        row (Pandas Series or dictionary): Row from ADAP report 
    
    Returns:
        dict: Dictionary containing all data within row and _unit_state

`internal_launch(self, job_id, units_to_launch)`
:   Launching job internally
    
    Args:
        job_id (int): ADAP Job ID
        units_to_launch (int or str): Provide number of units to launch OR use "all" to launch all units.
    
    Returns:
        int: Number of units launched

`job_json(self, job_id)`
:   Get job json
    
    Args:
        job_id (int): ADAP Job ID
    
    Returns:
        dict: Job JSON

`job_summary(self, job_id)`
:   Getting job stats
    
    Args:
        job_id (int): ADAP Job ID
    
    Returns:
        dict: Returns golden_units, all_units, ordered_units, completed_units_estimate, needed_judgments, all_judgments, tainted_judgments, completed_gold_estimate, completed_non_gold_estimate

`regenerate_jobid(self, job_id, reporttype)`
:   Regenerates ADAP job
    
    Args:
        job_id (int_or_list): ADAP Job ID. If a list of job IDs provided, will regenerate them sequentially
        reporttype (str): ADAP report type -- full, aggregated, json, gold_report, workset, source

`split_column(self, job_id, columnname, character)`
:   Corresponds to the "Split Column" button in platform UI. This operation will split the contents of a column on a certain character, transforming strings into arrays of strings.
    
    Args:
        job_id (int): ADAP Job ID
        columnname (str): Column name
        character (str): Delimiting character

`tag_add(self, job_id, tag)`
:   Adding new tags. https://developer.appen.com/#tag/Manage-Job-Settings/paths/~1jobs~1{job_id}~1tags/post
    
    Args:
        job_id (int): ADAP Job ID
        tag (str): For multiple tags, delimit by comma. eg. 'tag1, tag2'

`tag_get(self, job_id)`
:   Tagging jobs. https://developer.appen.com/#tag/Manage-Job-Settings/paths/~1jobs~1{job_id}~1tags/post
    
    Args:
        job_id (int): ADAP Job ID
    
    Returns:
        list: List of tags attached to ADAP Job

`tag_replace(self, job_id, tag)`
:   Replacing existing tags with new tags. https://developer.appen.com/#tag/Manage-Job-Settings/paths/~1jobs~1{job_id}~1tags/post
    
    Args:
        job_id (int): ADAP Job ID
        tag (str): For multiple tags, delimit by comma. eg. 'tag1, tag2'

`unit_json(self, job_id, unit_id)`
:   Get unit json
    
    Args:
        job_id (int): ADAP Job ID
        unit_id (int): ADAP Unit ID
    
    Returns:
        dict: Unit JSON

`update_job_json(self, job_id, indict)`
:   Updating job settings
    
    Args:
        job_id (int): ADAP Job ID
        indict (dict): Dictionary of items to update within job json

`update_unit_state(self, job_id, unit_id, state)`
:   Updating unit state
    
    Args:
        job_id (int): ADAP job ID
        unit_id (int): ADAP Unit ID
        state (str): One of the following -- new, golden, finalized, canceled, deleted

`upload(self, data_to_upload, job_id=None)`
:   Uploads CSV (specify path), list of dictionaries, a single dictionary, or DataFrame. If no job ID is specified, a new job will be created.
    
    Args:
        data_to_upload (pd.DataFrame_or_str_or_list_or_dict): DataFrame object, path to CSV file, list of dictionaries, or single dictionary
        job_id (int): ADAP Job ID. If None then a new job will be created

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adapapi-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

adapapi-0.1.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file adapapi-0.1.1.tar.gz.

File metadata

  • Download URL: adapapi-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for adapapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ebc5d8f6915d29e496428c3fb385944b7d1a287d5b13b8faaddeb0d6107423a3
MD5 b7d49f75c584a79d03c8f4111810721e
BLAKE2b-256 bdf6d09b5068f7f5308d107ccd5906a2eeadc7eaead721bcdd9ffeac4e9c739e

See more details on using hashes here.

File details

Details for the file adapapi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: adapapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for adapapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b91b9054a14a8f225b45a670a2d457aa5bc02382aee2a23ff56190437f172327
MD5 6bd9f20cf4147de7f5d4a20907ef71e9
BLAKE2b-256 ef975e210aa073234e66bc81088a5b7274780fd36c279ecb434d8a0cbf23e6a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page