bcgov / cas-ggircs

Climate Action Secretariat's Greenhouse Gas Industrial Reporting and Control System
Apache License 2.0
3 stars 4 forks source link

R3 reports technical data is not parsed correctly #282

Closed matthieu-foucault closed 3 years ago

matthieu-foucault commented 3 years ago

This was reported by CAS. The admin data is parsed properly, but emissions are missing

Robb-Tones commented 3 years ago

from SWRS report 17878...

-

-

-

-

-

-

7437.645 7437.645 124-38-9 CO2 nonbio

-

1.89 47.25 74-82-8 CH4

-

0.19 56.62 10024-97-2 N2O

-

7541.515

matthieu-foucault commented 3 years ago

An R3 report has the following XML node under <ActivityData> which for some reason does not get parsed properly. @Robb-Tones what is that CasNumber value? I don't recall seeing it anywhere else. Should we extract it too?

    <TotalAttributableEmissions>
      <TotalGroups TotalGroupType="TotalAttribEmissions">
        <Totals>
          <Emissions EmissionsGasType="AttributableEmissions">
            <TotalRow>
              <Quantity>42.42</Quantity>
              <CalculatedQuantity>42.42</CalculatedQuantity>
              <CasNumber>124-38-9</CasNumber>
              <GasName>CO2 nonbio</GasName>
            </TotalRow>
            <TotalRow>
              <Quantity>42</Quantity>
              <CalculatedQuantity>42</CalculatedQuantity>
              <CasNumber>74-82-8</CasNumber>
              <GasName>CH4</GasName>
            </TotalRow>
            <TotalRow>
              <Quantity>42</Quantity>
              <CalculatedQuantity>42</CalculatedQuantity>
              <CasNumber>10024-97-2</CasNumber>
              <GasName>N2O</GasName>
            </TotalRow>
            <GrandTotal>
              <Total>4242</Total>
            </GrandTotal>
          </Emissions>
        </Totals>
      </TotalGroups>
    </TotalAttributableEmissions>

@dleard it sounds like you're going to be the one with the most expertise here. I suggest pairing on this with @naomiaro or @pbastia for knowledge transfer.

dleard commented 3 years ago

I'll make this my first priority at the beginning of next week since I'm away from Jul 30 - Aug 6.

dleard commented 3 years ago

I have downloaded report #17878 to take a look at the structure. Is there something special about R3 type reports? This report doesn't contain any details other than emissions. In all other reports the emission data is parsed knowing the structure of all reports is as such: <ActivityData> ..<Process> <-- Not in R3 ....<SubProcess> <-- Not in R3 ......<Unit> <-- Not in R3 ........<Fuel> <-- Not in R3 ..........<Emissions> ............<Emission> <-- Not in R3 The emissions materialized view does not allow null values for any of the ancestors. The child tag beneath
<Emissions> is also different (instead of <Emission> there is <TotalRow> which is the main cause of why these emissions do not get parsed). This isn't a problem, we can create an entirely new materialized view to parse the emissions out of these types of reports without ancestors and with different child tags. tldr: I'm just wondering if there's any context regarding these R3 reports that I should know before I go parsing the emissions with no fuel/unit data. @Robb-Tones

matthieu-foucault commented 3 years ago

@Robb-Tones can you confirm that R3 reports correspond to the reporting requirement for reporting operations that emit less than 10kt CO2e, as per the Greenhouse Gas Emission Reporting Regulation, section 14, paragraph 6

Robb-Tones commented 3 years ago

@Robb-Tones what is that CasNumber value?

'CasNumber' probably refers to the Chemical Abstracts Service Registry Number. It's a unique number code used in chemistry, since we (chemists) are not very good at naming chemical compounds consistently. I confirmed that 124-38-9 is the CAS registry number for carbon dioxide (CO2). It should probably be included... but it is odd that it's not in the regular reports, only R3.

Robb-Tones commented 3 years ago

@Robb-Tones can you confirm that R3 reports correspond to the reporting requirement for reporting operations that emit less than 10kt CO2e, as per the Greenhouse Gas Emission Reporting Regulation, section 14, paragraph 6

Yes, you've got it exactly. This is why they are missing so many fields. Qinghan calls them "simple reports".

matthieu-foucault commented 3 years ago

We don't have any R3 reports in our test GGIRCS database, so this will have to be assessed once it's deployed to prod on Monday