Behavioral Based Content (BBC) provides behavior-based personalization for anonymous users. It tracks user interactions with taxonomy terms and uses this data to dynamically influence content ordering in Views via a custom sort plugin. The module optionally supports machine learning–based predictions.

How It Works

  1. Anonymous users browse content
  2. Their interactions with taxonomy terms are tracked
  3. Scores are stored per user and term
  4. Views sorting uses these scores to personalize results

Project link

https://www.drupal.org/project/bbc

Comments

c.moisiadis created an issue. See original summary.

c.moisiadis’s picture

Status: Active » Needs review
vishal.kadam’s picture

Issue summary: View changes
avpaderno’s picture

Thank you for applying!

Before giving links helpful to understand how the review process works, what to expect from a review, and what to do to avoid a review takes more time than needed, I would like to thank all the reviewers for the work they do.
These applications are volunters-driven, which also means it is not possible to predict when an application will be marked fixed and the applicant will get the permission to opt projects into security advisory policy. While we aim to make an application as quick as possible, it is also important for us that more people review the project used for an application. In this way, we make sure applications do not miss some important points that should be instead reported.
Applications are not meant to be complete debugging sessions that eliminate every existing bug, though. I apologize if sometimes applications seem to go into too-detailed reviews.

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • If you have not done it yet, you should enable GitLab CI for the project and fix the PHP_CodeSniffer errors/warnings it reports.
  • For the time this application is open, only your commits are allowed.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.

    Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
  • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a project moderator before posting the first comment on newly created applications. Project moderators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

vishal.kadam’s picture

Status: Needs review » Needs work

1. FILE: README.md

The README file is missing the required sections - Requirements, and Configuration.

2. FILE: composer.json

There is no need to add the required Drupal version, since that is already added by the Drupal.org Composer façade.

3. FILE: bbc.module

Since the module is declared compatible with Drupal 10.3, removing the function implementing the hook is not possible. The function still needs to be defined, but it calls the method defined by the service class, as described in Support for object oriented hook implementations using autowired services (Backwards-compatible Hook implementation for Drupal versions from 10.1 to 11.0).

4. FILE: src/EventSubscriber/NodeViewSubscriber.php

  /**
   * Behavior tracker service.
   */
  protected BehaviorTracker $tracker;

  /**
   * Current user.
   */
  protected AccountProxyInterface $currentUser;

  /**
   * Constructor.
   */
  public function __construct(
    BehaviorTracker $tracker,
    AccountProxyInterface $currentUser,
  ) {
    $this->tracker = $tracker;
    $this->currentUser = $currentUser;
  }

FILE: src/Form/BehaviorBasedContentSettingsForm.php

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * The constructor.
   */
  public function __construct(
    ConfigFactoryInterface $config_factory,
    TypedConfigManagerInterface $typed_config_manager,
    EntityTypeManagerInterface $entityTypeManager,
  ) {
    parent::__construct($config_factory, $typed_config_manager);
    $this->entityTypeManager = $entityTypeManager;
  }

FILE: src/Form/DashboardForm.php

  /**
   * The database connection.
   */
  protected Connection $database;

  /**
   * The base predictor.
   */
  protected PredictionInterface $basePredictor;

  /**
   * The ML predictor.
   */
  protected PredictionInterface $mlPredictor;

  public function __construct(
    Connection $database,
    PredictionInterface $base_predictor,
    PredictionInterface $ml_predictor,
  ) {
    $this->database = $database;
    $this->basePredictor = $base_predictor;
    $this->mlPredictor = $ml_predictor;
  }

FILE: src/Plugin/views/sort/BehaviorBasedContentSort.php

  /**
   * Database connection.
   */
  protected Connection $database;

  /**
   * Config factory.
   */
  protected ConfigFactoryInterface $configFactory;

  /**
   * Request stack.
   */
  protected RequestStack $requestStack;

  /**
   * Prediction base service.
   */
  protected PredictionInterface $prediction;

  /**
   * Prediction ML service.
   */
  protected PredictionInterface $predictionMl;

  /**
   * Constructor.
   */
  public function __construct(
    array $configuration,
    $plugin_id,
    $plugin_definition,
    Connection $database,
    ConfigFactoryInterface $configFactory,
    RequestStack $requestStack,
    PredictionInterface $prediction,
    PredictionInterface $predictionMl,
  ) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->database = $database;
    $this->configFactory = $configFactory;
    $this->requestStack = $requestStack;
    $this->prediction = $prediction;
    $this->predictionMl = $predictionMl;
  }

