Package 'captr'

Title: Client for the Captricity API
Description: Get text from images of text using Captricity Optical Character Recognition (OCR) API. Captricity allows you to get text from handwritten forms --- think surveys --- and other structured paper documents. And it can output data in form a delimited file keeping field information intact. For more information, read <https://shreddr.captricity.com/developer/overview/>.
Authors: Gaurav Sood [aut, cre]
Maintainer: Gaurav Sood <[email protected]>
License: MIT + file LICENSE
Version: 0.3.1
Built: 2024-10-25 03:31:55 UTC
Source: https://github.com/gojiplus/captr

Help Index


captr: R Client for the Capticrity API

Description

OCR images and forms. See https://captricity.com/. Details about results of calls to the API can be found at https://shreddr.captricity.com/developer/.

Your need credentials to use this application. If you haven't already, you can get this at https://shreddr.captricity.com/developer/.

Author(s)

Gaurav Sood


Price of a Batch

Description

The price for processing the batch.

Usage

batch_price(batch_id = NULL, ...)

Arguments

batch_id

ID for the batch; Required; String.

...

Additional arguments passed to captr_GET.

Value

named list

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
batch_price("batch_id")

## End(Not run)

Check if authentication information is there

Description

Check if authentication information is there

Usage

captr_CHECKAUTH()

DELETE

Description

DELETE

Usage

captr_DELETE(path = "", query = NULL, ...)

Arguments

path

path to specific API request URL

query

query list

...

Additional arguments passed to curl_fetch_memory.

Value

list


GET

Description

GET

Usage

captr_GET(path = "", query = NULL, ...)

Arguments

path

path to specific API request URL

query

query list

...

Additional arguments passed to curl_fetch_memory.

Value

list


POST

Description

POST

Usage

captr_POST(path = "", query = NULL, ...)

Arguments

path

path to specific API request URL

query

query list

...

Additional arguments passed to curl_fetch_memory.

Value

list


Create Batch

Description

Create a new batch.

Usage

create_batch(batch_name = NULL, ...)

Arguments

batch_name

name of the batch; Required; character

...

Additional arguments passed to captr_POST.

Value

List of length 26. Includes information like created_by, user_id, etc.

References

https://shreddr.captricity.com/developer/api-reference/#v1-batch

Examples

## Not run: 
create_batch(batch_name = "name_of_batch")

## End(Not run)

Delete a Batch

Description

Delete a Batch

Usage

delete_batch(batch_id = "", ...)

Arguments

batch_id

ID for the batch

...

Additional arguments passed to captr_DELETE.

References

https://shreddr.captricity.com/developer/api-reference/#v1-batches

Examples

## Not run: 
delete_batch("batch_id")

## End(Not run)

Delete a Job

Description

Delete a Job

Usage

delete_job(job_id = "", ...)

Arguments

job_id

ID for the job (which you get from related_job_id field of submit_batch)

...

Additional arguments passed to captr_DELETE.

References

https://shreddr.captricity.com/developer/api-reference/#v1-batches

Examples

## Not run: 
delete_job("job_id")

## End(Not run)

Get All the Data For a Particular Job in a csv

Description

Get all the data

Usage

get_all(job_id = "", output_dir = "./")

Arguments

job_id

ID for the job

output_dir

output directory

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
get_all(job_id ="job_id")

## End(Not run)

Get Details of a particular batch

Description

Get details such as who the batch was created by, user id of the creator, name of the batch, whether or not the batch has been submitted for processing, files in the batch, etc.

Usage

get_batch_details(batch_id = "", ...)

Arguments

batch_id

ID for the batch

...

Additional arguments passed to captr_GET.

Value

list of length 26.

References

https://shreddr.captricity.com/developer/api-reference/#v1-batch

Examples

## Not run: 
get_batch_details("batch_id")

## End(Not run)

Get Instance Set

Description

If you are interested in getting data from one particular form, use this function.

Usage

get_instance_set(instance_set_id = "", ...)

Arguments

instance_set_id

ID for the form (instance_set) (which you get from list_instance_sets)

...

Additional arguments passed to captr_GET.

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
get_instance_set("instance_set_id")

## End(Not run)

Set Template ID

Description

To digitize documents, create a template using the Captricity Web UI at https://shreddr.captricity.com/job/ The template tells Captricity which data to get from where in the document.

Usage

get_template_id(...)

Arguments

...

Additional arguments passed to captr_GET.

Details

Get the template ids of all the documents

Value

named list

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
get_template_id()

## End(Not run)

List all the files in a batch

Description

List all the files in a batch

Usage

list_batch_files(batch_id = "", ...)

