# GSC Insights


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L19"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_date_ranges_for_comparison

``` python

def get_date_ranges_for_comparison(
    days:int=30, # Number of days per period
)->tuple:

```

*Return two consecutive date ranges for period comparison, accounting
for 3-day GSC delay.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L15"
target="_blank" style="float:right; font-size:smaller">source</a>

### apply_strftime

``` python

def apply_strftime(
    date:datetime
):

```

*Call self as a function.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L36"
target="_blank" style="float:right; font-size:smaller">source</a>

### compare_periods

``` python

def compare_periods(
    recent:list, # Recent period query data
    previous:list, # Previous period query data
)->list:

```

*Compare two periods of query data and return trend analysis sorted by
impression change.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L61"
target="_blank" style="float:right; font-size:smaller">source</a>

### detect_query_trends

``` python

def detect_query_trends(
    session:Session, # Active database session
    site_url:str, # GSC property URL
    page_path:str | None=None, # Filter by page path substring
    days:int=30, # Days per comparison period
    limit:int=100, # Max queries to analyze
)->list:

```

*Detect rising and declining queries by comparing two consecutive
periods.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L142"
target="_blank" style="float:right; font-size:smaller">source</a>

### classify_intent

``` python

def classify_intent(
    query:str, # Search query
)->str:

```

*Classify query intent based on keyword patterns.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L150"
target="_blank" style="float:right; font-size:smaller">source</a>

### classify_page_intents

``` python

def classify_page_intents(
    session:Session, # Active database session
    site_url:str, # GSC property URL
    start_date:str, # Start date (YYYY-MM-DD)
    end_date:str, # End date (YYYY-MM-DD)
    country:str | None=None, # Filter by country code
    page_path:str | None=None, # Filter by page path substring
    limit:int=10, # Max rows to return
)->list:

```

*Get top queries with intent classification.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L194"
target="_blank" style="float:right; font-size:smaller">source</a>

### query_words_in_content

``` python

def query_words_in_content(
    query:str, # Search query
    content:str, # Page content
)->bool:

```

*Check if all significant words from a query appear in the content.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L203"
target="_blank" style="float:right; font-size:smaller">source</a>

### find_missing_queries

``` python

def find_missing_queries(
    queries:list, # GSC query dicts
    content:str, # Page content
)->list:

```

*Find GSC queries whose significant words don’t appear in the page
content.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/gsc_insights.py#L211"
target="_blank" style="float:right; font-size:smaller">source</a>

### find_green_keywords

``` python

def find_green_keywords(
    session:Session, # Active database session
    site_url:str, # GSC property URL
    page_path:str, # Page path to analyze
    content:str, # Page content
    days:int=30, # Days per comparison period
    limit:int=100, # Max queries to analyze
)->list:

```

*Find emerging queries not yet covered in page content.*
