def METHOD_NAME(self) -> str:
    loc_cols_string = ", ".join(self.locations[0].spatial_unit.location_id_columns)
    # Note: in some ways it would be nicer to use a DayTrajectories query instead of a list of location queries,
    # but DayTrajectories only works with queries that have 'start' and 'stop' attributes
    locations_union = " UNION ALL ".join(
        f"SELECT subscriber, {loc_cols_string}, {i} AS ordinal FROM ({loc.get_query()}) _"
        for i, loc in enumerate(self.locations)
    )
    long_term_activity = f"""
    SELECT
        subscriber,
        count(*) < {len(self.locations)} AS sometimes_inactive,
        bool_or(({loc_cols_string}) IS NULL) AS sometimes_unlocatable
    FROM ({locations_union}) AS locations_union
    GROUP BY subscriber
    """
    sql = f"""
    SELECT
        subscriber,
        CASE
            WHEN ({loc_cols_string}) IS NULL THEN 'unlocated'
            WHEN sometimes_inactive THEN 'irregular'
            WHEN sometimes_unlocatable THEN 'not_always_locatable'
            WHEN max_stay_length.value < {self.stay_length_threshold} THEN 'mobile'
            ELSE 'stable'
        END AS value
    FROM ({self.locations[-1].get_query()}) AS most_recent_period
    LEFT JOIN ({long_term_activity}) AS long_term_activity
    USING (subscriber)
    LEFT JOIN ({self.max_stay_lengths.get_query()}) AS max_stay_length
    USING (subscriber)
    """
    return sql