VolumeImport
class VolumeImport extends Import
Properties
protected string | $path | Path to the directory with the import files. |
from Import |
protected Collection | $importVolumes | Caches the decoded volume import file. |
|
protected UserImport | $userImport | The user import instance that belongs to this import. |
|
protected LabelTreeImport | $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 files into the database.
Insert import images into the database.
Insert import videos into the database.
Insert import image labels into the database.
Insert import video labels into the database.
Insert import image annotations into the database.
Insert import video annotations into the database.
Details
in
Import at line 23
__construct(string $path)
Create a new instance.
in
Import at line 33
bool
filesMatch()
Check if this import matches to the given import files.
in
Import at line 48
validateFiles()
Check if the files of this import are valid.
at line 213
protected array
expectedFiles()
The files expected by this import.
in
Import at line 70
protected array
files()
Get the basename of each file of this import.
at line 233
protected
validateFile(string $basename)
Validate a file of this import.
in
Import at line 98
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.
in
Import at line 124
protected
expectColumnsInCsv(string $file, array $expectation)
Validates a CSV file to contain the expected columns.
in
Import at line 148
protected Collection
collectJson(string $file)
Read a JSON file containing an array and wrap it in a Laravel collection.
at line 62
array
perform(Project $project, User $creator, array $only = null, array $newUrls = [], array $nameConflictResolution = [], array $parentConflictResolution = [])
Perform the import.
at line 113
Collection
getImportVolumes()
Get the contents of the volume import file.
at line 127
Collection
getImportLabelTrees()
Get the contents of the label tree import file.
at line 138
Collection
getVolumeImportCandidates()
Get all volumes of this import augmented by the IDs of the users, label trees and labels that they require.
at line 184
Collection
getLabelTreeImportCandidates()
Get all label trees that might have to be imported for the volumes.
at line 194
Collection
getLabelImportCandidates()
Get all labels that might have to be imported for the volumes.
at line 205
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 line 321
protected UserImport
getUserImport()
Get the user import instance that belongs to this import.
at line 335
protected LabelTreeImport
getLabelTreeImport()
Get the label tree import instance that belongs to this import.
at line 354
protected Collection
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 line 378
protected array
getRequiredEntities()
Get the list of labels and users that whould need to be imported for each volume.
This is based on image annotation labels, image labels, video annotation labels and video labels of each volume.
at line 448
protected Collection
insertVolumes(Collection $candidates, User $creator, array $newUrls)
Insert import volumes into the database.
at line 492
protected array
insertUsers(Collection $volumeCandidates)
Insert import users into the database.
at line 511
protected array
insertLabelTreesAndLabels(Collection $volumeCandidates, array $nameConflictResolution, array $parentConflictResolution)
Insert import label trees and labels into the database.
at line 539
protected array
insertFiles(array $volumeIdMap, string $csv, string $modelClass)
Insert import files into the database.
at line 592
protected array
insertImages(array $volumeIdMap)
Insert import images into the database.
at line 604
protected array
insertVideos(array $volumeIdMap)
Insert import videos into the database.
at line 616
protected
insertImageLabels(array $imageIdMap, array $labelIdMap, array $userIdMap)
Insert import image labels into the database.
at line 643
protected
insertVideoLabels(array $videoIdMap, array $labelIdMap, array $userIdMap)
Insert import video labels into the database.
at line 671
protected
insertImageAnnotations(array $volumeIdMap, array $imageIdMap, array $labelIdMap, array $userIdMap)
Insert import image annotations into the database.
at line 762
protected
insertVideoAnnotations(array $volumeIdMap, array $videoIdMap, array $labelIdMap, array $userIdMap)
Insert import video annotations into the database.