> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/public-finance/v2.3/platform/configuration/services/ifix-core-data-cleanup.md).

# iFIX Core Data Cleanup

## Overview

This page provides details on the steps involved in cleaning up the iFIX core data from various environments. Follow the instructions specific to select environment listed below.

* Druid Data Clean-Up&#x20;
* Mongo DB Data Clean-Up
* Postgres Data Clean-Up process.

## **Druid Data Clean-up**

* Open the druid console in the respective environment.
* Go to ***Ingestion*** → ***Supervisors***. And select the particular supervisor (***fiscal-event***)
  1. In ***Action***, click on ***Terminate**.* This terminates the supervisor. Wait for a minute.
* Go to ***DataSources*** and select the particular data source name (***fiscal-event***). And scroll down to *Action.*
  1. Click on the ***Mark as unused all segments** → **Mark as unused all segments**.*

![](/files/IdbUfNmcEJrCZvu6kZpG)

* Click on ***Delete unused segments (issue kill task)*** and enable the permission to delete.

![](/files/7crvHSnrE2uL5AHSVAf6)

Once the clean-up process is completed, follow the instructions here -[ IFIX Fiscal Event Post Processor | Druid-Sink](broken://pages/-MjbymcYPWLij39F4wSa#druid-sink) to run the supervisor.

## &#x20;**MongoDB Data Clean-up**

* Connect to the playground pod and run the command below to connect with mongo DB. mongo --host *\<mongo-db-host>*:*\<mongo-db-port>* -u *\<mongo-db-username>* -p *\<mongo-db-password>*
* Use the *ifix core DB;* use \<db name>
* Run the below command to delete all the data from ***fiscal\_event*** collection. db.fiscal\_event.remove({});
* If you want to delete all fiscal event records of a particular Gram Panchayat then run the command below.

Here let us assume, we have to delete "LODHIPUR" GP (Gram Panchayat) details (that is hierarchy level 6) in the DWSS department. Run the command below.

```
db.fiscal_event.remove({"departmentEntity.ancestry.6.name":{$eq:"LODHIPUR"}});
```

* If you want to delete a fiscal event record based on some other attributes, you have to write a custom mongo delete query.

## **PostgresDB Data Clean-up** <a href="#postgresdb-data-clean-up" id="postgresdb-data-clean-up"></a>

* Connect to the playground pod and run the below command to connect with postgresDB.&#x20;

  *psql -h \<psql-host> -p \<psql-port> -d \<psql-database> -U \<psql-username>*
* It prompts for a password. Enter the password.
* Run the below query to delete all the data from ***fiscal\_event\_aggregated***.

```
DELETE FROM fiscal_event_aggregated;
```

* If you want to delete the particular Gram Panchayat details from fiscal event aggregated record, run the query below.

Here let us assume, we want to delete "LODHIPUR" GP (Gram Panchayat) details (that is hierarchy level 6) in the DWSS department.

```
DELETE FROM fiscal_event_aggregated where departmentEntity_ancestry_6_name='LODHIPUR';
```

{% hint style="warning" %}
**Note:** If you are not sure about deleting the fiscal event aggregated record, you can delete all the records from the fiscal\_event\_aggregated table. Once the records are deleted, either run the fiscal event aggregate Cron Job manually to UpSert all the records or the system UpSerts the records every midnight from Druid to Postgres.
{% endhint %}

> [![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)*​*](http://creativecommons.org/licenses/by/4.0/)*All content on this page by* [*eGov Foundation*](https://egov.org.in/) *is licensed under a* [*Creative Commons Attribution 4.0 International License*](http://creativecommons.org/licenses/by/4.0/)*.*

&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digit.org/public-finance/v2.3/platform/configuration/services/ifix-core-data-cleanup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
