New Target Integration
How to integrate a new target with PresQT.
The goal of PresQT is to make it as simple as possible for a new target to integrate itself with the PresQT services. Below are lists of code actions to take when integrating a target.
Target Endpoints
pageTarget EndpointsTarget Data
Add your target data to the file
presqt/targets.json
Only make an action 'True' if it has been integrated with PresQT
Target Functions
Add your target directory inside
presqt/targets/
All of your target integration functionality will exist here
Resource Endpoints
pageResources EndpointsResource Collection
Add functionality to return the resource collection inside of your target directory.
Function parameters in order:
token: str
User's token for the target
Function returns:
resources: list of python dictionaries
See Resource Endpoint docs for details/example.
Add the resource collection function to
presqt/api_v1/utilities/utils/function_router.py
Follow the naming conventions laid out in this class' docstring
Resource Detail
Add functionality to return the resource detail inside of your target directory.
Function parameters in order:
token: str
User's token for the target
resource_id: str
ID for the resource we want to fetch
Function returns:
resource object: python dictionary
See Resource Endpoint docs for details/example.
Add the resource collection function to
presqt/api_v1/utilities/utils/function_router.py
Follow the naming conventions laid out in this class' docstring
Resource Download
Add functionality to return a list of downloaded files inside of your target directory.
Function parameters in order:
token: str
User's token for the target
resource_id: str
ID for the resource we want to fetch
Function returns:
list of downloads: list of python dictionaries
Each dictionary will contain details for each file that we can use to build a BagIt zip file to return. See the example below for more details.
list of empty containers: list of strings
This list will contain container paths that don't have files. This will allow us to write any empty directories to the BagIt zip file.
Resource Upload
Add functionality to upload files to the target destination.
Function parameters in order:
token: str
User's token for the target
resource_id: str
ID for the resource we want to fetch
This can be 'None'
resource_main_dir: str
Path of the main directory where the resources are located on the server
hash_algorithm: str
Hash algorithm we want to get from the Target after it the resources are uploaded
file_duplicate_action: str
The action to take when a duplicate file is found
Options are 'ignore' or 'update'
Function returns:
dictionary of hashes: python dictionaries
Dictionary of files hashes calculated using the hash algorithm provided obtained from the target after upload.
list of files ignored: list of strings
List of duplicate files ignored during the upload process
File path must include full path starting with the resource_main_dir provided
list of files_updated: list of strings
List of duplicate files updated during the upload process
File path must include full path starting with the resource_main_dir provided
Resource Transfer
The resource Transfer endpoint actually utilizes the Download and Upload functions so no further functionality is required.
Last updated