-
Notifications
You must be signed in to change notification settings - Fork 50
Aul UI d2 5574 identity map v3 technical sample #915
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
base: staging-phase-2-identity-map-v3
Are you sure you want to change the base?
Aul UI d2 5574 identity map v3 technical sample #915
Conversation
| JOIN uid_mapping um ON (imp.uid = um.current_uid OR imp.uid = um.previous_uid) | ||
| JOIN conversions conv ON (conv.uid = um.current_uid OR conv.uid = um.previous_uid) | ||
| WHERE um.opt_out = FALSE | ||
| ORDER BY RANDOM() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we want to order by random here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the demo - we're showing 10 rows, if we don't order by random you'll just see a bunch of rows for the same impression.
|
|
||
| ### 3. Run Complete Demo | ||
| ```bash | ||
| # Full workflow: test data → UID2 mapping → attribution analysis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would help to be more specific that it is 'test data population'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't finish. looks great but multiple small copy fixes.
Hoping you could address and I could look again tomorrow -- or even, if you want, I could address... but there are a couple of questions I've marked. Hope this helps anyway. I will look again tomorrow.
|
|
||
| ## Integration Example | ||
|
|
||
| For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map V3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V3 > v3 -- could we do this in the destination please? Or say Version 3
| ## Integration Example | ||
|
|
||
| For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map V3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example). | ||
| While the sample is implemented using the Python SDK, the integration patterns are applicable to any SDK or direct API integration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't the main meaning for "while" so better not to use it, to avoid possible misunderstanding..
From
While the sample is implemented using the Python SDK, the integration patterns are applicable to any SDK or direct API integration.
To
The sample uses the Python SDK, but the integration patterns are applicable to any SDK or direct API integration.
| For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map V3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example). | ||
| While the sample is implemented using the Python SDK, the integration patterns are applicable to any SDK or direct API integration. | ||
|
|
||
| For step-by-step setup instructions and to run the example, see the [Integration Example README](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example/README.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the link copy, use the title of the destination doc. In which case we don't need "the" also.
From:
see the [Integration Example README]
To:
see [UID2 Integration Technical Sample]
| | [5: Monitor for Raw UID2 Refresh](#5-monitor-for-raw-uid2-refresh) | Use the refresh timestamp (`r` field) returned from the [POST /identity/map](../endpoints/post-identity-map.md) endpoint to determine when to refresh Raw UID2s. | | ||
| | [6: Monitor for Opt-Out Status](#6-monitor-for-opt-out-status) | API call to the [POST /optout/status](../endpoints/post-optout-status.md) endpoint. | | ||
|
|
||
| ## Integration Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Is this identical copy? If yes -- on the short term, same edits.
But, better if we implement as a snippet. I can do it if you want. -
A question. Is this applicable to Snowflake, and/or AWS Entity Resolution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is and it is applicable to Snowflake. Gian is finishing changes to that doc now. This is not applicable to AWS Entity Resolution.
I'll make changes you've suggested above across the board.
Didn't know about snippets, could you please help with that?
| mixed_response = client.generate_identity_map(mixed_input) | ||
| ``` | ||
|
|
||
| ### Integration Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the identical copy, same edits and preferably a snippet... same as prior comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a subtle difference for Python SDK vs the others - in other places I say that the pattern is applicable despite the example using Python SDK, here I don't. Not sure it's worth keeping them separate though - happy to make it the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aulme that makes sense, thx. But I do think we should have a snippet. I think it'd be OK to still have that line in the Python SDK doc... it's kind of unnecessary data but I don't think it sounds weird. It's just info.
LMK if you want me to do that for you in the branch.
| WHERE opt_out = FALSE | ||
| AND (current_uid IS NULL OR refresh_from < datetime('now')); | ||
|
|
||
| -- Attribution joins using both current and previous UIDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIDs > UID2s
|
|
||
| **Patterns for UID2 Integration:** | ||
|
|
||
| ✅ **Request Limits**: Maximum 5,000 DIIs per request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As previous. Don't say DIIs anywhere.
| ✅ **Sequential Processing**: No parallel requests to UID2 service | ||
| ✅ **Retry Logic**: Exponential backoff for network failures | ||
| ✅ **Optout Handling**: Permanent exclude opted out users from future processing | ||
| ✅ **Token Refresh**: Re-map tokens when they reach `refresh_from` timestamps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it tokens, not raw UID2s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I raw UID2s, used colloquially
| [project] | ||
| name = "identity-map-tech-sample-2" | ||
| version = "0.1.0" | ||
| description = "UID2 Identity Map V3 technical sample demonstrating email/phone to UID2 mapping with proper optout handling" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V3 > v3
optout handling > opt-out handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aulme thanks for the fixes. One more small mod on the shared cotent, for a line break.
Some instances of UID that should be UID2, still.
Also instances of DIIs -- I'd really like if we didn't have this, even in the code. It's not correct.
All else looks great, thx.
| ### Integration Example | ||
|
|
||
| For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map v3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example). | ||
| The sample uses the Python SDK, but the integration patterns are applicable to any SDK or direct API integration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need one extra line break to make a new para. Assuming you want a new para here. Same for all 4 instances.
| mixed_response = client.generate_identity_map(mixed_input) | ||
| ``` | ||
|
|
||
| ### Integration Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aulme that makes sense, thx. But I do think we should have a snippet. I think it'd be OK to still have that line in the Python SDK doc... it's kind of unnecessary data but I don't think it sounds weird. It's just info.
LMK if you want me to do that for you in the branch.
| | `src/populate_test_uid_mappings.py` | Creates 100k test records | Database schema, DII formatting | | ||
| | `src/map_identities.py` | **Core UID2 mapping logic** | Batch processing, retry logic, response handling | | ||
| | `src/populate_test_conversions_impressions.py` | Attribution demo data | UID2 token usage in measurement | | ||
| | `src/attribution_analysis.py` | Attribution analysis | Cross-UID joins, measurement patterns | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
| @@ -0,0 +1,45 @@ | |||
| #!/usr/bin/env python3 | |||
| """ | |||
| Complete demo of UID Identity Mapping: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
Should be everywhere except code. Since this is for the UID2 site, not shared content.
| Complete demo of UID Identity Mapping: | ||
| - Creates a test database. | ||
| - Populates the database with test identity mapping data. | ||
| - Runs the UID mapping process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
|
|
||
|
|
||
| def build_uid_input(records: list[IdentityToMap]) -> tuple[IdentityMapV3Input, list[str]]: | ||
| """Build UID input object from database records. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
| @@ -0,0 +1,114 @@ | |||
| #!/usr/bin/env python3 | |||
| """ | |||
| UID Attribution Test Data Population | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
| UID Attribution Test Data Population | ||
| Creates impression and conversion test data using actual mapped UIDs. | ||
| Should be run AFTER UID mapping is complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
|
|
||
|
|
||
| def generate_uid() -> str: | ||
| """Generate a UID for testing""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID > UID2
| print(f" Opted out: {opted_out_count}") | ||
| print(f" Up for refresh: {refresh_needed_count}") | ||
| print(f" Never mapped: {never_mapped_count}") | ||
| print(f" Invalid DIIs: {invalid_dii_count}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get "DIIs" out? Maybe even out of the code? It would be better to say DII. It's a collective term. More than one email address or phone number is still DII.
There are multiple instances. I didn't mark them because they're in the code but if we change them all it will work I think? It would be good to not have this, even in the code.
No description provided.