FLCAC-admin / uslci-content

Supplementary content for the U.S. Life Cycle Inventory Database
MIT License
24 stars 6 forks source link

Elementary flows listed with default providers #7

Closed bl-young closed 11 months ago

bl-young commented 3 years ago

In the latest release (2021 - Q1) there are elementary flows in the outputs that list default providers. This appears both on the Commons and in openLCA. They can't be deleted in the user interface, only with SQL or by deleting the flow. Picture is from Containerboard, average production, at mill.

commons

Also found in

Can be found via SQL:

select exch.ID, 
   flows.name as flow_name,
   exch.is_input,
   exch.resulting_amount_value as amount,
   units.name as unit,
   flows.flow_type as flow_type,
   processes.name as proc_name,
   provider.name as provider
from tbl_exchanges exch
left outer join tbl_flows flows on exch.f_flow = flows.id
left outer join tbl_units units on exch.f_unit = units.id
left outer join tbl_processes processes on exch.f_owner = processes.id
left outer join tbl_processes provider on exch.f_default_provider = provider.id
where provider.name is not NULL and flows.flow_type = 'ELEMENTARY_FLOW'
FLCAC-admin commented 2 years ago

Also can use this script to generate list with exchange IDs and then a list of SQL: "UPDATE tbl_exchanges set F_DEFAULT_PROVIDER = 0 where ID = EXCHANGE_ID;" statements with specific exchange IDs; this occurs almost every quarter after QC clears the issue and the database is pushed to the collaboration server. Unresolved but the band-aid is in the quarterly QC procedures.

SELECT p.id AS Process_ID, p.name AS Process_Name, f.ID AS FLOW_ID, f.REF_ID AS Flow_UUID, f.NAME AS Flow_Name, f.FLOW_TYPE AS Flow_Type, f.f_location AS Geography, u.id AS Unit_ID, e.f_unit AS Exchange_Unit_ID, u.name AS Unit, e.F_OWNER AS Exchange_Process, e.IS_INPUT AS Input_To, e.id AS Exchange_ID, e.F_DEFAULT_PROVIDER AS Default_Provider_ID, e.AVOIDED_PRODUCT AS Avoided_Product FROM tbl_exchanges AS e LEFT JOIN tbl_processes AS p ON e.f_owner = p.id INNER JOIN tbl_flows AS f ON f.id = e.f_flow INNER JOIN tbl_units AS u ON e.f_unit = u.id WHERE e.f_default_provider > 0 AND f.flow_type = 'ELEMENTARY_FLOW';