# INSTRUCTIONSUBTYPE

> Each Dispatch instruction (GD instruct) has a type and subtype. INSTRUCTIONSUBTYPE, together with [`INSTRUCTIONTYPE`](./INSTRUCTIONTYPE.md), sets out valid instruction types.

> INSTRUCTIONSUBTYPE is public data, and is available to all participants.
> 
> Source
> 
> INSTRUCTIONSUBTYPE shows ad hoc updates to market configuration.

## Column Schema

### INSTRUCTIONSUBTYPEID

> Subtype for each dispatch instruction type, for example governor off.

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

This column is mandatory, and a primary key.

Examples:

- `AGCOFF`
- `AGCONNREG`
- `AGCONREG`
- `COMMENT`
- `COMP_OFF`
- `COMP_ON`
- `CONST_OFF`
- `CONST_ON`
- `CONST_TERM`
- `DISPLD_OFF`

### INSTRUCTIONTYPEID

> Instruction type

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

This column is mandatory, and a primary key.

Examples:

- `AS_FC`
- `AS_LS`
- `AS_RGUL`
- `AS_RGUU`
- `AS_RP`
- `GENERAL`
- `NC`
- `RTC`
- `SD`

### DESCRIPTION

> Description of instruction subtype

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

This column is not mandatory.

Examples:

- `AGC Dispatch Off`
- `AGC Dispatch on non-regulating`
- `AGC Dispatch on regulating`
- `Change output to specified MW by specified time`
- `Constrain Unit Off for Frequency Control`
- `Constrain Unit On for Frequency Control`
- `Constrain Unit Terminated`
- `Constrain Unit off for Reactive Power`
- `Constrain Unit on for Reactive Power`
- `Disable Load Shed Block`

### 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: `1999/04/20 14:56:19`

## New Data Timing

> Ad hoc

## 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({"INSTRUCTIONSUBTYPEID": str, "INSTRUCTIONTYPEID": str, "DESCRIPTION": str})
    # Deduplicate
    # We want one row per ['INSTRUCTIONSUBTYPEID', 'INSTRUCTIONTYPEID']
    # Tie-breaker: greatest value of ['LASTCHANGED']
    .sort(["LASTCHANGED"], descending=False)
    .unique(subset=["INSTRUCTIONSUBTYPEID", "INSTRUCTIONTYPEID"], keep="last")
)

```

### Nemosis

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

## Example File

From [PUBLIC_ARCHIVE_INSTRUCTIONSUBTYPE_FILE01_202610010000.zip](https://www.nemweb.com.au/Data_Archive/Wholesale_Electricity/MMSDM/2026/MMSDM_2026_10/MMSDM_Historical_Data_SQLLoader/DATA/PUBLIC_ARCHIVE%23INSTRUCTIONSUBTYPE%23FILE01%23202610010000.zip)

=== "Raw Text with Metadata"
    ```csv
    C,SETP.WORLD,DVD_INSTRUCTIONSUBTYPE,AEMO,PUBLIC,2026/11/09,14:44:35,001794199475427,MONTHLY_ARCHIVE,001794199475427
    I,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,INSTRUCTIONTYPEID,INSTRUCTIONSUBTYPEID,DESCRIPTION,LASTCHANGED
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,AGCONNREG,"AGC Dispatch on non-regulating","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,AGCONREG,"AGC Dispatch on regulating","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,AGCOFF,"AGC Dispatch Off","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,GOV6R,"Governor on for 6 second raise","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,GOV6L,"Governor on for 6 second lower","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,GOV60R,"Governor on for 60 second raise","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,GOV60L,"Governor on for 60 second lower","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_FC,FCASOFF,"Frequency Control Disable","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_RP,ONSYNCOMP,"On as synchronous compensator","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_RP,OFFSYNCOMP,"Off as synchronous compensator","1999/04/20 14:56:19"
    D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,AS_RGUL,RGUL_ENAB,"Rapid Gen Unit Loading Enabled","1999/04/20 14:56:19"
    ...
    C,"END OF REPORT",71
    ```

## Availability

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 for this table into one place, in [this CSV metadata file](../../manifests/per_table/csv/INSTRUCTIONSUBTYPE.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 10 of 2026.
Every month in between has a file. (No gaps.)

## Data Size

    

Each year of data is approximately
16 KB when zipped,
160 KB as unzipped CSV.

        

    

## Deduplication and PDR Loader Configuration

The primary keys are:

- [`INSTRUCTIONSUBTYPEID`](#instructionsubtypeid)

- [`INSTRUCTIONTYPEID`](#instructiontypeid)

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 |
|---------------|-------------------|-----------|
| GD_INSTRUCT | INSTRUCTIONSUBTYPE  | 1 |

This means that the CSV files start with metadata columns:

```csv
I,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,...
D,GD_INSTRUCT,INSTRUCTIONSUBTYPE,1,...
```

`ROW_FILTER_TYPE` is LASTCHANGED

## Indexes

- [`LASTCHANGED`](#lastchanged)

## Links

[This page as JSON](../json/tables/INSTRUCTIONSUBTYPE/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/INSTRUCTIONSUBTYPE/json-schema.json) specification for this table.

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

## Other Information

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