Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to manually enrich match with full details. #872

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

apognu
Copy link
Contributor

@apognu apognu commented Feb 24, 2025

Open Sanctions's match API returns trimmed down information for each match, we need to provide a way (automatic or manual, depending on whether the API is self-hosted or paid) to enrich it with the full information we can retrieve from the API.

TODO:

  • Manual endpoint to enrich a match

The periodic worker will be added in a separate PR.

@apognu apognu added enhancement New feature or request go Pull requests that update Go code labels Feb 24, 2025
@apognu apognu self-assigned this Feb 24, 2025
@apognu
Copy link
Contributor Author

apognu commented Feb 25, 2025

I am changing the scope of this PR to only include the manual action or enriching the data (the part the frontend depends on).

The worker part will be handled in a separate PR.

@apognu apognu force-pushed the feat/sanctions/data-enrichment branch from 9aa4109 to b62f08b Compare February 25, 2025 12:47
@apognu apognu marked this pull request as ready for review February 25, 2025 12:47
@apognu
Copy link
Contributor Author

apognu commented Feb 25, 2025

Do we want to store that an entity was enriched? My initial thinking was that there might be use cases of enriching data again (if there are updates to a profile), but I am asking myself the question, now.

@Pascal-Delange
Copy link
Contributor

Do we want to store that an entity was enriched?

It depends, if we keep a copy of the initial payload (for audit etc) then we implicitly know it was enriched ?

My initial thinking was that there might be use cases of enriching data again (if there are updates to a profile), but I am asking myself the question, now.

For that part I'd say definitely no, indeed we'd like the enriched version to be stored as soon as possible after the initial one.

Copy link
Contributor

@Pascal-Delange Pascal-Delange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic looks sound, let me just confirm with Arnaud if he thinks the original payload should be kept as part of an audit trail

@apognu
Copy link
Contributor Author

apognu commented Feb 25, 2025

For that part I'd say definitely no, indeed we'd like the enriched version to be stored as soon as possible after the initial one.

Which will not work in the case of manual enrichment. Depending on the user's process for review, it might be enriched quite some time after the fact.

In any case, if we need to keep the previous payload, I'll set this back to draft, since right now I overwrite the data. Same thing if we only want to allow one enrichment (be it manual or automatic), I will need to store the fact that it was enriched.

@Pascal-Delange
Copy link
Contributor

Or we could - but let me know if you think this is a weird pattern or is going to be hard to maintain - just get the json keys from the enriched payload that are not in the old one, and add them to the stored json?

@apognu
Copy link
Contributor Author

apognu commented Feb 25, 2025

I do not see how that would solve our issues, we would still not know which attributes were updated due to enrichment, or if it was enriched at all. And it adds complexity for not a lot of gain.

My guess is, if we need to keep the original, we will copy it in an original_payload column or similar?

Copy link
Contributor

@Pascal-Delange Pascal-Delange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@apognu apognu force-pushed the feat/sanctions/data-enrichment branch from b9974c4 to baca8af Compare February 26, 2025 10:56
@apognu apognu merged commit cb77aa3 into main Feb 26, 2025
3 checks passed
@apognu apognu deleted the feat/sanctions/data-enrichment branch February 26, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants