the Power to change anything.

Forming Sales Territories – Web Application


Our client, a data science company supporting pharma and healthcare industry players, provides a service to their clients for forming territories for their salesforce. This process helps to monitor and allocate the sales team better. The formed territories need to be compliant with German regulation, e.g., hold a minimum population, clinics, or doctors count. Despite using a tool to support the territory building process, with the rich amount and complexity of data they have, there was a need to invest in leveraging the existing tool.

The challenge lay in forming geographically sound territories, and reduce the time-consuming task for service consultants in to mere minutes. So far, the service consultants needed to invest hours into optimising the territories after each production run. Therefore, our client sought to leverage clustering algorithms to automate and optimise the territory building process.

We took on the challenge to develop a specialised web application and Python package for salesforce territory building. The focal points was a user-friendly interface and a robust yet regulation-compliant clustering algorithm.

  • How to design an intuitive, user-friendly tool with an easily navigable interface?
  • What’s the most efficient clustering algorithm, adhering to stringent regulations?


With the sales territory builder, we created a web application and Python package that implemented a custom geographic clustering algorithm.

  1. Web Application: Developed an intuitive, cloud-hosted web interface for mapping geographies, accessible anytime, anywhere, with scalable cloud resources.
  2. Custom Machine Learning Algorithm: Ensured balanced clusters by considering parameters such as achieving a minimum number of doctors in each cluster.
  3. Efficient Workflow: Through automation and optimisation, we transformed a half-day manual effort of territory building into a streamlined, fully automated flow, significantly reducing time and improving efficiency.
  4. Consistency: Enabled seamless retrieval of Geospatial data, working without any manual intervention required.


Aiku collaborated with the client to develop a specialised web application and Python package for salesforce territory building. This innovative solution incorporated a custom geographic clustering algorithm, enabling the creation of well-balanced clusters based on diverse parameters, streamlining the territory optimisation process for enhanced efficiency and precision.

  1. Specialised Solution: Developed a dedicated web application and Python package, ensuring a tailored approach for salesforce territory construction.
  2. Custom Geographic Clustering: Integrated a bespoke algorithm, enabling the creation of balanced clusters based on multifaceted parameters, enhancing the accuracy of territory formations.
  3. Efficiency Enhancement: Streamlined the territory optimisation process, reducing manual efforts significantly while improving precision and effectiveness.

Tech Stack delivered

  • Strategy: Aligned vision and goal setting with the sponsors and subject matter experts.
  • Product: Defined product roadmap with product owner. Tracked data on progress on Jira and all technical documentation on Confluence.
  • DevOps: Utilised Python for programming, GitLab for version control and continuous integration, and PyTest for automated testing.
  • Cloud Hosted the web application on Cloudera for seamless accessibility and flexible scalability.
  • Data:
    • Geopy and Geopandas for loading and working with geographic datasets.
    • Data transformations with Pandas and NumPy.
    • Stored output in Exasol data warehouse and generated downloads as Excel file.
  • ML/AI Custom clustering algorithm on the basis of scikit-learn Gaussian Mixture implementation.
  • Application:
    • CLI application for interacting with the API of the clustering algorithm.
    • Multi-page streamlit application featuring folium map visualisations.

Do you want to know how we change everything?

Schedule a call and we can show you how to boost your business.

Related Customer Stories

This website uses cookies to ensure you get the best experience.


Many subscribers already enjoy our premium stuff. Subscribe now.