# Building a Scorecard

Here's an example of how you can build a scorecard using the credit card underwriting module in Python:

```python
class Scorecard:
    def __init__(self):
        self.criteria = [
            {"name": "Credit Score", "weight": 0.5},
            {"name": "Income", "weight": 0.3},
            {"name": "Bank Account History", "weight": 0.2}
        ]

    def calculate_score(self, credit_score, income, bank_account_history):
        score = 0

        for criterion in self.criteria:
            if criterion["name"] == "Credit Score":
                score += criterion["weight"] * (credit_score / 850)  # Assuming credit score range is 300-850
            elif criterion["name"] == "Income":
                score += criterion["weight"] * (income / 50000)  # Assuming income range is up to $50,000
            elif criterion["name"] == "Bank Account History":
                score += criterion["weight"] * (bank_account_history / 5)  # Assuming bank account history up to 5 years

        return score


# Example usage
credit_score = 720
income = 35000
bank_account_history = 2

scorecard = Scorecard()
score = scorecard.calculate_score(credit_score, income, bank_account_history)

print("Score:", score)
```

In the above code, we create a `Scorecard` class that defines different criteria and their respective weights. The `calculate_score` method takes the credit score, income, and bank account history as inputs and calculates an overall score based on the defined criteria and their weights. Each criterion is normalized within its assumed range to ensure consistent scoring.

In this example, the credit score is assumed to range from 300 to 850, income is assumed to range up to $50,000, and bank account history is assumed to range up to 5 years. The weights assigned to each criterion determine their relative importance in the final score.

You can customize the criteria, weights, and ranges based on your specific underwriting requirements. Additionally, you can incorporate more sophisticated scoring algorithms and include additional criteria as needed to create a more comprehensive scorecard for your credit card underwriting process.
