VolumeImport
class VolumeImport extendsImport
Properties
protectedstring | $path | Path to the directory with the import files. | from Import |
protectedCollection | $importVolumes | Caches the decoded volume import file. | |
protectedUserImport | $userImport | The user import instance that belongs to this import. | |
protectedLabelTreeImport | $labelTreeImport | The label tree import instance that belongs to this import. |
Methods
The files expected by this import.
Validate a file of this import.
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
Validates a CSV file to contain the expected columns.
Read a JSON file containing an array and wrap it in a Laravel collection.
Get the contents of the volume import file.
Get the contents of the label tree import file.
Get all volumes of this import augmented by the IDs of the users, label trees and labels that they require.
Get all label trees that might have to be imported for the volumes.
Get all labels that might have to be imported for the volumes.
Get the users who might have to be imported for the volumes.
Get the user import instance that belongs to this import.
Get the label tree import instance that belongs to this import.
Get a map of one CSV ID column to another.
Get the list of labels and users that whould need to be imported for each volume.
Insert import volumes into the database.
Insert import users into the database.
Insert import label trees and labels into the database.
Insert import images into the database.
Insert import image labels into the database.
Insert import annotations into the database.
Details
inImportat line23
__construct(string$path)
Create a new instance.
inImportat line33
bool
filesMatch()
Check if this import matches to the given import files.
inImportat line48
validateFiles()
Check if the files of this import are valid.
at line204
protectedarray
expectedFiles()
The files expected by this import.
inImportat line70
protectedarray
files()
Get the basename of each file of this import.
at line220
protected
validateFile(string$basename)
Validate a file of this import.
inImportat line98
protected
expectKeysInJson(string$file,array$expectation,bool$array =true)
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
inImportat line124
protected
expectColumnsInCsv(string$file,array$expectation)
Validates a CSV file to contain the expected columns.
inImportat line148
protectedCollection
collectJson(string$file)
Read a JSON file containing an array and wrap it in a Laravel collection.
at line57
array
perform(Project$project,User$creator,array$only =null,array$newUrls =[],array$nameConflictResolution =[],array$parentConflictResolution =[])
Perform the import.
at line104
Collection
getImportVolumes()
Get the contents of the volume import file.
at line118
Collection
getImportLabelTrees()
Get the contents of the label tree import file.
at line129
Collection
getVolumeImportCandidates()
Get all volumes of this import augmented by the IDs of the users, label trees and labels that they require.
at line175
Collection
getLabelTreeImportCandidates()
Get all label trees that might have to be imported for the volumes.
at line185
Collection
getLabelImportCandidates()
Get all labels that might have to be imported for the volumes.
at line196
Collection
getUserImportCandidates()
Get the users who might have to be imported for the volumes.
These may be creators of annotation/image labels or admins of required label trees.
at line276
protectedUserImport
getUserImport()
Get the user import instance that belongs to this import.
at line290
protectedLabelTreeImport
getLabelTreeImport()
Get the label tree import instance that belongs to this import.
at line309
protectedCollection
getCsvIdMap(string$basename,string$value,string$key ='id')
Get a map of one CSV ID column to another.
E.g. a map of the image 'id' in column 0 to the 'volume_id' in column 2.
at line332
protectedarray
getRequiredEntities()
Get the list of labels and users that whould need to be imported for each volume.
This is based on annotation and image labels of each volume.
at line379
protectedCollection
insertVolumes(Collection$candidates,User$creator,array$newUrls)
Insert import volumes into the database.
at line421
protectedarray
insertUsers(Collection$volumeCandidates)
Insert import users into the database.
at line440
protectedarray
insertLabelTreesAndLabels(Collection$volumeCandidates,array$nameConflictResolution,array$parentConflictResolution)
Insert import label trees and labels into the database.
at line466
protectedarray
insertImages(array$volumeIdMap)
Insert import images into the database.
at line519
protected
insertImageLabels(array$imageIdMap,array$labelIdMap,array$userIdMap)
Insert import image labels into the database.
at line547
protected
insertAnnotations(array$volumeIdMap,array$imageIdMap,array$labelIdMap,array$userIdMap)
Insert import annotations into the database.