-- openIMIS-AI anonimization script
-- fields containing privacy information that are not required by the project are anonymized

-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- !!!!! ATTENTION!!! Make sure you are executing this script on a copy of the database !!!!
-- !!!!!!!!!!!!!!!!!!!!!!!!!!! NOT ON THE PRODUCTION DATABASE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
USE [NP_AI_1.4.2]
GO

UPDATE tblFamilies SET 
	FamilyAddress=''

-- We need DOB in the project 
UPDATE tblInsuree SET 
	CHFID = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	LastName = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	OtherNames = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
--	DOB = CURRENT_TIMESTAMP,
	passport = '',
	Phone = '',
	CurrentAddress = '',
	GeoLocation = '0.0 0.0'

UPDATE tblClaimAdmin SET 
	LastName = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	OtherNames = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	DOB = CURRENT_TIMESTAMP,
	Phone = '',
	EmailId = ''

UPDATE tblOfficer SET 
	LastName = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	OtherNames = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	DOB = CURRENT_TIMESTAMP,
	Phone = '',
	EmailId = '',
	permanentaddress = '',
	VEOLastName = '',
	VEOOtherNames = '',
	VEODOB = CURRENT_TIMESTAMP,
	VEOPhone = ''
	
UPDATE tblUsers SET 
	LastName = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	OtherNames = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	Phone = '',
	EmailId = ''
WHERE LoginName != 'Admin'

UPDATE tblPayer SET 
	PayerName = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	PayerAddress = '',
	Phone = '',
	eMail = '',
	Fax = ''

UPDATE tblPhotos SET 
	CHFID = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9),
	PhotoFileName = SUBSTRING(CONVERT(varchar(40), NEWID()),0,9) + '.jpg'


