src/recommendations/src/recommendations-service/experimentation/experiment_ab.py [27:85]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        log.debug(f'{self._getClassName()} - assigned user {user_id} to variation {variation_idx} for experiment {self.feature}.{self.name}')

        # Increment exposure counter for variation for this experiment.
        self._increment_exposure_count(variation_idx)

        # Get item recommendations from the variation's resolver.
        variation = self.variations[variation_idx]

        resolve_params = {
            'user_id': user_id,
            'product_id': current_item_id,
            'product_list': item_list,
            'num_results': num_results,
            'context': context
        }
        items = variation.resolver.get_items(**resolve_params)

        # Inject experiment details into recommended item list.
        rank = 1
        for item in items:
            correlation_id = self._create_correlation_id(user_id, variation_idx, rank)

            item_experiment = {
                'id': self.id,
                'feature': self.feature,
                'name': self.name,
                'type': self.type,
                'variationIndex': variation_idx,
                'resultRank': rank,
                'correlationId': correlation_id
            }

            item.update({ 
                'experiment': item_experiment
            })

            rank += 1

        if tracker is not None:
            # Detailed tracking of exposure.
            event = {
                'event_type': 'Experiment Exposure',
                'event_timestamp': int(round(time.time() * 1000)),
                'attributes': {
                    'user_id': user_id,
                    'experiment': {
                        'id': self.id,
                        'feature': self.feature,
                        'name': self.name,
                        'type': self.type
                    },
                    'variation_index': variation_idx,
                    'variation': variation.config
                }
            }

            tracker.log_exposure(event)

        return items
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/recommendations/src/recommendations-service/experimentation/experiment_mab.py [28:86]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        log.debug(f'{self._getClassName()} - assigned user {user_id} to variation {variation_idx} for experiment {self.feature}.{self.name}')

        # Increment exposure count for variation
        self._increment_exposure_count(variation_idx)

        # Fetch recommendations using the variation's resolver
        variation = self.variations[variation_idx]

        resolve_params = {
            'user_id': user_id,
            'product_id': current_item_id,
            'product_list': item_list,
            'num_results': num_results,
            'context': context
        }
        items = variation.resolver.get_items(**resolve_params)

        # Inject experiment details into recommended items list
        rank = 1
        for item in items:
            correlation_id = self._create_correlation_id(user_id, variation_idx, rank)

            item_experiment = {
                'id': self.id,
                'feature': self.feature,
                'name': self.name,
                'type': self.type,
                'variationIndex': variation_idx,
                'resultRank': rank,
                'correlationId': correlation_id
            }

            item.update({ 
                'experiment': item_experiment
            })

            rank += 1

        if tracker is not None:
            # Track exposure details for analysis
            event = {
                'event_type': 'Experiment Exposure',
                'event_timestamp': int(round(time.time() * 1000)),
                'attributes': {
                    'user_id': user_id,
                    'experiment': {
                        'id': self.id,
                        'feature': self.feature,
                        'name': self.name,
                        'type': self.type
                    },
                    'variation_index': variation_idx,
                    'variation': variation.config
                }
            }

            tracker.log_exposure(event)

        return items
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



