# Mitigate duplicate data capture

**URL:** <https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313>\
**Category:** Development\
**Tags:** forms, extension-libs, descendant-of-curren\
**Created:** [February 6, 2024, 12:35pm UTC](https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313 "2024-02-06T12:35:48Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Anro](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/anro/32/2145_2.png) [@Anro](https://forum.communityhealthtoolkit.org/u/Anro)\
**Post date:** [February 14, 2024, 10:19am UTC](https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313/7 "2024-02-14T10:19:05Z")

</div>

> [@jkuester](#):
>
> I _think_ (have not tested) it is just a matter of changing [this check](https://github.com/medic/cht-core/blob/dac993b4529cd70fea76cf9678f0c2e02705e7e5/ddocs/medic-db/medic-client/views/contacts_by_freetext/map.js#L7) in the CouchDB view and then [this value](https://github.com/medic/cht-core/blob/dac993b4529cd70fea76cf9678f0c2e02705e7e5/shared-libs/search/src/generate-search-requests.js#L5) in the app code.

Thank you @jkuester, I’ll be sure to fiddle around with these values and test the results.  
@gareth, in [this](https://forum.communityhealthtoolkit.org/t/unexpected-search-results/3288/7) thread, mentioned it might be worthwhile re-evaluating how search is, and should, function.

> [@jkuester](#):
>
> It is hard to be sure (since it seems like the challenges for stuff like this are always the little things you don’t anticipate), but I briefly had a look through that code and nothing jumped out at me as being particularly difficult to back-port to `4.2`.

Too true! So far the functionality seems to be working, at least from a form usage perspective.  
Running the accompanying tests might tell a different story, but we’ll see.  
Thank you for taking the time to give it a once over.

We’ve also tried implementing a way to `redirect` a user to the doc they’re interested in.  
We tried to dynamically construct a href value, then set that anchor tag as the content for another field - with the hopes of eventually styling a button.  
Unfortunately, the only way we’ve been able to achieve redirection, due to the dynamic values, is by using hyperlink markdown - which unfortunately opens a new tab.  
It would be awesome if there’s a way to do this more elegantly, do you perhaps know of a mechanism?

 ![image](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/8/8a900247c8aa39f05a7fe56244e82fb5ad6b0358.png)  
The test xlsx can be found [here](https://docs.google.com/spreadsheets/d/1j5IDodPQ_kadWCQWhgE9BIR1xUY761Mz/edit?usp=drive_link&ouid=116686630670829159353&rtpof=true&sd=true) for your reference.

Has [Levenshtein Distance (LD)](https://redis.com/blog/what-is-fuzzy-matching/) or something similar ever been considered as a way to fuzzy search db records? Would something like that be possible?

> [@jkuester](#):
>
> I am curious why you decided to add `moment` globally instead of just using something like webpack to package it with your extension code?

I’m reluctant to admit my knowledge regarding webpack bundling is a bit sparse. Simply importing the moment library in the extension file did not work. I was unsure how to go about it , and received help from another dev in order to get this working solution.  
How would one go about utilizing webpack to package it with an extension? For future reference.

We’d be more than happy to contribute the code upstream! Thank you for highlighting the space where this needs to be implemented.

---

_[View the full topic](https://forum.communityhealthtoolkit.org/t/mitigate-duplicate-data-capture/3313)._
