Skip to content

Conversation

@yong1le
Copy link

@yong1le yong1le commented Oct 30, 2025

SUMMARY

superset/viz.py

The backend currently provides country results to the frontend in the format:

{
    "country": "string",
    "name": "string",
    // … other fields  
}

The country field is the cca3 code of the country, and name is the country’s full name. country must be sent as a cca3 code, because the frontend plugin used for maps only recognizes cca3 country codes. To improve interoperability and make additional code formats (e.g., cca2, cioc) available without altering the existing response structure, we introduce an additional object field codes:

{
    "country": "string",
    "name": "string",
    "codes": {
        "cca2": "string",
        "cca3": "string",
        "cioc": "string"
    }
// … other fields  
}

This approach was chosen because it preserves backward compatibility with existing frontend expectations (country remains cca3).

superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js

This frontend component handles the world map chart and manages cross-filter interactions through the getCrossFilterDataMask function, which is triggered when a user clicks on a country. Previously, getCrossFilterDataMask only checked if countryFieldType == "name".

If countryFieldType == "name", it used the backend name field (e.g., "Canada"). Otherwise, it used the country field, which was always in cca3 format (e.g., "CAN"). Since countryFieldType supports four known values (name, cca3, cca2, and cioc), the cca2 and cioc cases were effectively ignored. We refactored the logic to handle all four countryFieldType options by using the codes object returned from the backend.

TESTING INSTRUCTIONS

Steps to Verify:

  1. Create a dataset that includes country identifier fields (e.g., name, cca2).
  2. Create two world map charts using these datasets with the countryFieldType as cca2.
  3. Add both charts to the same dashboard.
  4. Interact with the maps by selecting a country.

Expected Result:

Observe that when you click on a country in one map, the corresponding country is highlighted in all other maps.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API
@korbit-ai
Copy link

korbit-ai bot commented Oct 30, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant