-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from gitnnolabs/tk199-refactory
WIP: Adiciona a preparação dos dado do sucupira e carga para os dados do sucupira.
- Loading branch information
Showing
7 changed files
with
243 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.1.6 on 2023-07-25 17:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("article", "0013_alter_article_sources_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="sourcearticle", | ||
name="doi", | ||
field=models.CharField(max_length=255, null=True, verbose_name="DOI"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
from django.utils.translation import gettext as _ | ||
|
||
from article.tasks import concat_article_sucupira_detail, concat_author_sucupira | ||
|
||
|
||
def run(production_file_csv, detail_file_csv, authors=None, sync=0, file_name="sucupira_article.csv"): | ||
""" | ||
Concate the a file with the article production in CAPES | ||
""" | ||
sync = bool(int(sync)) | ||
authors = authors.split(",") | ||
|
||
if production_file_csv and detail_file_csv: | ||
if os.path.isfile(production_file_csv) and os.path.isfile(detail_file_csv): | ||
if sync: | ||
df = concat_article_sucupira_detail(production_file_csv, detail_file_csv) | ||
|
||
if authors: | ||
ddfau = concat_author_sucupira(df, authors) | ||
ddfau.to_csv(file_name, index=False) | ||
else: | ||
concat_article_sucupira_detail.apply_async(args=(production_file_csv, detail_file_csv, True)) | ||
else: | ||
print(_("It looks like the given path is not a file!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
from django.utils.translation import gettext as _ | ||
|
||
from article.tasks import load_sucupira | ||
|
||
|
||
def run(production_file_csv, detail_file_csv, authors=None, sync=0): | ||
""" | ||
Load the sucupira data to article.models.SourceArticle | ||
""" | ||
sync = bool(int(sync)) | ||
authors = authors.split(",") | ||
|
||
if production_file_csv and detail_file_csv: | ||
if os.path.isfile(production_file_csv) and os.path.isfile(detail_file_csv): | ||
if sync: | ||
load_sucupira(production_file_csv, detail_file_csv, authors) | ||
else: | ||
load_sucupira.apply_async(args=(production_file_csv, detail_file_csv, authors)) | ||
else: | ||
print(_("It looks like the given path is not a file!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters