Dingrui(Frank) Zhang

How to use Australian Fair Work Commission API in Python with pyfwc?

Frank / 2022-04-21


Australian Fair Work Commission recently publish their API for modern awards (https://uatdeveloper.fwc.gov.au/). I developed this python package pyfwc as a wrapper to help use this API easily in python. You can also use the script over here as an example.

Pre-requirements

  1. Go to the website (https://uatdeveloper.fwc.gov.au/) and obtain a subscription key. You should be able to find it under the “profile” section of the website.
  2. Install the package by the following command pip install pyfwc

Usage

Firstly, you need to import FWCAPI from the package and register an instance with your subscription key as below

from pyfwc import FWCAPI
fwc = FWCAPI(YOUR_SUBSCRIPTION_KEY)

All below functions would return a pandas dataframe.

Awards

These 2 functions retrieve award related information.

get_awards : get a list of awards based on given criteria

# Get list of awards where it contains "mining" in the name
fwc.get_awards(name = "mining")
## |    |   award_id |   award_fixed_id | code     | name                                  | award_operative_from      | award_operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|-----------:|-----------------:|:---------|:--------------------------------------|:--------------------------|:---------------------|-----------------:|:--------------------------|-----------------:|
## |  0 |       1132 |                1 | MA000001 | Black Coal Mining Industry Award 2020 | 2010-01-01T00:00:00+00:00 |                      |                3 | 2022-01-17T16:12:10+00:00 |             2021 |
## |  1 |       1142 |               11 | MA000011 | Mining Industry Award 2020            | 2010-01-01T00:00:00+00:00 |                      |                2 | 2022-01-20T15:49:41+00:00 |             2021 |
# Get list of awards where it contains "mining" and "black" in the name
fwc.get_awards(name = "mining+black")
## |    |   award_id |   award_fixed_id | code     | name                                  | award_operative_from      | award_operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|-----------:|-----------------:|:---------|:--------------------------------------|:--------------------------|:---------------------|-----------------:|:--------------------------|-----------------:|
## |  0 |       1132 |                1 | MA000001 | Black Coal Mining Industry Award 2020 | 2010-01-01T00:00:00+00:00 |                      |                3 | 2022-01-17T16:12:10+00:00 |             2021 |

get_award : get a specific award

# Get award where its code is "MA000001"
fwc.get_award(id_or_code='MA000001').head(3)
## |    |   award_id |   award_fixed_id | code     | name                                  | award_operative_from      | award_operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|-----------:|-----------------:|:---------|:--------------------------------------|:--------------------------|:---------------------|-----------------:|:--------------------------|-----------------:|
## |  0 |          0 |                1 | MA000001 | Black Coal Mining Industry Award 2020 | 2010-01-01T00:00:00+00:00 |                      |                3 | 2022-01-17T16:12:10+00:00 |             2021 |
## |  1 |          0 |                1 | MA000001 | Black Coal Mining Industry Award 2020 | 2010-01-01T00:00:00+00:00 |                      |                3 | 2021-06-26T11:33:16+00:00 |             2020 |
## |  2 |          0 |                1 | MA000001 | Black Coal Mining Industry Award 2020 | 2010-01-01T00:00:00+00:00 |                      |                3 | 2019-10-23T11:12:07+00:00 |             2019 |

Classifications

These 4 functions retrieve classifications related information.

get_classification : get information for a specific classification in a specific award

# Get classification "98" in award "MA000002"
fwc.get_classification(id_or_code='MA000002',classification_fixed_id='98')
## |    |   classification_fixed_id |   clause_fixed_id |   clauses | clause_description   | parent_classification_name   | classification   |   classification_level | next_down_classification_fixed_id   |   next_up_classification_fixed_id | operative_from            | operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|--------------------------:|------------------:|----------:|:---------------------|:-----------------------------|:-----------------|-----------------------:|:------------------------------------|----------------------------------:|:--------------------------|:---------------|-----------------:|:--------------------------|-----------------:|
## |  0 |                        98 |                 3 |      16.1 | Clerical Employees   |                              | Level 1—Year 1   |                      1 |                                     |                                99 | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-03-03T18:52:51+00:00 |             2021 |

get_classifications : get information for all classifications in a specific award

# Get all classifications in award "MA000012"
fwc.get_classifications(id_or_code='MA000012').head(3)
## |    |   classification_fixed_id |   clause_fixed_id |   clauses | clause_description   | parent_classification_name   | classification                      |   classification_level |   next_down_classification_fixed_id |   next_up_classification_fixed_id | operative_from            | operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|--------------------------:|------------------:|----------:|:---------------------|:-----------------------------|:------------------------------------|-----------------------:|------------------------------------:|----------------------------------:|:--------------------------|:---------------|-----------------:|:--------------------------|-----------------:|
## |  0 |                       549 |                31 |      16.1 | Pharmacy employees   |                              | Pharmacy assistant level 1          |                      1 |                                 nan |                               553 | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-03-03T18:52:51+00:00 |             2021 |
## |  1 |                       553 |                31 |      16.1 | Pharmacy employees   |                              | Pharmacy student—1st year of course |                      1 |                                 549 |                               550 | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-03-03T18:52:51+00:00 |             2021 |
## |  2 |                       550 |                31 |      16.1 | Pharmacy employees   |                              | Pharmacy assistant level 2          |                      2 |                                 553 |                               554 | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-03-03T18:52:51+00:00 |             2021 |

get_payrates : get payrates(including historical) for all classifications in a specific award

# Get all payrates in award "MA000001"
fwc.get_payrates(id_or_code='MA000001').head(3)
## |    |   classification_fixed_id | base_pay_rate_id   | base_rate_type   |   base_rate | calculated_pay_rate_id   | calculated_rate_type   |   calculated_rate | parent_classification_name   | classification                                                                                                                                |   classification_level | employee_rate_type_code   | operative_from            | operative_to   |   version_number |   published_year | last_modified_datetime    |
## |---:|--------------------------:|:-------------------|:-----------------|------------:|:-------------------------|:-----------------------|------------------:|:-----------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------:|:--------------------------|:--------------------------|:---------------|-----------------:|-----------------:|:--------------------------|
## |  0 |                        18 |                    |                  |         nan |                          |                        |                 0 | Group B                      | (Adult coal mining industry employee engaged in one of the following classifications)                                                         |                    nan |                           | 2021-07-01T00:00:00+00:00 |                |                1 |             2021 | 2022-03-03T18:52:51+00:00 |
## |  1 |                         8 |                    |                  |         nan |                          |                        |                 0 | Group A                      | (Adult coal mining industry employees, without prior experience in the coal mining industry, engaged in one of the following classifications) |                    nan |                           | 2021-07-01T00:00:00+00:00 |                |                2 |             2021 | 2022-03-03T18:52:51+00:00 |
## |  2 |                     90835 |                    |                  |         nan |                          |                        |                 0 | Adult apprentices            | Adult apprentices - % of the Mineworker - Induction Level 2 weekly rate                                                                       |                    nan |                           | 2021-07-01T00:00:00+00:00 |                |                1 |             2021 | 2022-01-13T16:41:36+00:00 |

get_current_payrate : get current pay-rate for a specific classification in a specific award

# Get a current payrate for classification "549" in award "MA000012"
fwc.get_current_payrate(id_or_code='MA000012',classification_fixed_id='549')
## |    |   classification_fixed_id | base_pay_rate_id   | base_rate_type   |   base_rate | calculated_pay_rate_id   | calculated_rate_type   |   calculated_rate | parent_classification_name   | classification             |   classification_level | employee_rate_type_code   | operative_from            | operative_to   |   version_number |   published_year | last_modified_datetime    |
## |---:|--------------------------:|:-------------------|:-----------------|------------:|:-------------------------|:-----------------------|------------------:|:-----------------------------|:---------------------------|-----------------------:|:--------------------------|:--------------------------|:---------------|-----------------:|-----------------:|:--------------------------|
## |  0 |                       549 | BR90099            | Weekly           |       848.5 | CR25779                  | Hourly                 |             22.33 |                              | Pharmacy assistant level 1 |                      1 | AD                        | 2021-07-01T00:00:00+00:00 |                |                1 |             2021 | 2022-03-03T18:52:51+00:00 |

Penalities

get_penalties : get all penalties in a specific award

# Get all penalties in award "MA000012"
fwc.get_penalties(id_or_code='MA000012').head(3)
## |    |   penalty_fixed_id |   clause_fixed_id | clause_description                                                                             |   classification_level | penalty_code   | penalty_description                     |   rate | employee_rate_type_code   |   penalty_calculated_value | calculated_includes_all_purpose   | base_pay_rate_id   | operative_from            | operative_to   |   version_number |   published_year | last_modified_datetime    |
## |---:|-------------------:|------------------:|:-----------------------------------------------------------------------------------------------|-----------------------:|:---------------|:----------------------------------------|-------:|:--------------------------|---------------------------:|:----------------------------------|:-------------------|:--------------------------|:---------------|-----------------:|-----------------:|:--------------------------|
## |  0 |               2132 |             21735 | Full-time and part-time adult employees—penalty rates for Saturday, Sunday and public holidays |                      1 |                | Saturday - Between 6.00 pm and 9.00 pm  |    150 | AD                        |                      33.5  | False                             | BR90099            | 2021-07-01T00:00:00+00:00 |                |                1 |             2021 | 2022-01-21T13:24:14+00:00 |
## |  1 |               2132 |             21735 | Full-time and part-time adult employees—penalty rates for Saturday, Sunday and public holidays |                      1 |                | Saturday - Between 6.00 pm and 9.00 pm  |    150 | AD                        |                      33.5  | False                             | BR90103            | 2021-07-01T00:00:00+00:00 |                |                1 |             2021 | 2022-01-21T13:24:14+00:00 |
## |  2 |               2133 |             21735 | Full-time and part-time adult employees—penalty rates for Saturday, Sunday and public holidays |                      1 |                | Saturday - Between 9.00 pm and midnight |    175 | AD                        |                      39.08 | False                             | BR90099            | 2021-07-01T00:00:00+00:00 |                |                1 |             2021 | 2022-01-21T13:24:14+00:00 |

Expense Allowances

These 2 functions retrieve Expense Allowances related information.

get_expense_allowance : get a specific expense allowance in a specific award

# Get expense allowance "49" in award "MA000012"
fwc.get_expense_allowance(id_or_code='MA000012',expense_allowance_fixed_id='49')
## |    |   expense_allowance_fixed_id |   clause_fixed_id | clauses    | allowance_type_code   | parent_allowance   | allowance                                                 | is_all_purpose   |   allowance_amount | payment_frequency   |   last_adjusted_year | cpi_quarter_last_adjusted   | operative_from            | operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|-----------------------------:|------------------:|:-----------|:----------------------|:-------------------|:----------------------------------------------------------|:-----------------|-------------------:|:--------------------|---------------------:|:----------------------------|:--------------------------|:---------------|-----------------:|:--------------------------|-----------------:|
## |  0 |                           49 |              1864 | 19.3(b)(i) |                       |                    | Meal allowance—overtime which exceeds 1.5 hours’ overtime | False            |              19.69 | per occasion        |                 2020 | March Quarter               | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-02-15T15:41:38+00:00 |             2021 |

get_expense_allowances : get all expense allowances in a specific award

# Get all expense allowances in award "MA000012"
fwc.get_expense_allowances(id_or_code='MA000012').head(3)
## |    |   expense_allowance_fixed_id |   clause_fixed_id | clauses    | allowance_type_code   | parent_allowance   | allowance                                                 | is_all_purpose   |   allowance_amount | payment_frequency   |   last_adjusted_year | cpi_quarter_last_adjusted   | operative_from            | operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|-----------------------------:|------------------:|:-----------|:----------------------|:-------------------|:----------------------------------------------------------|:-----------------|-------------------:|:--------------------|---------------------:|:----------------------------|:--------------------------|:---------------|-----------------:|:--------------------------|-----------------:|
## |  0 |                           49 |              1864 | 19.3(b)(i) |                       |                    | Meal allowance—overtime which exceeds 1.5 hours’ overtime | False            |              19.69 | per occasion        |                 2020 | March Quarter               | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-02-15T15:41:38+00:00 |             2021 |
## |  1 |                         9660 |             23173 | 19.3(c)    |                       |                    | Meal allowance—overtime which exceeds 4 hours             | False            |              17.64 | per occasion        |                 2020 | March Quarter               | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-02-15T15:41:38+00:00 |             2021 |
## |  2 |                           53 |              1867 | 19.7       |                       |                    | Motor vehicle allowance                                   | False            |               0.8  | per km              |                 2020 | March Quarter               | 2020-07-01T00:00:00+00:00 |                |                1 | 2022-02-15T15:41:38+00:00 |             2021 |

Wage Allowances

These 2 functions retrieve Wage Allowances related information.

get_wage_allowance : get a specific wage allowance in a specific award

# Get wage allowance "191" in award "MA000012"
fwc.get_wage_allowance(id_or_code='MA000012',wage_allowance_fixed_id='191')
## |    |   wage_allowance_fixed_id |   clause_fixed_id |   clauses | allowance_type_code   | parent_allowance   | allowance             | is_all_purpose   |   rate | rate_unit   | base_pay_rate_id   |   allowance_amount | payment_frequency   | operative_from            | operative_to   |   version_number | last_modified_datetime    |   published_year |
## |---:|--------------------------:|------------------:|----------:|:----------------------|:-------------------|:----------------------|:-----------------|-------:|:------------|:-------------------|-------------------:|:--------------------|:--------------------------|:---------------|-----------------:|:--------------------------|-----------------:|
## |  0 |                       191 |               788 |      19.9 |                       |                    | Broken Hill allowance | False            |   4.28 | Percent     | BR90101            |               38.5 | per week            | 2021-07-01T00:00:00+00:00 |                |                1 | 2022-03-03T09:01:31+00:00 |             2021 |

get_wage_allowances : get all wage allowances in a specific award

# Get all wage allowances in award "MA000012"
fwc.get_wage_allowances(id_or_code='MA000012').head(3)
## |    |   wage_allowance_fixed_id |   clause_fixed_id |   clauses | allowance_type_code   | parent_allowance   | allowance                                                          | is_all_purpose   |   rate | rate_unit   | base_pay_rate_id   |   allowance_amount | payment_frequency   | operative_from            | operative_to              |   version_number | last_modified_datetime    |   published_year |
## |---:|--------------------------:|------------------:|----------:|:----------------------|:-------------------|:-------------------------------------------------------------------|:-----------------|-------:|:------------|:-------------------|-------------------:|:--------------------|:--------------------------|:--------------------------|-----------------:|:--------------------------|-----------------:|
## |  0 |                       191 |               788 |      19.9 |                       |                    | Broken Hill allowance                                              | False            |   4.28 | Percent     | BR90101            |              38.5  | per week            | 2021-07-01T00:00:00+00:00 |                           |                1 | 2022-03-03T09:01:31+00:00 |             2021 |
## |  1 |                     12011 |             23000 |      19.2 |                       |                    | Home medicine reviews or residential medication management reviews | False            |   0    | Percent     | BR90109            |             106.4  | per week            | 2021-07-01T00:00:00+00:00 |                           |                1 | 2022-03-03T09:01:31+00:00 |             2021 |
## |  2 |                       191 |               788 |      19.9 |                       |                    | Broken Hill allowance                                              | False            |   4.28 | Percent     |                    |              37.56 | per week            | 2020-07-01T00:00:00+00:00 | 2021-06-30T00:00:00+00:00 |              nan | 2022-03-03T09:01:31+00:00 |             2020 |

If you find any questions or have any suggestions, feel free to report on the github