Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data History: Data table (no ODP) comparison (Last approved) #4310

Closed
minotogna opened this issue Jan 31, 2025 · 0 comments · Fixed by #4341
Closed

Data History: Data table (no ODP) comparison (Last approved) #4310

minotogna opened this issue Jan 31, 2025 · 0 comments · Fixed by #4341
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@minotogna
Copy link
Member

minotogna commented Jan 31, 2025

this is the query for getting node update activities up to the last approved date for a specific table. ~350ms
Those results, merged with prev cycle data -> will produce the last approved dataset to compare with

with activities as
         (select al.country_iso                                                                  as country_iso
               , t.props ->> 'name'                                                              as table_name
               , r.props ->> 'variableName'                                                      as variable_name
               , c.props ->> 'colName'                                                           as col_name
               , al.target -> 'value'                                                            as value
               , row_number() over (partition by al.target ->> 'colUuid' order by al.time desc ) as row_number
          from public.activity_log al
                   left join assessment_fra_2025.country_summary cs on al.country_iso = cs.country_iso
                   left join public.assessment a on al.assessment_uuid = a.uuid
                   left join public.assessment_cycle ac on a.id = ac.assessment_id and al.cycle_uuid = ac.uuid
                   left join assessment_fra.col c on (al.target ->> 'colUuid')::uuid = c.uuid
                   left join assessment_fra.row r on c.row_id = r.id
                   left join assessment_fra."table" t on r.table_id = t.id
          where al.message in ('nodeValueCalculatedUpdate', 'nodeValueEstimate', 'nodeValueUpdate')
            and al.country_iso = 'FIN'
            and a.props ->> 'name' = 'fra'
            and ac.name = '2025'
            and al.time < cs.last_accepted
            and t.props ->> 'name' = 'extentOfForest')
select *
from activities a;
@minotogna minotogna added the enhancement New feature or request label Jan 31, 2025
@minotogna minotogna modified the milestones: DataHistory.4, DataHistory.3, DataHistory.2 Jan 31, 2025
@sorja sorja closed this as completed Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants