Skip to content

Conversation

@D-GopalKrishna
Copy link
Contributor

@D-GopalKrishna D-GopalKrishna commented Feb 5, 2025

Task description:

https://metacell.atlassian.net/browse/SCKAN-394
https://metacell.atlassian.net/browse/SCKAN-395
https://metacell.atlassian.net/browse/SCKAN-396 - (not the third part) - that is taken care in a separate PR.

More on the PR:

The Backend changes:

  • Add populationset - models, URLs, views, and serializers

  • add another field to KS - has_statement_been_exported

  • along with the migrations; a custom migration - migrate_has_statement_been_exported - to fill the field for everything that is exported currently

  • Two constraints:

    • Do not allow to go to EXPORTED if doesn't have populationset - by adding condition
conditions=[
            ConnectivityStatementStateService.is_valid,
            ConnectivityStatementStateService.has_populationset,
        ],

- Do not allow to change the populationset for a KS - if it had been ever in exported state
    def validate_population_change(self):
        if self.pk and self.has_statement_been_exported:
            original = ConnectivityStatement.objects.get(pk=self.pk)
            if original.population != self.population:
                raise ValidationError(
                    "Cannot change population set after the statement has been exported."
                )



The Composer UI changes:

  • update the genapi.sh
  • Add the copiedUISchema.population_id for - populationset
    • make it read only if isDisabled: statement.has_statement_been_exported is true
  • make a call to populations and set it using PopulationService - and call it onLogin.


The Admin UI changes:

  • Add PopulationSet to the admin UI.

<App />
</Provider>
);
populations.setPopulations().then(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Not related with this PR, but I don't love this nested callbacks. I think most of these fetches are independent, if that's the case we can use Promise.all instead to have them happening in parallel. It can be a tecnical debt card for later, cc @ddelpiano

Comment on lines 71 to 73
if target == CSState.EXPORTED and not instance.has_statement_been_exported:
instance.has_statement_been_exported = True
instance.save()
Copy link
Member

Choose a reason for hiding this comment

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

I think this overlaps with my comment here. My preference would be to use the transition side-effects instead of the signal.

@transition....
def exported(self, *args, **kwargs):
            self.has_statement_been_exported = True
            self.save()

def do_transition_to_exported_and_get_available_export_batch(
export_batch: ExportBatch, user: User
):
def filter_statements_with_exported_transition(qs: QuerySet, user: User) -> QuerySet:
Copy link
Member

Choose a reason for hiding this comment

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

This might be a good use case for .iterator

def do_transition_to_exported_and_get_available_export_batch(
export_batch: ExportBatch, user: User
):
def filter_statements_with_exported_transition(qs: QuerySet, user: User) -> QuerySet:
Copy link
Member

Choose a reason for hiding this comment

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

This might be a good use case for .iterator

D-GopalKrishna and others added 18 commits February 14, 2025 12:12
…ity to extract populationset from NeuronDM ID
Feature/sckan-394-ingestion - update ingestion and statement helper to add populationset on ingestion
…rom list view and remove deprecated btn from detailed view
…ted_from_this_populationset_incremental_index to PopulationSet
afonsobspinto
afonsobspinto previously approved these changes Feb 21, 2025
Copy link
Member

@afonsobspinto afonsobspinto left a comment

Choose a reason for hiding this comment

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

Changes requested in the PRs related with 394 were applied in branch https://github.com/MetaCell/sckan-composer/tree/feature/SCKAN-397

SCKAN-396 - Admin interface changes to support the population set - and deprecate state
@afonsobspinto afonsobspinto marked this pull request as draft February 21, 2025 23:39
Feature/sckan-398-export - Extend export to support population set
@afonsobspinto
Copy link
Member

Included in #423

@ddelpiano ddelpiano deleted the feature/SCKAN-394 branch July 22, 2025 14:38
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.

3 participants