Arguments

batch_id

ID for the batch; Required; String

...

Additional arguments passed to captr_GET.

Value

list. If no files in a batch, an empty list

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
list_batch_files("batch_id")

## End(Not run)

List Batches

Description

A list of batches owned by the calling account.

Usage

list_batches(...)

Arguments

...

Additional arguments passed to captr_GET.

Value

named list. Prints number of batches by default. Named list has 15 items: total_batch_cost_in_fields, user_included_fields_per_page, can_be_priced, user_pay_go_fields_applied, page_count, total_user_cost_in_cents, user_subscription_fields_applied, user_subscription_fields_per_month, overage_field_count, total_user_cost_in_fields, batch_id, user_subscription_fields, user_pay_go_fields, user_fields_per_overage_field, user_fields_per_page

References

https://shreddr.captricity.com/developer/api-reference/#v1-batches

Examples

## Not run: 
list_batches()

## End(Not run)

List Documents

Description

A list of document resources owned by the calling account.

Usage

list_docs(...)

Arguments

...

Additional arguments passed to captr_GET.

Value

data.frame Prints total number of documents by default.

References

https://shreddr.captricity.com/developer/api-reference/#v1-documents

Examples

## Not run: 
list_docs()

## End(Not run)

List Instance Sets

Description

List all the forms (instance sets) for a particular job. Use this to get ids of forms (instance sets) you want to download.

Usage

list_instance_sets(job_id = "", ...)

Arguments

job_id

ID for the job (which you get from related_job_id field of submit_batch)

...

Additional arguments passed to captr_GET.

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
list_instance_sets(job_id = "job_id")

## End(Not run)

List Jobs

Description

A list of jobs owned by the calling account.

Usage

list_jobs(...)

Arguments

...

Additional arguments passed to captr_GET.

References

https://shreddr.captricity.com/developer/api-reference/#v1-jobs

Examples

## Not run: 
list_jobs()

## End(Not run)

Assign Template ID to a Batch

Description

To digitize documents, create a template using the Captricity Web UI at https://shreddr.captricity.com/job/ The template tells Captricity which data to get from where in the document. Set the relevant document id using this function

Usage

set_batch_template(batch_id = "", template_id = "")

Arguments

batch_id

Batch ID

template_id

ID for the template

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
set_batch_template("batch_id", template_id)

## End(Not run)

Sets Application Token

Description

Captricity requires an application token to use the API. Get the token from https://shreddr.captricity.com/. The functions looks for CaptricityToken in the environment. If it doesn't find it or if change is forced, it looks for arguments passed in the function. If it fails to find that, it asks for input.

Usage

set_token(app_token = NULL, force = FALSE)

Arguments

app_token

Application token. Get these from https://shreddr.captricity.com/developer/.

force

Force change the CaptricityToken stored in the environment

Details

Run this function before anything else.

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
set_token("app_token")

## End(Not run)

Submit the Batch for Processing

Description

Submit the Batch for Processing

Usage

submit_batch(batch_id = "", ...)

Arguments

batch_id

ID for the batch. Required. String.

...

Additional arguments passed to captr_POST.

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
submit_batch("batch_id")

## End(Not run)

Test Readiness of a Batch

Description

Check if the batch is ready to be processed

Usage

test_readiness(batch_id = "", ...)

Arguments

batch_id

ID for the batch. Required. String.

...

Additional arguments passed to captr_GET.

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
test_readiness("batch_id")

## End(Not run)

Track Progress of a Job

Description

Check what percentage of the job is digitized

Usage

track_progress(job_id = "")

Arguments

job_id

ID for the job (which you get from related_job_id field of submit_batch)

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
track_progress("job_id")

## End(Not run)

Upload Image

Description

Upload an image to captricity.

Usage

upload_image(batch_id = "", path_to_image = "", ...)

Arguments

batch_id

ID for the batch

path_to_image

Path to the image you want OCRd

...

Additional arguments passed to captr_POST.

References

https://shreddr.captricity.com/developer/

Examples

## Not run: 
upload_image("batch_id", "path_to_image")

## End(Not run)

User Profile

Description

Provides account information for the provided API Token.

Usage

user_profile(...)

Arguments

...

Additional arguments passed to captr_GET.

Value

named list with the following elements: username, deny_batch_submission_for_digitization, account_balance, user_id, enrolled_subscription_is_annualized, enrolled_subscription, enrolled_subscription_is_trial, trial_eligible, remaining_quota

References

https://shreddr.captricity.com/developer/api-reference/#v1-user_profile

Examples

## Not run: 
user_profile()

## End(Not run)