# REGION

> REGION sets out valid region IDs.

> REGION data is public, so is available to all participants.
> 
> Source
> 
> REGION updates if a change is ever made to a region. This table is
> static data and is likely to change very infrequently.

## Column Schema

### REGIONID

> Differentiates this region from all other regions

For more information, see the [dedicated documentation page](../../guide/querying.md#region-id).

The SQL type is `VARCHAR2(10)`.
This is actually a factor/enum, with values:

- `QLD1`

- `VIC1`

- `TAS1`

- `NSW1`

- `SA1`

- `SNOWY1`

This column is mandatory, and a primary key.

### DESCRIPTION

> Full description of region

SQL Type: `VARCHAR2(64)`
Polars Type: `str`

This column is not mandatory.

Examples:

- `New South Wales`
- `Queensland Region`
- `Snowy Regions`
- `South Australia Region`
- `Tasmanian Region`
- `Victoria`

### LASTCHANGED

> Last date and time record changed

For more information, see the [dedicated documentation page](../../guide/querying.md#deduplication).

SQL Type: `DATE`
Polars Type: `pl.Datetime()`

This column is not mandatory.

Example: `2004/06/11 10:43:05`

### REGIONSTATUS

> Status of the region e.g. working, inactive, archive.

SQL Type: `VARCHAR2(8)`
Polars Type: `pl.Categorical`

This column is not mandatory.

Examples:

- `Active`
- `INACTIVE`

## New Data Timing

> When there is change to a region

## Code Examples

### Polars

Explicitly listing every column, casting to enums, categoricals etc is not essential, but may speed up parsing.
Swapping `int` for `pl.UInt16`, `pl.Int32` would also speed up parsing. However some of the datatypes are inferred, so they may be wrong.

This code deduplicates for you.
Deduplication is normally only required across multiple months.

This code assumes that all columns are present, which may not be true for older files.

```python
import polars as pl
import polars.selectors as cs

# e.g. "2029/03/15 00:05:00"
dt_s_fmt = "%Y/%m/%d %H:%M:%S"

csv_paths = ["SOMEFILE.CSV", "OTHERFILE.CSV"]

lf = (
    pl.concat(
        [
            pl.scan_csv(
                csv_path,  # must be unzipped beforehand
                skip_rows=1,  # skip the header
                infer_schema=False,  # much faster
            )
            .filter(cs.by_index(0) == "D")  # drop the footer
            .select(~cs.by_index(range(4)))  # drop metadata columns
            for csv_path in csv_paths
        ],
        how="diagonal_relaxed",
    )
    .with_columns(
        pl.col("LASTCHANGED").str.strptime(pl.Datetime, dt_s_fmt),
    )
    .cast(
        {
            "REGIONID": pl.Enum(["QLD1", "VIC1", "TAS1", "NSW1", "SA1", "SNOWY1"]),
            "DESCRIPTION": str,
            "REGIONSTATUS": pl.Categorical,
        }
    )
    # Deduplicate
    # We want one row per ['REGIONID']
    # Tie-breaker: greatest value of ['LASTCHANGED']
    .sort(["LASTCHANGED"], descending=False)
    .unique(subset=["REGIONID"], keep="last")
)

```

### Nemosis

This table is not yet available in [Nemosis](https://github.com/UNSW-CEEM/NEMOSIS/#static_table).

## Example File

From [PUBLIC_ARCHIVE_REGION_FILE01_202609010000.zip](https://www.nemweb.com.au/Data_Archive/Wholesale_Electricity/MMSDM/2026/MMSDM_2026_09/MMSDM_Historical_Data_SQLLoader/DATA/PUBLIC_ARCHIVE%23REGION%23FILE01%23202609010000.zip)

=== "Raw Text with Metadata"
    ```csv
    C,SETP.WORLD,DVD_REGION,AEMO,PUBLIC,2026/10/09,16:28:01,001791527281444,MONTHLY_ARCHIVE,001791527281444
    I,MARKET_CONFIG,REGION,1,REGIONID,DESCRIPTION,REGIONSTATUS,LASTCHANGED
    D,MARKET_CONFIG,REGION,1,QLD1,"Queensland Region",Active,"2004/06/11 10:43:05"
    D,MARKET_CONFIG,REGION,1,NSW1,"New South Wales",Active,"2004/06/11 10:43:05"
    D,MARKET_CONFIG,REGION,1,VIC1,Victoria,Active,"2004/06/11 10:43:05"
    D,MARKET_CONFIG,REGION,1,SA1,"South Australia Region",Active,"2004/06/11 10:43:05"
    D,MARKET_CONFIG,REGION,1,TAS1,"Tasmanian Region",Active,"2005/05/16 13:25:25"
    D,MARKET_CONFIG,REGION,1,SNOWY1,"Snowy Regions",INACTIVE,"2004/06/11 10:43:05"
    C,"END OF REPORT",9
    ```

## Availability

Visibility: Public

This table is in the public monthly [MMSDM archive](https://www.nemweb.com.au/Data_Archive/Wholesale_Electricity/MMSDM/).

I have collated the list of all those files into one place, in [this CSV metadata file](../../manifests/per_table/csv/REGION.csv). (Columns `year`, `month`, `url`, `compressed_size` in bytes).

The earliest available data is month 1 of 2015.
The most recent available data is month 9 of 2026.

 Every month in between has a file. (No gaps.)

## Data Size

Each year of data is approximately
6 KB when zipped,
60 KB as unzipped CSV.

## Deduplication and PDR Loader Configuration

The primary keys are:

- [`REGIONID`](#regionid)

The transaction type is ["INSERT-UPDATE"](https://di-help.docs.public.aemo.com.au/Content/pdrLoader/How_it_works.htm?TocPath=pdrLoader%7CAbout+pdrLoader%7C_____5#UPDATEINSERT), which means that you will likely see duplicate data with different values.

You should deduplicate by sorting based on `LASTCHANGED`, within each group of primary keys.

[PDR Loader configuration](https://nemweb.com.au/Reports/Current/MMSDataModelReport/PDRCONFIG/PROD_PUBLIC_PDR_CONFIG_FULL.zip) is:

| Report Name | Report Subtype | Version |
|---------------|-------------------|-----------|
| MARKET_CONFIG | REGION  | 1 |

This means that the CSV files start with metadata columns:

```csv
I,MARKET_CONFIG,REGION,1,...
D,MARKET_CONFIG,REGION,1,...
```

`ROW_FILTER_TYPE` is LASTCHANGED

## Indexes

- [`LASTCHANGED`](#lastchanged)

## Links

[This page as JSON](../json/tables/REGION/bespoke.json) (schema documented [here](https://gitlab.com/MatthewDavis/mms-schema/-/blob/master/schema.py?ref_type=heads), but may change)

Download a [JSON Schema](../json/tables/REGION/json-schema.json) specification for this table.

[Official AEMO schema documentation](https://nemweb.com.au/Reports/Current/MMSDataModelReport/Electricity/ElectricityDataModelReport_files/Elec33.htm#100)

## Other Information

Package: [MARKET_CONFIG](../packages/MARKET_CONFIG.md)
