dbdicom.move_to#

dbdicom.move_to(records: list, target: Record)[source]#

Move a list of records to a new parent.

Parameters:
  • records (list) – list of Records of the same type

  • parent (Record) – location for the copies.

See also

copy copy_to

Example

Consider the hollywood demo database:

>>> database = db.dro.database_hollywood()

There are currently two MRI studies in the database:

>>> MRIs = database.studies(StudyDescription='MRI)
>>> len(MRIs)
2

Create a new patient and move the MRI studies there:

>>> tarantino = database.new_patient(PatientName='Tarantino')
>>> db.copy_to(MRIs, tarantino)
>>> tarantino_MRIs = tarantino.studies()
>>> len(tarantino_MRIs)
2

Note that all header information is automatically updated:

>>> tarantino_MRIs[0].PatientName
Tarantino

Since the studies were moved, the total number of studies in the database has stayed the same:

>>> MRIs = database.studies(StudyDescription='MRI)
>>> len(MRIs)
2

And the original patients do not have any MRI studies left:

>>> jb = database.patients(PatientName = 'James Bond')
>>> MRIs = jb[0].studies(StudyDescription='MRI')
>>> len(MRIs)
0