def __init__(self, id, accession=None, giri=None, pname=None, dob=None, gsid=None, mdname='', data=None, anonymized=False, institution='', parent_pid=''): self.id = id # uri/id relative to storage device self.parent_pid = parent_pid self.accession = accession # PHI self.pname = pname # PHI self.dob = dob # PHI self.mdname = mdname # PHI self.institution = institution self.anonymized = anonymized # Flag for pre-anonymized image data self.giri = giri # Anon self.gsid = gsid # Anon self.ppname = '' self.pdob = '' self.pmdname = '' self.data = data if giri is None: if self.anonymized: self.giri = self.accession else: self.giri = GID_Mint.get_gid({'institution': self.institution, 'record_id': self.accession}) if gsid is None and pname is not None and not self.anonymized: # Placeholder values for deidentification self.gsid = GID_Mint.get_gid({'pname': self.pname, 'dob': self.dob}) self.ppname = GID_Mint.get_pname_for_gid({'gid': self.gsid}) self.pdob = GID_Mint.get_pdob_for_dob_and_gid({'dob': self.dob, 'gid': self.gsid}) mdgid = GID_Mint.get_gid({'gid': self.mdname}) self.pmdname = GID_Mint.get_pmdname_for_gid({'gid': mdgid})
def pseudo_subject_name_rule(self, dummy): # Requires hashed_id is already set if not self.get('hashed_id'): self['hashed_id'] = self.hashed_subject_id_rule( self['subject_name']) return GID_Mint.get_pname_for_gid({'gid': self['hashed_id']})
def pseudo_subject_name_rule(self, dummy): # Requires hashed_id is already set if not self.get('hashed_id'): self['hashed_id'] = self.hashed_subject_id_rule(self['subject_name']) return GID_Mint.get_pname_for_gid({'gid': self['hashed_id']})