BrickLink Links Fail for Certain Parts #55

Open
opened 2025-01-26 16:32:41 +01:00 by FrederikBaerentsen · 0 comments

When BRICKLINK_LINKS=True, some parts (particularly those with prints) fail to link correctly to BrickLink. Below are three examples illustrating the issue.

Example 1: Torso with Print

  1. Add set 76969.
  2. Navigate to the minifigure.
  3. Open the torso details.
  4. Test both BrickLink and Rebrickable links.

Rebrickable correctly links to 973c03h78pr0001, but the BrickLink link fails. The correct BrickLink part ID is 973pb5957c01. See #52 for similar issue.

Example 2: Printed Pants

  1. Add set 76969.
  2. Navigate to the minifigure.
  3. Open the pants details.
  4. Test both BrickLink and Rebrickable links.

Rebrickable correctly links to 41879a, but the BrickLink link fails. The correct BrickLink part ID is 41879.

Example 3: Simple Part Without Color

A simple part like Plate 1 x 2 in "Blue" (parts/3023/1/302323/details) currently links to:
https://www.bricklink.com/v2/catalog/catalogitem.page?P=3023.

While this link is functional, it does not specify a color. The correct link should be:
https://www.bricklink.com/v2/catalog/catalogitem.page?P=3023&C=7,
where 7 is the BrickLink color_id for "Blue."


Analysis

Certain printed parts, such as 973pb5957c01, require storing BrickLink-specific part IDs in the database to generate accurate links.

Issue 2: Mismatched Color IDs

BrickLink and Rebrickable use different IDs for colors. For example:

  • Rebrickable ID for "Blue" is 1.
  • BrickLink ID for "Blue" is 7.

BrickLink links require both the part_id and the correct color_id. The /api/v3/lego/colors/{id}/ endpoint provides BrickLink color IDs, but this would require either:

  • Making an API call for every link.
  • Storing a color translation table in the database.

Basic parts, such as 3023 (Plate 1 x 2), do not include color in their BrickLink URLs, resulting in less precise links. Adding the correct color_id would make these links more useful.


Proposed Solutions

  1. Store BrickLink Part IDs in the Database

    • This solution would require adding an extra database field to store BrickLink part IDs.
    • To populate this field, all existing parts would need to be queued against the API to retrieve their corresponding BrickLink IDs.
    • Since it is not possible to know which IDs are mismatched beforehand, this would involve significant work and processing time.
  2. Create a Color Translation Table

    • Manually maintaining a mapping table between Rebrickable and BrickLink color IDs in the database is a feasible solution, as there are only 267 colors.
    • However, making API calls to /api/v3/lego/colors/{id}/ during link generation would spam the API, leading to potential throttling or disruptions. This is not a workable solution for performance reasons.
  3. Include Color IDs in BrickLink URLs

    • For basic parts, appending the correct color_id to the BrickLink URL (e.g., &C=7) would improve link accuracy.
    • However, this approach would only work if the manual translation table from Solution 2 (Part 1) is implemented to map Rebrickable color IDs to BrickLink color IDs.
When `BRICKLINK_LINKS=True`, some parts (particularly those with prints) fail to link correctly to BrickLink. Below are three examples illustrating the issue. ## Example 1: Torso with Print 1. Add set `76969`. 2. Navigate to the minifigure. 3. Open the torso details. 4. Test both BrickLink and Rebrickable links. Rebrickable correctly links to `973c03h78pr0001`, but the BrickLink link fails. The correct BrickLink part ID is `973pb5957c01`. See #52 for similar issue. ## Example 2: Printed Pants 1. Add set `76969`. 2. Navigate to the minifigure. 3. Open the pants details. 4. Test both BrickLink and Rebrickable links. Rebrickable correctly links to `41879a`, but the BrickLink link fails. The correct BrickLink part ID is `41879`. ## Example 3: Simple Part Without Color A simple part like `Plate 1 x 2` in "Blue" (`parts/3023/1/302323/details`) currently links to: `https://www.bricklink.com/v2/catalog/catalogitem.page?P=3023`. While this link is functional, it does not specify a color. The correct link should be: `https://www.bricklink.com/v2/catalog/catalogitem.page?P=3023&C=7`, where `7` is the BrickLink `color_id` for "Blue." --- ## Analysis ### Issue 1: Missing BrickLink Part IDs Certain printed parts, such as `973pb5957c01`, require storing BrickLink-specific part IDs in the database to generate accurate links. ### Issue 2: Mismatched Color IDs BrickLink and Rebrickable use different IDs for colors. For example: - Rebrickable ID for "Blue" is `1`. - BrickLink ID for "Blue" is `7`. BrickLink links require both the `part_id` and the correct `color_id`. The `/api/v3/lego/colors/{id}/` endpoint provides BrickLink color IDs, but this would require either: - Making an API call for every link. - Storing a color translation table in the database. ### Issue 3: Lack of Color-Specific Links for Basic Parts Basic parts, such as `3023` (Plate 1 x 2), do not include color in their BrickLink URLs, resulting in less precise links. Adding the correct `color_id` would make these links more useful. --- ## Proposed Solutions 1. **Store BrickLink Part IDs in the Database** - This solution would require adding an extra database field to store BrickLink part IDs. - To populate this field, all existing parts would need to be queued against the API to retrieve their corresponding BrickLink IDs. - Since it is not possible to know which IDs are mismatched beforehand, this would involve significant work and processing time. 2. **Create a Color Translation Table** - Manually maintaining a mapping table between Rebrickable and BrickLink color IDs in the database is a feasible solution, as there are only 267 colors. - However, making API calls to `/api/v3/lego/colors/{id}/` during link generation would spam the API, leading to potential throttling or disruptions. This is not a workable solution for performance reasons. 3. **Include Color IDs in BrickLink URLs** - For basic parts, appending the correct `color_id` to the BrickLink URL (e.g., `&C=7`) would improve link accuracy. - However, this approach would only work if the manual translation table from Solution 2 (Part 1) is implemented to map Rebrickable color IDs to BrickLink color IDs.
FrederikBaerentsen added the
Kind/Bug
label 2025-01-26 16:32:41 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: FrederikBaerentsen/BrickTracker#55
No description provided.