Return CQC inspection reports, either as a plain text character vector, or by saving a PDF to the chosen directory.

cqc_reports(
  inspection_report_link_id,
  related_document_type = NULL,
  plain_text = TRUE,
  attempt_pdf = FALSE,
  directory = NULL,
  file_name = NULL,
  verbose = TRUE
)

Arguments

inspection_report_link_id

The ID of the report to return.

related_document_type

An optional qualifier to retrieve a document related to the main report. This parameter is the Related Document Type found from the relatedDocuments response object. e.g. "Use%20of%20Resources". When this parameter is absent, the main report for the inspection is returned.

plain_text

If TRUE, returns plain text of report. Otherwise returns a PDF. Defaults to TRUE.

attempt_pdf

Set behaviour when attempting to retrieve plain text of reports. If TRUE, attempts to retrieve a PDF if the plain text of the report is not available and saves it to directory. Ignored if plain_text == FALSE. Defaults to FALSE.

directory

The directory to save PDF files in. Defaults to current working directory.

file_name

A custom file name given to a PDF file being saved locally. If NULL, saves files as inspection_report_link_id.pdf. Defaults to NULL.

verbose

If TRUE prints download progress to console if requesting more than 1,000 records. Defaults to TRUE.

Value

Either a PDF of the inspection report saved to the working directory, or a character vector with the plain text of the inspection report, depending on parameters used.

Examples

# \donttest{
report2 <- cqc_reports("41d035b1-43e7-4857-be33-cf1b57cf4311")
# }