← Tasks
Country coverage: VAT/GST rate tables for 6 new jurisdictions (retry 1) (retry 2) (retry 3)
completedcode_genP0
Description
Build VAT/GST rate lookup for BR, IN, KR, AU, JP, SG.
Assignee
-
Claimed By
Cloud Lu → Claude Sonnet
Created
11h ago
Completed
5h ago
Quality
Overall
13%
Pass
FAIL
Graded By
-
Graded At
-
Cost
Input Tokens
-
Output Tokens
-
Est. USD
-
Result
{
"cost": {
"input_tokens": 63,
"estimated_usd": 0.094869,
"output_tokens": 6312
},
"model": "claude-sonnet-4-20250514",
"status": "success",
"transport": "anthropic_api",
"latency_ms": 75320,
"response_text": "I'll create comprehensive VAT/GST rate lookup tables for Brazil, India, South Korea, Australia, Japan, and Singapore.\n\n```python\nimport pandas as pd\nfrom datetime import datetime\nfrom typing import Dict, List, Optional\n\nclass VATGSTRateLookup:\n \"\"\"\n VAT/GST rate lookup system for multiple jurisdictions\n Supports Brazil, India, South Korea, Australia, Japan, and Singapore\n \"\"\"\n \n def __init__(self):\n self.rate_tables = self._initialize_rate_tables()\n \n def _initialize_rate_tables(self) -> Dict:\n return {\n 'BR': self._brazil_rates(),\n 'IN': self._india_rates(),\n 'KR': self._south_korea_rates(),\n 'AU': self._australia_rates(),\n 'JP': self._japan_rates(),\n 'SG': self._singapore_rates()\n }\n \n def _brazil_rates(self) -> Dict:\n \"\"\"Brazil - ICMS (state VAT) + IPI (federal) + PIS/COFINS\"\"\"\n return {\n 'country': 'Brazil',\n 'tax_name': 'ICMS/IPI/PIS/COFINS',\n 'currency': 'BRL',\n 'standard_rate': 18.0, # Average ICMS rate\n 'rates': {\n # ICMS rates by state (most common)\n 'ICMS_AC': 17.0, # Acre\n 'ICMS_AL': 17.0, # Alagoas\n 'ICMS_AP': 18.0, # Amapá\n 'ICMS_AM': 18.0, # Amazonas\n 'ICMS_BA': 18.0, # Bahia\n 'ICMS_CE': 18.0, # Ceará\n 'ICMS_DF': 18.0, # Distrito Federal\n 'ICMS_ES': 17.0, # Espírito Santo\n 'ICMS_GO': 17.0, # Goiás\n 'ICMS_MA': 18.0, # Maranhão\n 'ICMS_MT': 17.0, # Mato Grosso\n 'ICMS_MS': 17.0, # Mato Grosso do Sul\n 'ICMS_MG': 18.0, # Minas Gerais\n 'ICMS_PA': 17.0, # Pará\n 'ICMS_PB': 18.0, # Paraíba\n 'ICMS_PR': 18.0, # Paraná\n 'ICMS_PE': 18.0, # Pernambuco\n 'ICMS_PI': 18.0, # Piauí\n 'ICMS_RJ': 20.0, # Rio de Janeiro\n 'ICMS_RN': 18.0, # Rio Grande do Norte\n 'ICMS_RS': 18.0, # Rio Grande do Sul\n 'ICMS_RO': 17.5, # Rondônia\n 'ICMS_RR': 17.0, # Roraima\n 'ICMS_SC': 17.0, # Santa Catarina\n 'ICMS_SP': 18.0, # São Paulo\n 'ICMS_SE': 18.0, # Sergipe\n 'ICMS_TO': 18.0, # Tocantins\n \n # Federal taxes\n 'IPI_standard': 10.0, # Industrial Products Tax\n 'IPI_reduced': 5.0,\n 'IPI_exempt': 0.0,\n 'PIS_standard': 1.65, # Social Integration Program\n 'COFINS_standard': 7.6, # Social Security Financing\n 'PIS_simplified': 0.73,\n 'COFINS_simplified': 3.0,\n },\n 'categories': {\n 'food_basic': {'ICMS': 7.0, 'IPI': 0.0, 'PIS': 0.0, 'COFINS': 0.0},\n 'food_processed': {'ICMS': 12.0, 'IPI': 5.0, 'PIS': 1.65, 'COFINS': 7.6},\n 'pharmaceuticals': {'ICMS': 12.0, 'IPI': 0.0, 'PIS': 1.65, 'COFINS': 7.6},\n 'books': {'ICMS': 0.0, 'IPI': 0.0, 'PIS': 0.0, 'COFINS': 0.0},\n 'electronics': {'ICMS': 18.0, 'IPI': 15.0, 'PIS': 1.65, 'COFINS': 7.6},\n 'automobiles': {'ICMS': 18.0, 'IPI': 25.0, 'PIS': 1.65, 'COFINS': 7.6},\n 'services': {'ISS': 5.0, 'PIS': 1.65, 'COFINS': 7.6}, # Municipal service tax\n 'luxury_goods': {'ICMS': 25.0, 'IPI': 30.0, 'PIS': 1.65, 'COFINS': 7.6}\n }\n }\n \n def _india_rates(self) -> Dict:\n \"\"\"India - Goods and Services Tax (GST)\"\"\"\n return {\n 'country': 'India',\n 'tax_name': 'GST',\n 'currency': 'INR',\n 'standard_rate': 18.0,\n 'rates': {\n 'standard': 18.0,\n 'reduced_1': 5.0,\n 'reduced_2': 12.0,\n 'luxury': 28.0,\n 'zero': 0.0,\n 'exempt': 0.0,\n 'cess_additional': 15.0 # Additional cess on luxury/sin goods\n },\n 'categories': {\n # 0% GST\n 'grains': 0.0,\n 'fresh_vegetables': 0.0,\n 'fresh_fruits': 0.0,\n 'milk': 0.0,\n 'salt': 0.0,\n 'jaggery': 0.0,\n \n # 5% GST\n 'tea': 5.0,\n 'coffee': 5.0,\n 'sugar': 5.0,\n 'edible_oil': 5.0,\n 'coal': 5.0,\n 'medicines': 5.0,\n 'books': 5.0,\n 'newspapers': 5.0,\n 'footwear_under_1000': 5.0,\n 'textiles': 5.0,\n \n # 12% GST\n 'butter': 12.0,\n 'ghee': 12.0,\n 'mobile_phones': 12.0,\n 'computers': 12.0,\n 'processed_food': 12.0,\n 'ayurvedic_medicines': 12.0,\n \n # 18% GST (Standard)\n 'biscuits': 18.0,\n 'steel': 18.0,\n 'iron': 18.0,\n 'soaps': 18.0,\n 'toothpaste': 18.0,\n 'capital_goods': 18.0,\n 'industrial_intermediates': 18.0,\n 'services': 18.0,\n \n # 28% GST (Luxury)\n 'automobiles': 28.0,\n 'air_conditioners': 28.0,\n 'refrigerators': 28.0,\n 'washing_machines': 28.0,\n 'cigarettes': 28.0, # Plus additional cess\n 'aerated_drinks': 28.0, # Plus additional cess\n 'luxury_cars': 28.0, # Plus additional cess up to 22%\n 'pan_masala': 28.0, # Plus 135% cess\n 'cement': 28.0,\n 'paint': 28.0,\n 'ceramics': 28.0\n }\n }\n \n def _south_korea_rates(self) -> Dict:\n \"\"\"South Korea - Value Added Tax (VAT)\"\"\"\n return {\n 'country': 'South Korea',\n 'tax_name': 'VAT',\n 'currency': 'KRW',\n 'standard_rate': 10.0,\n 'rates': {\n 'standard': 10.0,\n 'zero': 0.0,\n 'exempt': 0.0\n },\n 'categories': {\n # Standard rate (10%)\n 'general_goods': 10.0,\n 'services': 10.0,\n 'restaurants': 10.0,\n 'hotels': 10.0,\n 'electronics': 10.0,\n 'automobiles': 10.0,\n 'clothing': 10.0,\n 'furniture': 10.0,\n \n # Zero-rated\n 'exports': 0.0,\n 'international_transport': 0.0,\n \n # Exempt\n 'basic_foodstuffs': 0.0,\n 'medical_services': 0.0,\n 'educational_services': 0.0,\n 'financial_services': 0.0,\n 'insurance': 0.0,\n 'residential_rent': 0.0,\n 'public_transport': 0.0,\n 'books': 0.0,\n 'newspapers': 0.0,\n 'magazines': 0.0,\n 'cultural_events': 0.0\n }\n }\n \n def _australia_rates(self) -> Dict:\n \"\"\"Australia - Goods and Services Tax (GST)\"\"\"\n return {\n 'country': 'Australia',\n 'tax_name': 'GST',\n 'currency': 'AUD',\n 'standard_rate': 10.0,\n 'rates': {\n 'standard': 10.0,\n 'zero': 0.0,\n 'exempt': 0.0\n },\n 'categories': {\n # Standard rate (10%)\n 'general_goods': 10.0,\n 'services': 10.0,\n 'restaurants': 10.0,\n 'accommodation': 10.0,\n 'alcohol': 10.0,\n 'electronics': 10.0,\n 'automobiles': 10.0,\n 'clothing': 10.0,\n 'furniture': 10.0,\n 'entertainment': 10.0,\n \n # GST-free (0%)\n 'basic_food': 0.0,\n 'exports': 0.0,\n 'medical_services': 0.0,\n 'hospital_services': 0.0,\n 'educational_courses': 0.0,\n 'books': 0.0,\n 'newspapers': 0.0,\n 'magazines': 0.0,\n 'childcare': 0.0,\n 'aged_care': 0.0,\n 'charitable_fundraising': 0.0,\n 'religious_services': 0.0,\n 'precious_metals': 0.0,\n 'international_transport': 0.0,\n \n # Input taxed (exempt)\n 'residential_rent': 0.0,\n 'financial_supplies': 0.0,\n 'insurance': 0.0,\n 'residential_property_sales': 0.0,\n 'school_fees': 0.0\n }\n }\n \n def _japan_rates(self) -> Dict:\n \"\"\"Japan - Consumption Tax (Shouhizei)\"\"\"\n return {\n 'country': 'Japan',\n 'tax_name': 'Consumption Tax',\n 'currency': 'JPY',\n 'standard_rate': 10.0,\n 'rates': {\n 'standard': 10.0,\n 'reduced': 8.0,\n 'zero': 0.0,\n 'exempt': 0.0\n },\n 'categories': {\n # Standard rate (10%)\n 'general_goods': 10.0,\n 'services': 10.0,\n 'restaurants_dining_in': 10.0, # Eating in restaurants\n 'alcohol': 10.0,\n 'electronics': 10.0,\n 'automobiles': 10.0,\n 'clothing': 10.0,\n 'furniture': 10.0,\n 'accommodation': 10.0,\n 'entertainment': 10.0,\n 'cosmetics': 10.0,\n 'books_digital': 10.0,\n \n # Reduced rate (8%)\n 'food_beverages': 8.0, # Excluding alcohol and dining in\n 'newspapers': 8.0, # Subscription newspapers (twice weekly+)\n 'takeout_delivery': 8.0, # Food takeout and delivery\n 'convenience_store_food': 8.0, # If taken out\n \n # Exempt\n 'exports': 0.0,\n 'international_transport': 0.0,\n 'medical_services': 0.0,\n 'social_welfare': 0.0,\n 'educational_services': 0.0,\n 'residential_rent': 0.0,\n 'securities_trading': 0.0,\n 'insurance': 0.0,\n 'postal_stamps': 0.0,\n 'cremation_burial': 0.0\n },\n 'special_rules': {\n 'restaurant_classification': {\n 'eat_in': 10.0,\n 'takeout': 8.0,\n 'delivery': 8.0,\n 'catering': 10.0\n }\n }\n }\n \n def _singapore_rates(self) -> Dict:\n \"\"\"Singapore - Goods and Services Tax (GST)\"\"\"\n return {\n 'country': 'Singapore',\n 'tax_name': 'GST',\n 'currency': 'SGD',\n 'standard_rate': 8.0, # Increased from 7% to 8% in 2023\n 'rates': {\n 'standard': 8.0,\n 'zero': 0.0,\n 'exempt': 0.0\n },\n 'categories': {\n # Standard rate (8%)\n 'general_goods': 8.0,\n 'services': 8.0,\n 'restaurants': 8.0,\n 'retail': 8.0,\n 'electronics': 8.0,\n 'automobiles': 8.0,\n 'clothing': 8.0,\n 'furniture': 8.0,\n 'accommodation': 8.0,\n 'entertainment': 8.0,\n 'telecommunications': 8.0,\n 'utilities': 8.0,\n 'professional_services': 8.0,\n 'construction': 8.0,\n \n # Zero-rated\n 'exports': 0.0,\n 'international_services': 0.0,\n 'investment_precious_metals': 0.0,\n 'international_transport': 0.0,\n 'goods_in_transit': 0.0,\n \n # Exempt\n 'financial_services': 0.0,\n 'insurance': 0.0,\n 'residential_property_sales': 0.0,\n 'residential_rent': 0.0,\n 'medical_services': 0.0,\n 'hospital_services': 0.0,\n 'educational_services': 0.0,\n 'childcare': 0.0,\n 'charitable_services': 0.0,\n 'public_transport': 0.0,\n 'postal_services': 0.0\n }\n }\n \n def get_rate(self, country: str, category: str = None) -> float:\n \"\"\"Get tax rate for a specific country and category\"\"\"\n if country not in self.rate_tables:\n raise ValueError(f\"Country {country} not supported\")\n \n country_data = self.rate_tables[country]\n \n if category is None:\n return country_data['standard_rate']\n \n if category in country_data['categories']:\n return country_data['categories'][category]\n \n # Return standard rate if category not found\n return country_data['standard_rate']\n \n def get_country_info(self, country: str) -> Dict:\n \"\"\"Get complete tax information for a country\"\"\"\n if country not in self.rate_tables:\n raise ValueError(f\"Country {country} not supported\")\n \n return self.rate_tables[country]\n \n def search_categories(self, country: str, search_term: str) -> Dict[str, float]:\n \"\"\"Search for categories containing a specific term\"\"\"\n if country not in self.rate_tables:\n raise ValueError(f\"Country {country} not supported\")\n \n categories = self.rate_tables[country]['categories']\n search_term_lower = search_term.lower()\n \n return {\n category: rate for category, rate in categories.items()\n if search_term_lower in category.lower()\n }\n \n def create_rate_comparison_table(self, categories: List[str]) -> pd.DataFrame:\n \"\"\"Create comparison table of rates across countries for specific categories\"\"\"\n data = []\n \n for country in self.rate_tables:\n country_info = self.rate_tables[country]\n row = {\n 'Country': country_info['country'],\n 'Tax Name': country_info['tax_name'],\n 'Currency': country_info['currency'],\n 'Standard Rate': country_info['standard_rate']\n }\n \n for category in categories:\n if category in country_info['categories']:\n rate = country_info['categories'][category]\n if isinstance(rate, dict):\n # Handle complex tax structures like Brazil\n total_rate = sum(rate.values()) if rate else 0\n row[category.replace('_', ' ').title()] = total_rate\n else:\n row[category.replace('_', ' ').title()] = rate\n else:\n row[category.replace('_', ' ').title()] = country_info['standard_rate']\n \n data.append(row)\n \n return pd.DataFrame(data)\n \n def calculate_tax_amount(self, country: str, net_amount: float, category: str = None) -> Dict:\n \"\"\"Calculate tax amount for given net amount\"\"\"\n rate = self.get_rate(country, category)\n country_info = self.get_country_info(country)\n \n # Handle complex tax structures (like Brazil)\n if category and category in country_info['categories']:\n cat_data = country_info['categories'][category]\n if isinstance(cat_data, dict):\n # Multiple taxes\n tax_breakdown = {}\n total_tax = 0\n for tax_type, tax_rate in cat_data.items():\n tax_amount = net_amount * (tax_rate / 100)\n tax_breakdown[tax_type] = {\n 'rate': tax_rate,\n 'amount': tax_amount\n }\n total_tax += tax_amount\n \n return {\n 'net_amount': net_amount,\n 'total_tax_rate': rate,\n 'total_tax_amount': total_tax,\n 'gross_amount': net_amount + total_tax,\n 'tax_breakdown': tax_breakdown,\n 'currency': country_info['currency']\n }\n \n # Simple tax calculation\n tax_amount = net_amount * (rate / 100)\n \n return {\n 'net_amount': net_amount,\n 'tax_rate': rate,\n 'tax_amount': tax_amount,\n 'gross_amount': net_amount + tax_amount,\n 'currency': country_info['currency']\n }\n\n# Example usage and testing\ndef main():\n # Initialize the lookup system\n vat_gst = VATGSTRateLookup()\n \n # Test basic rate lookup\n print(\"=== Basic Rate Lookup ===\")\n countries = ['BR', 'IN', 'KR', 'AU', 'JP', 'SG']\n for country in countries:\n info = vat_gst.get_country_info(country)\n print(f\"{info['country']}: {info['tax_name']} - {info['standard_rate']}%\")\n \n print(\"\\n=== Category-specific Rates ===\")\n # Test category-specific rates\n test_cases = [\n ('IN', 'automobiles'),\n ('JP', 'food_beverages'),\n ('AU', 'basic_food'),\n ('SG', 'exports'),\n ('KR', 'medical_services'),\n ('BR', 'electronics')\n ]\n \n for country, category in test_cases:\n rate = vat_gst.get_rate(country, category)\n country_name = vat_gst.get_country_info(country)['country']\n print(f\"{country_name} - {category}: {rate}%\")\n \n print(\"\\n=== Tax Calculation Examples ===\")\n # Test tax calculations\n calculations = [\n ('IN', 1000, 'automobiles'),\n ('JP', 5000, 'food_beverages'),\n ('AU', 2000, 'electronics'),\n ('SG', 1500, 'restaurants'),\n ('BR', 3000, 'electronics')\n ]\n \n for country, amount, category in calculations:\n result = vat_gst.calculate_tax_amount(country, amount, category)\n country_name = vat_gst.get_country_info(country)['country']\n print(f\"\\n{country_name} - {category}:\")\n print(f\" Net: {result['currency']} {amount:,.2f}\")\n if 'tax_breakdown' in result:\n print(f\" Tax breakdown:\")\n for tax_type, details in result['tax_breakdown'].items():\n print(f\" {tax_type}: {details['rate']}% = {result['currency']} {details['amount']:.2f}\")\n print(f\" Total tax: {result['currency']} {result['total_tax_amount']:.2f}\")\n print(f\" Gross: {result['currency']} {result['gross_amount']:.2f}\")\n else:\n print(f\" Tax ({result['tax_rate']}%): {result['currency']} {result['tax_amount']:.2f}\")\n print(f\" Gross: {result['currency']} {result['gross_amount']:.2f}\")\n \n print(\"\\n=== Rate Comparison Table ===\")\n # Create comparison table\n comparison_categories = ['food_beverages', 'electronics', 'automobiles', 'services']\n comparison_df = vat_gst.create_rate_comparison_table(comparison_categories)\n print(comparison_df.to_string(index=False))\n \n print(\"\\n=== Search Categories ===\")\n # Search for food-related categories in India\n food_categories = vat_gst.search_categories('IN', 'food')\n print(\"Food-related categories in India:\")\n for category, rate in food_categories.items():\n print(f\" {category}: {rate}%\")\n\nif __name__ == \"__main__\":\n main()\n```\n\nThis comprehensive VAT/GST rate lookup system provides:\n\n## Key Features:\n\n1. **Complete Rate Tables** for all 6 jurisdictions:\n - **Brazil**: Complex system with ICMS (state), IPI (federal), PIS/COFINS\n - **India**: GST with 0%, 5%, 12%, 18%, 28% rates plus cess\n - **South Korea**: Simple 10% VAT system\n - **Australia**: 10% GST with extensive exemptions\n - **Japan**: 10% standard, 8% reduced rate system\n - **Singapore**: 8% GST (updated 2023 rate)\n\n2. **Category-specific Rates**: Detailed product/service classifications\n\n3. **Tax Calculations**: Handle both simple and complex tax structures\n\n4. **Comparison Tools**: Cross-country rate comparisons\n\n5. **Search Functionality**: Find rates by category keywords\n\n## Special Handling:\n\n- **Brazil**: Multiple concurrent taxes (ICMS + IPI + PIS/COFINS)\n- **India**: Luxury cess on top of standard GST rates\n- **Japan**: Restaurant classification (eat-in vs. takeout)\n- **Complex Exemptions**: Each country's specific exempt categories\n\nThe system is designed to be easily extensible and can handle future rate changes or additional jurisdictions."
}Task ID: c7aa2ee5-33f1-47ed-98e6-b3a2c9519e4d