Skip to main content

Mercedes Ordering: Decisions

This page records the choices the Mercedes implementation in services/ai_ordering/.../oem/mercedes/ makes. It records only decisions specific to Mercedes. The cross-OEM architecture is in the ordering platform ADRs.

1. Every run modifies an existing order​

A Mercedes run modifies dealer orders already in NetSTAR. Each target is one modifiable order, named by its PO number. The attempt's order_id is that PO number. No Mercedes run places a new order.

The pilot model list​

A run modifies only orders whose model code is on the pilot model list, oem/mercedes/pilot_models.json. One list applies to every dealer and every model year. The DTEC lookup (pull_dtec_models) is made for each order's own model code and model year. A change to the list takes effect when the ordering service is deployed.

2. The builds of a modification attempt​

Each attempt records the builds of ADR-007:

BuildRead fromsourceraw
originalpull_order_detail for the PO, before the curenetstar:order-detailOrderDetail
curedthe configuration NetSTAR returns for the modified ordernetstar:modified-configurationModifiedConfiguration

submit records no final. An attempt is SUCCESS when NetSTAR accepts the order update, and submit does not read the order back. The report shows cured. A SIMULATED attempt makes no NetSTAR call, so it has no builds. Its report card shows the candidate's options (see The report card).

The option_codes of both builds are catalog feature codes in the <type>:<code> form that features_from_config produces. Type 2 is paint and type 4 is upholstery. features_from_candidate maps the recommendation into the same codes.

3. The requested changes are configurable​

The cure requests only the changes get_configurable_diff returns:

  • it adds a recommended feature only when consolidated/features marks it is_configurable;
  • it removes a feature only when the feature is configurable and not an ACCESSORY.

A non-configurable code that the recommendation lists and the order lacks is therefore not a requested change. The report's not_kept list (ADR-018) is computed against this diff. Computed against the whole recommendation, it would list every such code as a change NetSTAR did not keep.

4. The report card​

  • Headline rows: paint (2:), upholstery (4:), trim (INTERIOR_TRIM) and wheels (WHEEL). The remaining configurable features of the card's build are its options. A feature that consolidated/features marks not configurable is standard equipment, and the card does not list it among the options. Nor does it list a feature that a package of the same build contains. The package's price includes that feature's price.
  • The report shows each code without its type prefix, as NetSTAR shows it to the dealer.
  • Names and prices come from the consolidated/features rows of the attempt's model code and model year. The live and simulated compositions read the same table.
  • The MSRP is a base price plus the consolidated/features prices of the build's configurable features, headline rows included. It leaves out the price of a feature that a package of the build contains. The warehouse is not the OMS, so the build sets msrp_is_estimated.
  • The model name comes from consolidated/models.
  • A live attempt's card shows its cured build, with the base_price of the cured ModifiedConfiguration, and lists its changes to the original build. An attempt without both builds gets no card.
  • A simulated attempt never reaches NetSTAR, so it has neither build. Its card shows the candidate's options, with the msrp of consolidated/models as the base price, and lists no changes. A model with no msrp gets a card with no MSRP. The attempt's model_code holds the candidate's model_id, so the card reads its model code from consolidated/models.
  • report_data reads consolidated/features only for the model years of attempts that get a card. A model missing from consolidated/models, or whose model year has no consolidated/features rows, gets no rows. The workflow still sends the rows of the other models. If report_data raised, the workflow would not run send_run_summary, and it would send no report.
  • The card's image is a COSY render of its build. The render needs the candidate's baumuster_code and the build's paint and upholstery. COSY renders a model in one of two code forms. A model that COSY has migrated takes the paint code with a U suffix and the upholstery code with an A suffix. Any other model takes both codes unchanged. No field of the model says which form it takes. Both forms occur within one model year. exterior_image_urls therefore returns both URLs, the migrated form first. The report fetches the second URL only when the first returns no image.

5. The session's dealer​

A NetSTAR session acts for the dealer its user currently has selected. A user with access to several dealers can switch dealers on the same session. A run for one dealer could then modify another dealer's orders. Before construct_targets builds any target, a live run reads the session's currentDealerCode from GET /user-api/users/current:

ResponseErrorExit reason
currentDealerCode is another dealerSessionConflictSESSION_CONFLICT
401 or 403, or no user.currentDealerCodeAuthExpiredAUTH_EXPIRED

Both errors are non-retryable. A simulated run makes no NetSTAR call, so it does not check the session's dealer.

A user can also switch dealers later in the run. NetSTAR returns only the inventory of the session's current dealer. submit pulls that inventory before each order update. When the target order is missing from it, submit reads currentDealerCode again and raises the error that the table above lists for the response. When the session's current dealer is the run's dealer, submit returns an attempt that fails with OrderingNotPermitted and sets target_invalidated. When the target order is in the inventory, submit does not read currentDealerCode.

6. A refused candidate​

NetSTAR's answervalidate_and_cureThe run
401 or 403 to any requestraises AuthExpiredends
500 with a message in _MODEL_PRODUCT_DATA_ERRORS to pull_product_datarefuses with target_invalidatedmoves on to its next target
another HTTP error to any requestrefuses the candidatetries the slot's next candidate
a cured build that fails validate_cured_candidaterefuses the candidatetries the slot's next candidate

An HTTP error's refusal reason is NetSTAR's error message. pull_product_data names only the target's model and build day. For some models, NetSTAR answers it with an HTTP 500 whose message, such as "There is a Pricing error on this vehicle", every candidate of the slot gets. _MODEL_PRODUCT_DATA_ERRORS lists those messages. Any other error refuses only the candidate, so the slot's next candidate makes the request again.

A cured build's refusal reason ends with the messages of NetSTAR's /analysis responses, which say why NetSTAR did not add or keep a code. It holds at most _MAX_REFUSAL_MESSAGES distinct messages, each truncated to _MAX_REFUSAL_MESSAGE_CHARS characters. submit refuses a cured build the same way.