| name | Highest_Cost_Scenario_Identification |
| description | Solve dabstep dataset questions that ask to identify the most expensive Merchant Category Code (MCC) or the most expensive Authorization Characteristics Indicator (ACI) for a given transaction. Use this skill when the question asks "what is the most expensive MCC for a transaction of X euros" or "what is the most expensive ACI for a credit transaction of X euros on [CardScheme]". |
Highest Cost Scenario Identification
This skill covers two question types in the dabstep dataset, both requiring fee calculation from fees.json.
Fee Formula
From manual.md:
fee = fixed_amount + rate * transaction_value / 10000
Null fields in a fee rule apply to all possible values of that field. An empty list [] means the rule does NOT apply to any value of that dimension.
Data Files
fees.json: 1000 fee rules with fields: card_scheme, account_type, capture_delay, monthly_fraud_level, monthly_volume, merchant_category_code, is_credit, aci, fixed_amount, rate, intracountry
manual.md: domain definitions (ACI values A–F, account types, fee formula)
merchant_category_codes.csv: MCC descriptions only — do NOT use as a filter
Question Type 1: Most Expensive MCC
Pattern: "What is the most expensive MCC for a transaction of X euros, in general?"
Algorithm:
- Load
fees.json
- For every rule, compute
fee = fixed_amount + rate * X / 10000
- For each MCC in the rule's
merchant_category_code list, track the maximum fee seen
- Find the global maximum fee across all MCCs
- Return all MCCs (sorted ascending) that achieve this maximum fee
Critical: Include ALL MCCs from fees.json fee rules. Do NOT filter to only MCCs present in merchant_category_codes.csv — some valid MCCs in the fee rules (e.g., 3003, 7231) are absent from that CSV but are correct answers.
Output format: Comma-separated list of MCC integers, sorted ascending.
Example code:
import json
with open('fees.json') as f:
fees = json.load(f)
transaction_value = X
mcc_max_fees = {}
for rule in fees:
mcc_list = rule['merchant_category_code']
if not mcc_list:
continue
fee = rule['fixed_amount'] + rule['rate'] * transaction_value / 10000
for mcc in mcc_list:
if mcc not in mcc_max_fees or fee > mcc_max_fees[mcc]:
mcc_max_fees[mcc] = fee
max_fee = max(mcc_max_fees.values())
result = sorted([mcc for mcc, f in mcc_max_fees.items() if f == max_fee])
print(', '.join(str(m) for m in result))
Question Type 2: Most Expensive ACI
Pattern: "For a credit transaction of X euros on [CardScheme], what would be the most expensive ACI? In the case of a draw between multiple ACIs, return the ACI with the lowest alphabetical order."
Algorithm:
- Load
fees.json
- Filter rules:
card_scheme == CardScheme AND (is_credit == True OR is_credit == None)
- For each filtered rule, skip if
aci list is empty ([])
- Compute
fee = fixed_amount + rate * X / 10000
- For each ACI in the rule's
aci list, track the maximum fee seen
- Find the global maximum fee across all ACIs
- Return the ACI(s) achieving this maximum; if tied, return the alphabetically lowest
Output format: A list with one letter, e.g., ['C']. The answer is the ACI letter, NOT the fee amount.
Card schemes in dataset: GlobalCard, NexPay, TransactPlus, SwiftCharge
ACI values: A, B, C, D, E, F (G appears in the manual but not in any fee rule in this dataset)
Example code:
import json
with open('fees.json') as f:
fees = json.load(f)
card_scheme = 'GlobalCard'
transaction_value = 1
aci_max_fees = {}
for rule in fees:
if rule['card_scheme'] != card_scheme:
continue
if rule['is_credit'] is not None and rule['is_credit'] != True:
continue
aci_list = rule['aci']
if not aci_list:
continue
fee = rule['fixed_amount'] + rule['rate'] * transaction_value / 10000
for aci in aci_list:
if aci not in aci_max_fees or fee > aci_max_fees[aci]:
aci_max_fees[aci] = fee
max_fee = max(aci_max_fees.values())
winners = sorted([aci for aci, f in aci_max_fees.items() if f == max_fee])
answer = winners[0]
print([answer])
Common Mistakes to Avoid
- MCC filtering: Never exclude an MCC just because it's absent from
merchant_category_codes.csv. The fee rules are the authoritative source.
- ACI answer format: The answer must be the ACI letter (e.g.,
C), NOT the computed fee amount (e.g., 0.23). The 0.23 example in the prompt instructions is just a format example, not related to ACI questions.
- Empty lists: Both
merchant_category_code: [] and aci: [] mean "this dimension is not constrained to any specific value" — skip these rules when iterating over MCCs/ACIs specifically.
- is_credit filtering for ACI questions: Include rules with
is_credit=None (applies to all), not just is_credit=True.
- Tie-breaking for ACI: When multiple ACIs have the same maximum fee, return the one that comes first alphabetically.