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

PDCT 395/only add counters #168

Merged
merged 10 commits into from
Oct 3, 2023
Merged

PDCT 395/only add counters #168

merged 10 commits into from
Oct 3, 2023

Conversation

diversemix
Copy link
Contributor

@diversemix diversemix commented Oct 2, 2023

Description

  • Adds a counter table
  • Ability to generate a unique import_id and increment atomically
  • Adds a migration to add counter for CCLW and UNFCCC
  • Adds tests

Type of change

Please select the option(s) below that are most relevant:

  • Bug fix
  • New feature
  • Breaking change

How Has This Been Tested?

Please describe the tests that you added to verify your changes.

Reviewer Checklist

  • The PR represents a single feature (small driveby fixes are also ok)
  • The PR includes tests that are sufficient for the level of risk
  • The code is sufficiently commented, particularly in hard-to-understand areas
  • Any required documentation updates have been made
  • Any TODOs added are captured in future tickets
  • No FIXMEs remain

@linear
Copy link

linear bot commented Oct 2, 2023

PDCT-395 Id generation for entities

We will need to construct "import" ids for newly created entities in the form:

<data_source>.<type>.<x>.<y> as we currently do - but the xy components of this id needs storing somewhere or calculating for when we need to generate a new one.

Option 1

Due to the fact that a "data source" is not represented in the database - instead we use organisation… We could change the format to be <organisation>.<type>.<x>.<y> . We would still need some sort of counter table in the backend but this would be linked (and think may be a soft link) to the organisation.

Option 2

We could go the whole-hog and introduce datasources now 🤔

@diversemix diversemix marked this pull request as ready for review October 2, 2023 13:37
@diversemix diversemix requested a review from joel-wright October 2, 2023 13:37
Copy link

@joel-wright joel-wright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see where these counters are being used or tested... what am I missing?

alembic/versions/0019_add_entity_counters.py Outdated Show resolved Hide resolved
app/db/models/law_policy/family.py Outdated Show resolved Hide resolved
app/db/models/app/counters.py Outdated Show resolved Hide resolved
Copy link

@joel-wright joel-wright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@diversemix diversemix merged commit ddebbd1 into main Oct 3, 2023
2 checks passed
@diversemix diversemix deleted the PDCT-395/only-add-counters branch October 3, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants