Eliminating data

Hi all,

Is there any script which allows us deleting for any specific orgunit on a given period?

Best regards,

image

Hi Joao,

It depends on your exact needs, but take a look at the “datavalue” table.

Something like

DELETE FROM datavalue where sourceid = X and periodid = Y;

X should be replaced by the organisationunitid from the organisationunit table for the orgunit you want.

Y should be replaced by the particular periodid found in the period table.

Obviously, you should make a backup of your database before attempting such an operation.

Regards,

Jason

image

···

On Thu, Mar 26, 2015 at 5:51 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi all,

Is there any script which allows us deleting for any specific orgunit on a given period?

Best regards,


João Gabriel Mazuze

National Database Manager

Projecto CHASS-SMT

Abt Associates Inc.

Av. Marginal, 4067

Cidade de Maputo, Moçambique

Fax: (+ 258) 21486767

Tel: (+ 258) 21493525/6/8

Cell: (+258) 82 4236279

www.chasssmt.com

  • Somos um projecto financiado pelo PEPFAR-II, através da USAID, para reforçar o Sistema de Saúde das Provincias de Sofala, Manica e Tete. Pretendemos melhorar a ligação e integração do HIV com os Cuidados Primários de Saúde e outros a ele relacionados em coordenação com as Direcções Provinciais de Saúde e outros parceiros. Através do projecto CHASS-SMT, o Governo Americano apoia o Governo Moçambicano na melhoria da qualidade dos Serviços de Saúde no país.*

This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

Thanks Jason.

image

···

Hi Joao,

It depends on your exact needs, but take a look at the “datavalue” table.

Something like

DELETE FROM datavalue where sourceid = X and periodid = Y;

X should be replaced by the organisationunitid from the organisationunit table for the orgunit you want.

Y should be replaced by the particular periodid found in the period table.

Obviously, you should make a backup of your database before attempting such an operation.

Regards,

Jason

On Thu, Mar 26, 2015 at 5:51 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi all,

Is there any script which allows us deleting for any specific orgunit on a given period?

Best regards,


João Gabriel Mazuze

National Database Manager

Projecto CHASS-SMT

Abt Associates Inc.

Av. Marginal, 4067

Cidade de Maputo, Moçambique

Fax: (+ 258) 21486767

Tel: (+ 258) 21493525/6/8

Cell: (+258) 82 4236279

www.chasssmt.com

  • Somos um projecto financiado pelo PEPFAR-II, através da USAID, para reforçar o Sistema de Saúde das Provincias de Sofala, Manica e Tete. Pretendemos melhorar a ligação e integração do HIV com os Cuidados Primários de Saúde e outros a ele relacionados em coordenação com as Direcções Provinciais de Saúde e outros parceiros. Através do projecto CHASS-SMT, o Governo Americano apoia o Governo Moçambicano na melhoria da qualidade dos Serviços de Saúde no país.*

This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+46764147049

Hi Jason,

I think I will need also to specify the dataset as I don´t want to delete data in all the datasets.

Kind regards

image

···

Hi Joao,

It depends on your exact needs, but take a look at the “datavalue” table.

Something like

DELETE FROM datavalue where sourceid = X and periodid = Y;

X should be replaced by the organisationunitid from the organisationunit table for the orgunit you want.

Y should be replaced by the particular periodid found in the period table.

Obviously, you should make a backup of your database before attempting such an operation.

Regards,

Jason

On Thu, Mar 26, 2015 at 5:51 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi all,

Is there any script which allows us deleting for any specific orgunit on a given period?

Best regards,


João Gabriel Mazuze

National Database Manager

Projecto CHASS-SMT

Abt Associates Inc.

Av. Marginal, 4067

Cidade de Maputo, Moçambique

Fax: (+ 258) 21486767

Tel: (+ 258) 21493525/6/8

Cell: (+258) 82 4236279

www.chasssmt.com

  • Somos um projecto financiado pelo PEPFAR-II, através da USAID, para reforçar o Sistema de Saúde das Provincias de Sofala, Manica e Tete. Pretendemos melhorar a ligação e integração do HIV com os Cuidados Primários de Saúde e outros a ele relacionados em coordenação com as Direcções Provinciais de Saúde e outros parceiros. Através do projecto CHASS-SMT, o Governo Americano apoia o Governo Moçambicano na melhoria da qualidade dos Serviços de Saúde no país.*

This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+46764147049

Hi Joao,

Your original mail said this…

Is there any script which allows us deleting for any specific orgunit on a given period?

So, that sample query which I provided will delete all data for a specific orgunit and a given period. i.e. all data elements for a given period for a single orgunit. If you need specific data elements, then it might be something like

DELETE FROM datavalue where sourceid = X and periodid = Y and dataelementid IN (A,B,C,D);

where A,B,C,D correspond to the data elements which you want to actually delete.

If there are more restrictions, you will just have to develop an SQL query which fits you needs.

There is no linkage of datavalues to data sets, only to data elements. Just follow the foreign key constraints in the datavalue table, and it will make things a bit more clear.

If you need more help, just provide more detail, and we can try and help out.

Regards,
Jason

image

···

On Thu, Mar 26, 2015 at 8:50 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi Jason,

I think I will need also to specify the dataset as I don´t want to delete data in all the datasets.

Kind regards

From: Jason Pickering [mailto:jason.p.pickering@gmail.com]

Sent: 26 March 2015 13:52

To: Joao Mazuze

Cc: dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Eliminating data

Hi Joao,

It depends on your exact needs, but take a look at the “datavalue” table.

Something like

DELETE FROM datavalue where sourceid = X and periodid = Y;

X should be replaced by the organisationunitid from the organisationunit table for the orgunit you want.

Y should be replaced by the particular periodid found in the period table.

Obviously, you should make a backup of your database before attempting such an operation.

Regards,

Jason

On Thu, Mar 26, 2015 at 5:51 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi all,

Is there any script which allows us deleting for any specific orgunit on a given period?

Best regards,


João Gabriel Mazuze

National Database Manager

Projecto CHASS-SMT

Abt Associates Inc.

Av. Marginal, 4067

Cidade de Maputo, Moçambique

Fax: (+ 258) 21486767

Tel: (+ 258) 21493525/6/8

Cell: (+258) 82 4236279

www.chasssmt.com

  • Somos um projecto financiado pelo PEPFAR-II, através da USAID, para reforçar o Sistema de Saúde das Provincias de Sofala, Manica e Tete. Pretendemos melhorar a ligação e integração do HIV com os Cuidados Primários de Saúde e outros a ele relacionados em coordenação com as Direcções Provinciais de Saúde e outros parceiros. Através do projecto CHASS-SMT, o Governo Americano apoia o Governo Moçambicano na melhoria da qualidade dos Serviços de Saúde no país.*

This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+46764147049


This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

Thanks Jason, I will use dataelements to perform it.

Many regards,

Joao

image

···

Hi Joao,

Your original mail said this…

Is there any script which allows us deleting for any specific orgunit on a given period?

So, that sample query which I provided will delete all data for a specific orgunit and a given period. i.e. all data elements for a given period for a single orgunit. If you need specific data elements, then it might be something like

DELETE FROM datavalue where sourceid = X and periodid = Y and dataelementid IN (A,B,C,D);

where A,B,C,D correspond to the data elements which you want to actually delete.

If there are more restrictions, you will just have to develop an SQL query which fits you needs.

There is no linkage of datavalues to data sets, only to data elements. Just follow the foreign key constraints in the datavalue table, and it will make things a bit more clear.

If you need more help, just provide more detail, and we can try and help out.

Regards,

Jason

On Thu, Mar 26, 2015 at 8:50 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi Jason,

I think I will need also to specify the dataset as I don´t want to delete data in all the datasets.

Kind regards

From: Jason Pickering [mailto:jason.p.pickering@gmail.com]

Sent: 26 March 2015 13:52

To: Joao Mazuze

Cc: dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Eliminating data

Hi Joao,

It depends on your exact needs, but take a look at the “datavalue” table.

Something like

DELETE FROM datavalue where sourceid = X and periodid = Y;

X should be replaced by the organisationunitid from the organisationunit table for the orgunit you want.

Y should be replaced by the particular periodid found in the period table.

Obviously, you should make a backup of your database before attempting such an operation.

Regards,

Jason

On Thu, Mar 26, 2015 at 5:51 AM, Joao Mazuze Joao_Mazuze@chasssmt.com wrote:

Hi all,

Is there any script which allows us deleting for any specific orgunit on a given period?

Best regards,


João Gabriel Mazuze

National Database Manager

Projecto CHASS-SMT

Abt Associates Inc.

Av. Marginal, 4067

Cidade de Maputo, Moçambique

Fax: (+ 258) 21486767

Tel: (+ 258) 21493525/6/8

Cell: (+258) 82 4236279

www.chasssmt.com

  • Somos um projecto financiado pelo PEPFAR-II, através da USAID, para reforçar o Sistema de Saúde das Provincias de Sofala, Manica e Tete. Pretendemos melhorar a ligação e integração do HIV com os Cuidados Primários de Saúde e outros a ele relacionados em coordenação com as Direcções Provinciais de Saúde e outros parceiros. Através do projecto CHASS-SMT, o Governo Americano apoia o Governo Moçambicano na melhoria da qualidade dos Serviços de Saúde no país.*

This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+46764147049


This message may contain privileged and confidential information intended solely for the addressee. Please do not read, disseminate or copy it unless you are the intended recipient. If this message has been received in error, we kindly ask that you notify the sender immediately by return email and delete all copies of the message from your system.

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+46764147049