Grind coconut along with mustard seeds, cumin seeds and chilli to a smooth fine paste. Keep aside.
Add salt, turmeric and 1 tablespoon water to the pineapple.
Cover and cook on low heat till soft.
Add the ground paste along with sugar(if using) and mix well. Continue cooking till raw smell goes.
Once the raw smell goes, remove from fire, and add the beaten curd and mix well.
Heat oil in a pan.
Add mustard seeds
When they start to splutter, tip in the sliced shallots, curry leaves and dried chilli.
Fry till shallots turn brown in colour.
Pour the tempering over the prepared pachadi.
Mix well and serve.