Skip to content

Create app Organization#944

Merged
samuelveigarangel merged 19 commits into
scieloorg:mainfrom
samuelveigarangel:issue-926
Apr 14, 2025
Merged

Create app Organization#944
samuelveigarangel merged 19 commits into
scieloorg:mainfrom
samuelveigarangel:issue-926

Conversation

@samuelveigarangel
Copy link
Copy Markdown
Collaborator

@samuelveigarangel samuelveigarangel commented Mar 31, 2025

O que esse PR faz?

Cria toda a estrutura do aplicação Organization que irá armazenar os dados relacionado a publisher, owner, copyright, sponsor e affiliation.

Onde a revisão poderia começar?

pelos commits

Como este poderia ser testado manualmente?

N/A

Algum cenário de contexto que queira dar?

N/A

Screenshots

image

Quais são tickets relevantes?

#926

Referências

N/A

@samuelveigarangel samuelveigarangel changed the title [WIP] Create app Organization Create app Organization Apr 10, 2025
Comment thread organization/models.py
location = models.ForeignKey(
Location, on_delete=models.SET_NULL, null=True, blank=True
)
panels = [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel remover os excedentes de Base, e transferir para Organization

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel sobrou is_official

Comment thread organization/models.py
AutocompletePanel("institution_type_scielo"),
FieldPanel("is_official"),
]
autocomplete_search_field = "name"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel Não seria melhor usar o search

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Acho que por enquanto, podemos deixar assim.

Comment thread organization/models.py Outdated
autocomplete_search_field = "name"

def __str__(self):
return f"{self.name}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel adicionar location para ajudar na identificação. Sugiro colocar o país no início. Muitas instituições tem o mesmo nome, por exemplo: Hospital Geral....

Comment thread organization/models.py
return f"{self.name}"

def autocomplete_label(self):
return str(self)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel adiciona location

Comment thread organization/models.py Outdated
location,
):
params = {}
if name:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel acho que name e location devem ser obrigatórios

Comment thread organization/models.py Outdated
Comment on lines +93 to +98
url,
logo,
institution_type_mec,
institution_type_scielo,
location,
is_official,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel remover os excedentes de Base e mover para Organization

Comment thread organization/models.py Outdated
Comment on lines +125 to +130
location=None,
url=None,
logo=None,
institution_type_mec=None,
institution_type_scielo=None,
is_official=None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel mover os excedentes de Base para Organization

Comment thread organization/models.py


# Dynamic OrgLevel class creation
def create_org_level_class(org_class_name):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel não tenho opinião sobre isso

Comment thread organization/models.py
return type(f"OrgLevel{org_class_name}", (BaseOrgLevel,), attrs)


class BaseOrgLevel(CommonControlField):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel como é abstrat, eu acho que não herda de CommonControlField, porque isso estará na classe que é usada combinando com BaseOrgLevel, não acha?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Eu vou utilizar a função create_org_level_class para criar as relações com as classes History de forma dinamica. Então, ao chamar a funcao, ele vai criar todos os campos.

Comment thread organization/tasks.py Outdated


@celery_app.task()
def task_migrate_date_institution_to_organization_publisher(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel sugiro não fazer isso porque isso replicará o problema que já temos de dados incompletos e repetidos, variações do nome de mesma instituição, ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Mas então, em algum momento todos os dados vão ser migrados. ACho que faz sentido manter, adicionar apenas um paramentro para migrar apenas os official.

Comment thread organization/tasks.py Outdated
user_id, username, model, collection, journal
):
model = apps.get_model("institution", model)
objects = model.objects.all()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel no lugar de .all(), use .filter(is_official=True), ou outro filtro, que resulte em uma seleção de organizações com dado padronizado

Copy link
Copy Markdown
Member

@robertatakenaka robertatakenaka left a comment

Choose a reason for hiding this comment

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

@samuelveigarangel verficar comentários

Comment thread organization/models.py Outdated
acronym,
location,
):
if not name:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel exija o location também

Comment thread organization/models.py
)

panels = BaseOrganization.panels + [
FieldPanel("url"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@samuelveigarangel não estão faltando campos?

- improve Organization.get
@samuelveigarangel samuelveigarangel merged commit e80ff46 into scieloorg:main Apr 14, 2025
3 of 5 checks passed
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