DB Actions for TMAN
- 1 TMAN PostgreSQL connection
- 2 TMAN ingest
- 3 CDS
- 3.1 Prerequisite
- 3.2 Create
- 3.3 Update access level
- 3.4 Update metadata
- 3.5 Delete
- 4 CDS2
- 4.1 Prerequisite
- 4.2 Create
- 4.3 Update access level
- 4.4 Update metadata
- 4.5 Delete
TMAN PostgreSQL connection
Test Database:
Host: tst-tman-db.cn1isedzd1wu.us-east-1.rds.amazonaws.com
Port: 5432
Database name: tman
Schema name: tman
Production Database:
Host prd-tman-db.cn1isedzd1wu.us-east-1.rds.amazonaws.com
Port: 5432
Database name: tman
Schema name: tman
Please contact Cultural Heritage team to get a access account
TMAN ingest
Initial ingest
Call stored procedure tman.insert_asset
(https://git.yale.edu/cultural-heritage-dam/tman-database/blob/main/procedures/insert_asset.sql) to upload metadata of the asset to be ingested.
Schema name: tman
Procedure name: insert_asset
Parameters:
login,
unitcode,
filename,
hotfolderpath,
cmstype,
cmsid::bigint,
ingestrequested::smallint,
netx_folderid::bigint,
preservica_securitytag,
preservica_colref,
uploadchecksum,
cdsprimary::smallint,
mimetype,
uuid,
nativeid::integer,
cdsrank::integer,
imagecredit,
imagecaption,
imagecopyright,
copyrightinfourl,
copyrightstatus,
usageterms,
imagesource,
headline,
imagekeywords,
jobidentifier,
creator,
creatorrole,
imagetitle,
instructions,
bitdepth,
colorprofile,
imagesupplier,
lens,
lensmake,
lensmodel,
serialnumber,
imageheight::integer,
imagewidth::integer,
date_photo_taken::date,
date_of_source::date,
tombstone,
use_stub::smallint,
cds_access_master,
cds_access_tiff,
cds_access_jpeg,
cds_maxsize_tiff::integer,
cds_maxsize_jpeg::integer,
Unit_rank::integer
*Data type not explicitly casted are all of type text
example:
call tman.insert_asset(
'login',
'YPM',
'filename.jpg',
'YPM/TEST',
'obj',
1,
0::smallint,
44,
'YPM_OPEN',
'bba8073f-6b9c-4f26-82c4-d13370b15544',
'99e901910347465d481994622de236df',
1::smallint,
'image/jpeg',
'017bfa8f-536b-4598-91b3-2ea2f858536b',
655811,
1,
'imagecredit',
'imagecaption',
'imagecopyright',
'copyrightinfourl',
'copyrightstatatus',
'usageterm',
'imagesource',
'headline',
'imagekeywords',
'jobidentifier',
'creator',
'creatorrole',
'imagetitle',
'instruction',
'bitdepth',
'colorprofile',
'imagesupplier',
'lens',
'lensmaker',
'lesmodel',
'seralnumber',
393,
383,
NULL::date,
NULL::date,
'tombstone',
0::smallint,
'N',
'P',
'N',
4096,
0,
0
)
Using stub files in NetX
Upload a proxy (stub) file to NetX during ingest will typically be done because the file is a non-image file and won’t be useful in NetX. Also, this will prevent very large files from blocking the ingest process for other assets. By using this function, the following will occur:
A metadata record of the item will be loaded into NetX
A ‘stub’ file, which is of the same MIME type as the master will be loaded, but it will be a much smaller size and will therefore be processed much faster
The master file will be uploaded to Preservica
The master file will be uploaded to CDS
Listed below are the 20 predefined stub files available in TMAN. If you need to add a predefined stub file, to the list below, please contact TMAN admin group before trying to ingest.
null-master.avi
null-master.doc
null-master.docx
null-master.gif
null-master.jpg
null-master.m4a
null-master.mkv
null-master.mov
null-master.mp4
null-master.pdf
null-master.png
null-master.ppt
null-master.pptx
null-master.tif
null-master.wav
null-master.wma
null-master.wmv
null-master.xls
null-master.xlsx
Null-master.zip
The stub files have been populated with the phrase:
No derivative available. Master asset available through the preservation system.
To use the TMAN use_stub function for a new ingest:
Make sure the asset’s file extension is among the pre-loaded file types
set the asset’s TMAN_DB.assetstatus.useStub=1
To replace an existing asset with a stub file:
Make sure the asset’s file extension is among the pre-loaded file types
In TMAN_DB, update the value TMAN_DB.assetstatus.useStub=1
Recycling an asset ID
For department to reuse a TMAN DB record for new asset, this record have to meet the following conditions: assetstatus.preservica_status=0, assetstatus.deleted=1 and assetstatus.deleteRequested=0
To ingest a new asset use such exist DB record, assign a new UUID to asset.uuid field, set assetstatus.netx_folderid to target netx folder, set assetstatus.preservica_colref to target preservice collection, set assetstatus.ingestrequested to 9.
CDS
Prerequisite
CDS only take and process the assets which get ingested into NetX successfully and current CDS and CDS2 status is not in error and not processing other requests. This requires assetstatus.netx_status
field has to be greater than 500 and smaller than 600. assetstatus.cds_status
has to be either null, 0, or 507.
Note: TMAN currently scans database every hour (roughly 6 or 7 minutes past each hour?) to pick up tasks for CDS2. So changes to database records may not trigger action for as long as an hour.
Create
Create will start if assetstatus.cdslevel_last_syn
is null or 0 and assets.cdslevel
> 0.
Update access level
CDS level change will start if assetstatus.cdslevel_last_syn
> 0 and assets.cdslevel
> 0 and assetstatus.cdslevel_last_syn
not equate to assets.cdslevel
.
Update metadata
Metadate update will start if assets.cds_meta_change
= 1. Please also set assetstatus.metadatasyncrequested = 1
when you implement CDS metadata update.
Delete
Delete will start if assetstatus.cdslevel_last_syn
> 0 and assets.cdslevel
= 0.
CDS2
Prerequisite
CDS2 only take and process the assets which get ingested into NetX successfully and current CDS and CDS2 status is not in error and not processing other requests. This requires assetstatus.netx_status
field has to be greater than 500 and smaller than 600. assetstatus.cds2_status
has to be either null, 0 or 807.
Note: TMAN currently scans database every hour (roughly 6 or 7 minutes past each hour?) to pick up tasks for CDS2. So changes to database records may not trigger action for as long as an hour.
Create
Create will start if, in assets table, ALL of cds_access_tiff_prev
, cds_access_master_prev
, cds_access_jpeg_prev
are equal to 'N' and ANY of cds_access_master
, cds_access_tiff
, cds_access_jpeg
is not equal to 'N'.
Update access level
Update will start if, in assets table,
cds_access_master <> cds_access_master_prev OR
cds_access_tiff <> cds_access_tiff_prev OR
cds_access_jpeg <> cds_access_jpeg_prev OR
cds_maxsize_tiff <> cds_maxsize_tiff_prev OR
cds_maxside_jpeg <> cds_maxside_jpeg_prev
Update metadata
Metadata update will start if, in assets table, cds_meta_change
= 1. Please also set assetstatus.metadatasyncrequested
= 1 when you implement CDS2 metadata update.
Delete
Delete will start if, in assets table, ANY of cds_access_tiff_prev
, cds_access_master_prev
, cds_access_jpeg_prev
is not equal to 'N' and ALL of cds_access_master
, cds_access_tiff
, cds_access_jpeg
are equal to 'N'.