Package 'africalaws'

Title: Interface to the Laws.Africa API
Description: Laws.Africa <https://laws.africa> endeavours to facilitate African governments in offering sustainable, free access to dependable digital laws. It aims to achieve this by ensuring that the laws are easily accessible, user-friendly, educational, and reusable. This initiative seeks to empower citizens with knowledge of their legal rights and obligations while promoting transparency and accountability within the legal system. Laws.Africa offers a content application programming interface (API) to fetch legislative content and metadata. The API is a read-only API for listing and fetching published versions of legislative works. This package interfaces with this API to allow access using R.
Authors: Jillian Francise Lee [aut, cph], Ernest Guevarra [aut, cre, cph] , Sanjeev Pugazhendhi [ths], Proochista Ariana [ths, cph]
Maintainer: Ernest Guevarra <[email protected]>
License: GPL (>= 3)
Version: 0.0.0.9000
Built: 2024-10-31 17:14:42 UTC
Source: https://github.com/OxfordIHTM/africalaws

Help Index


Retrieve various available information from Laws.Africa

Description

Retrieve various available information from Laws.Africa

Usage

al_get_areas(base_url = "https://api.laws.africa/v3/", flatten = TRUE)

al_get_works(area, base_url = "https://api.laws.africa/v3/", flatten = TRUE)

Arguments

base_url

Base URL for the Laws.Africa API. Current default set to https://api.laws.africa/v3/.

flatten

Logical. Should the output JSON be flattened into a tibble. Defeault is TRUE.

area

A character identifier for an area of interest for which information is to be retrieved from the Laws.API. For countries, this will be an alpha-2 ISO 3166-1 country code. For other areas, this can take many formats.

Value

If flatten = TRUE, a named list of two tibbles the first of which is for countries information and the second for localities information. Otherwise, a list output created from the JSON output of the request.

On Works

#' A Work is a piece of legislation, such as an act, regulation or by-law. A work may be amended over time and may even have its title changed. A work is uniquely identified by a work FRBR URI which never changes.

Examples

if (Sys.getenv("LAWS_AFRICA_TOKEN") != "") al_get_areas()

Structure list outputs

Description

Structure list outputs

Usage

al_structure_areas(areas_list)

al_structure_work(works_list)

al_structure_works(works_list)

Arguments

areas_list

A countries list output produced from a request for countries JSON to the Laws.Africa API.

works_list

A works list outputs produced from a request for works JSON to the Laws.Africa API.

Value

A named list of two tibbles the first of which is for countries information and the second for localities information.


Set a Laws.Africa API token

Description

Set a Laws.Africa API token

Usage

set_api_token(api_token = NULL)

Arguments

api_token

Laws.Africa user account API token.

Value

User's API token recorded into system environment as LAWS_AFRICA_TOKEN.

Examples

if (FALSE) {
  set_api_token(api_token = "abcd")
}