FILE: src/Service/BehaviorBasedContentCleanupService.php

  /**
   * The database connection.
   */
  protected Connection $database;

  /**
   * The config factory.
   */
  protected ConfigFactoryInterface $configFactory;

  /**
   * The time service.
   */
  protected TimeInterface $time;

  /**
   * The logger.
   */
  protected LoggerInterface $logger;

  /**
   * The constructor.
   *
   * @param \Drupal\Core\Database\Connection $database
   *   The database connection.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
   *   The config factory.
   * @param \Drupal\Component\Datetime\TimeInterface $time
   *   The time service.
   * @param \Psr\Log\LoggerInterface $logger
   *   The logger.
   */
  public function __construct(
    Connection $database,
    ConfigFactoryInterface $configFactory,
    TimeInterface $time,
    LoggerInterface $logger,
  ) {
    $this->database = $database;
    $this->configFactory = $configFactory;
    $this->time = $time;
    $this->logger = $logger;
  }

FILE: src/Service/BehaviorTracker.php

  /**
   * The database connection.
   */
  protected Connection $database;

  /**
   * The config factory.
   */
  protected ConfigFactoryInterface $configFactory;

  /**
   * The request stack.
   */
  protected RequestStack $requestStack;

  /**
   * The time service.
   */
  protected TimeInterface $time;

  public function __construct(
    Connection $database,
    ConfigFactoryInterface $configFactory,
    RequestStack $requestStack,
    TimeInterface $time,
  ) {
    $this->database = $database;
    $this->configFactory = $configFactory;
    $this->requestStack = $requestStack;
    $this->time = $time;
  }

FILE: src/Service/MlPrediction.php

  /**
   * The database connection.
   */
  protected Connection $database;

  /**
   * The logger.
   */
  protected LoggerInterface $logger;

  /**
   * The trained model.
   */
  protected ?KNearestNeighbors $model = NULL;

  /**
   * The state.
   */
  protected StateInterface $state;

  /**
   * The constructor.
   *
   * @param \Drupal\Core\Database\Connection $database
   *   The database connection.
   * @param \Psr\Log\LoggerInterface $logger
   *   The logger.
   * @param \Drupal\Core\State\StateInterface $state
   *   The state.
   */
  public function __construct(Connection $database, LoggerInterface $logger, StateInterface $state) {
    $this->database = $database;
    $this->logger = $logger;
    $this->state = $state;
    $this->loadModel();
  }

FILE: src/Service/MlTrainer.php

  /**
   * The database connection.
   */
  protected Connection $database;

  /**
   * The state.
   */
  protected StateInterface $state;

  public function __construct(Connection $database, StateInterface $state) {
    $this->database = $database;
    $this->state = $state;
  }

FILE: src/Service/PredictionBase.php

  /**
   * The database connection.
   */
  protected Connection $database;

  public function __construct(Connection $database) {
    $this->database = $database;
  }

New modules, which are compatible with Drupal 10 and higher versions are expected to include type declarations in property definitions, and use constructor property promotion.

5. FILE: src/Plugin/QueueWorker/BehaviorBasedContentCleanupQueueWorker.php

Projects that are compatible with Drupal 10 or higher versions should use attributes instead of annotations.

c.moisiadis’s picture

Status: Needs work » Needs review

Thank you for reviewing this @vishal.kadam. The requested changes have been commited and pushed to 1.0.x branch. Please review and let me know if any additional changes are required.

c.moisiadis’s picture

Status: Needs review » Needs work
c.moisiadis’s picture

Status: Needs work » Needs review

I have made some additional fixes, and it is now ready for review

c.moisiadis’s picture

Issue summary: View changes
vishal.kadam’s picture

Rest seems fine to me.

Please wait for other reviewers and Project Moderator to take a look and if everything goes fine, you will get the role.

vishal.kadam’s picture

Priority: Normal » Major

I am changing priority as per Issue priorities.

avpaderno’s picture

Priority: Major » Normal
Status: Needs review » Reviewed & tested by the community

There are some empty lines at the beginning of some functions/methods which should be removed.

avpaderno’s picture

Assigned: Unassigned » avpaderno

Thank you for your contribution and for your patience with the review process!

I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

These are some recommended readings to help you with maintainership:

You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank also all the reviewers for helping with these applications.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

c.moisiadis’s picture

Thank you @avpaderno and @vishal.kadam for your reviews and guidance. Much appreciated!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.