Documentation

FactEsg
in package

Class FactEsg

FactEsg is responsible for managing ESG (Environmental, Social, and Governance) data storage and retrieval. It supports interaction with both MySQL and MongoDB, depending on configuration.

Table of Contents

Properties

$config  : Config
$mdb  : Database
$mongoDb  : MongoDb
$mySql  : MySql
$queryLogger  : QueryLogger

Methods

__construct()  : mixed
exists()  : int|bool
get()  : array<string|int, mixed>
getQtyByCountryYear()  : array<int, array<string, mixed>>
Aggregate qty by company, country and year for a datapoint.
getWasteBaseRows()  : array<int, array<string, mixed>>
Waste base rows for chart + tooltip + table.
getWasteByIndustryYearForChart()  : array<int, array<string, mixed>>
Waste chart (industry/year totals) with chart-specific rules: - keep only unit T or KT - convert T -> KT - ignore KG/CAPITAL style units - if duplicates for same plant+year exist, prefer location NYD - exclude plants with company_plant_display = NYD
save()  : int|null
Save an ESG fact

Properties

Methods

exists()

public exists(string $dataPointCode, string $kpiCode, string $plantCode, string $locationCode, int $dateid, string $currencyCode, string $unitCode) : int|bool
Parameters
$dataPointCode : string
$kpiCode : string
$plantCode : string
$locationCode : string
$dateid : int
$currencyCode : string
$unitCode : string
Return values
int|bool

get()

public get(string $dataPointCode, string $plantCode, string $locationCode, int $dateid) : array<string|int, mixed>
Parameters
$dataPointCode : string
$plantCode : string
$locationCode : string
$dateid : int
Return values
array<string|int, mixed>

getQtyByCountryYear()

Aggregate qty by company, country and year for a datapoint.

public getQtyByCountryYear(string $datapointCode[, array<string|int, string> $plantCodes = [] ][, array<string|int, int> $years = [] ][, array<string|int, string> $locationCodes = [] ][, array<string|int, string> $companyIndustries = [] ]) : array<int, array<string, mixed>>
Parameters
$datapointCode : string
$plantCodes : array<string|int, string> = []
$years : array<string|int, int> = []
$locationCodes : array<string|int, string> = []
$companyIndustries : array<string|int, string> = []
Return values
array<int, array<string, mixed>>

getWasteBaseRows()

Waste base rows for chart + tooltip + table.

public getWasteBaseRows(string $datapointCode[, array<string|int, int> $years = [] ][, array<string|int, string> $industries = [] ]) : array<int, array<string, mixed>>

One row per (plant_code, date_id) after de-dup (prefer location NYD), qty normalized to KT.

Parameters
$datapointCode : string
$years : array<string|int, int> = []
$industries : array<string|int, string> = []
Return values
array<int, array<string, mixed>>

getWasteByIndustryYearForChart()

Waste chart (industry/year totals) with chart-specific rules: - keep only unit T or KT - convert T -> KT - ignore KG/CAPITAL style units - if duplicates for same plant+year exist, prefer location NYD - exclude plants with company_plant_display = NYD

public getWasteByIndustryYearForChart(string $datapointCode) : array<int, array<string, mixed>>
Parameters
$datapointCode : string
Return values
array<int, array<string, mixed>>

save()

Save an ESG fact

public save(array<string|int, mixed> $data) : int|null
Parameters
$data : array<string|int, mixed>
Return values
int|null

        
On this page

Search results