Skip to content

Commit 9430dc7

Browse files
authored
Merge branch 'main' into issue-06
2 parents 86cc68f + 4bb65a2 commit 9430dc7

10 files changed

Lines changed: 441 additions & 468 deletions

File tree

config/settings/base.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,5 +302,18 @@
302302
LLAMA_ENABLED = env.bool("LLAMA_ENABLED", default=True)
303303
MODEL_LLAMA = "llama-3.2-3b-instruct-q4_k_m.gguf"
304304

305+
# Core API
306+
CORE_API_DOMAIN = env("CORE_API_DOMAIN", default="https://core.scielo.org")
307+
CORE_COLLECTION_API_ENDPOINT = env(
308+
"CORE_COLLECTION_API_ENDPOINT",
309+
default="/api/v2/pid/collection/",
310+
)
311+
CORE_JOURNAL_API_ENDPOINT = env(
312+
"CORE_JOURNAL_API_ENDPOINT",
313+
default="/api/v2/pid/journal/",
314+
)
315+
CORE_COLLECTION_API_URL = f"{CORE_API_DOMAIN}{CORE_COLLECTION_API_ENDPOINT}"
316+
CORE_JOURNAL_API_URL = f"{CORE_API_DOMAIN}{CORE_JOURNAL_API_ENDPOINT}"
317+
305318
#Aumento en el límite de campos
306319
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000

markup_doc/choices.py

Lines changed: 65 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,75 @@
11
front_labels = [
2-
('<abstract>', '<abstract>'),
3-
('<abstract-title>', '<abstract-title>'),
4-
('<aff>', '<aff>'),
5-
('<article-id>', '<article-id>'),
6-
('<article-title>', '<article-title>'),
7-
('<author-notes>', '<author-notes>'),
8-
('<contrib>', '<contrib>'),
9-
('<date-accepted>', '<date-accepted>'),
10-
('<date-received>', '<date-received>'),
11-
('<fig>', '<fig>'),
12-
('<fig-attrib>', '<fig-attrib>'),
13-
('<history>', '<history>'),
14-
('<kwd-title>', '<kwd-title>'),
15-
('<kwd-group>', '<kwd-group>'),
16-
('<list>', '<list>'),
17-
('<p>', '<p>'),
18-
('<sec>', '<sec>'),
19-
('<sub-sec>', '<sub-sec>'),
20-
('<subject>', '<subject>'),
21-
('<table>', '<table>'),
22-
('<table-foot>', '<table-foot>'),
23-
('<title>', '<title>'),
24-
('<trans-abstract>', '<trans-abstract>'),
25-
('<trans-title>', '<trans-title>'),
26-
('<translate-front>', '<translate-front>'),
27-
('<translate-body>', '<translate-body>'),
28-
('<disp-formula>', '<disp-formula>'),
29-
('<inline-formula>', '<inline-formula>'),
30-
('<formula>', '<formula>'),
31-
2+
("<abstract>", "<abstract>"),
3+
("<abstract-title>", "<abstract-title>"),
4+
("<aff>", "<aff>"),
5+
("<article-id>", "<article-id>"),
6+
("<article-title>", "<article-title>"),
7+
("<author-notes>", "<author-notes>"),
8+
("<contrib>", "<contrib>"),
9+
("<date-accepted>", "<date-accepted>"),
10+
("<date-received>", "<date-received>"),
11+
("<fig>", "<fig>"),
12+
("<fig-attrib>", "<fig-attrib>"),
13+
("<history>", "<history>"),
14+
("<kwd-title>", "<kwd-title>"),
15+
("<kwd-group>", "<kwd-group>"),
16+
("<list>", "<list>"),
17+
("<p>", "<p>"),
18+
("<sec>", "<sec>"),
19+
("<sub-sec>", "<sub-sec>"),
20+
("<subject>", "<subject>"),
21+
("<table>", "<table>"),
22+
("<table-foot>", "<table-foot>"),
23+
("<title>", "<title>"),
24+
("<trans-abstract>", "<trans-abstract>"),
25+
("<trans-title>", "<trans-title>"),
26+
("<translate-front>", "<translate-front>"),
27+
("<translate-body>", "<translate-body>"),
28+
("<disp-formula>", "<disp-formula>"),
29+
("<inline-formula>", "<inline-formula>"),
30+
("<formula>", "<formula>"),
3231
]
3332

3433
order_labels = {
35-
'<article-id>':{
36-
'pos' : 1,
37-
'next' : '<subject>'
38-
},
39-
'<subject>':{
40-
'pos' : 2,
41-
'next' : '<article-title>'
42-
},
43-
'<article-title>':{
44-
'pos' : 3,
45-
'next' : '<trans-title>',
46-
'lan' : True
47-
},
48-
'<trans-title>':{
49-
'size' : 14,
50-
'bold' : True,
51-
'lan' : True,
52-
'next' : '<contrib>'
53-
},
54-
'<contrib>':{
55-
'reset' : True,
56-
'size' : 12,
57-
'next' : '<aff>'
58-
},
59-
'<aff>':{
60-
'reset' : True,
61-
'size' : 12,
62-
},
63-
'<abstract>':{
64-
'size' : 12,
65-
'bold' : True,
66-
'lan' : True,
67-
'next' : '<p>'
68-
},
69-
'<p>':{
70-
'size' : 12,
71-
'next' : '<p>',
72-
'repeat' : True
73-
},
74-
'<trans-abstract>':{
75-
'size' : 12,
76-
'bold' : True,
77-
'lan' : True,
78-
'next' : '<p>'
79-
},
80-
'<kwd-group>':{
81-
'size' : 12,
82-
'regex' : r'(?i)(palabra.*clave.*:|keyword.*:)',
83-
},
84-
'<history>':{
85-
'size' : 12,
86-
'regex' : r'\d{2}/\d{2}/\d{4}',
87-
},
88-
'<corresp>':{
89-
'size' : 12,
90-
'regex' : r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
91-
},
92-
'<sec>':{
93-
'size' : 16,
94-
'bold' : True,
95-
'next' : None
96-
},
97-
'<sub-sec>':{
98-
'size' : 12,
99-
'italic' : True,
100-
'next' : None
101-
},
102-
'<sub-sec-2>':{
103-
'size' : 14,
104-
'bold' : True,
105-
'next' : None
106-
},
34+
"<article-id>": {"pos": 1, "next": "<subject>"},
35+
"<subject>": {"pos": 2, "next": "<article-title>"},
36+
"<article-title>": {"pos": 3, "next": "<trans-title>", "lan": True},
37+
"<trans-title>": {"size": 14, "bold": True, "lan": True, "next": "<contrib>"},
38+
"<contrib>": {"reset": True, "size": 12, "next": "<aff>"},
39+
"<aff>": {
40+
"reset": True,
41+
"size": 12,
42+
},
43+
"<abstract>": {"size": 12, "bold": True, "lan": True, "next": "<p>"},
44+
"<p>": {"size": 12, "next": "<p>", "repeat": True},
45+
"<trans-abstract>": {"size": 12, "bold": True, "lan": True, "next": "<p>"},
46+
"<kwd-group>": {
47+
"size": 12,
48+
"regex": r"(?i)(palabra.*clave.*:|keyword.*:)",
49+
},
50+
"<history>": {
51+
"size": 12,
52+
"regex": r"\d{2}/\d{2}/\d{4}",
53+
},
54+
"<corresp>": {
55+
"size": 12,
56+
"regex": r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}",
57+
},
58+
"<sec>": {"size": 16, "bold": True, "next": None},
59+
"<sub-sec>": {"size": 12, "italic": True, "next": None},
60+
"<sub-sec-2>": {"size": 14, "bold": True, "next": None},
10761
}
10862

10963
order_labels_body = {
110-
'<sec>':{
111-
'size' : 16,
112-
'bold' : True,
64+
"<sec>": {
65+
"size": 16,
66+
"bold": True,
11367
},
114-
'<sub-sec>':{
115-
'size' : 12,
116-
'italic' : True,
68+
"<sub-sec>": {
69+
"size": 12,
70+
"italic": True,
11771
},
118-
'<p>':{
119-
'size' : 12,
72+
"<p>": {
73+
"size": 12,
12074
},
121-
}
75+
}

markup_doc/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from wagtail.admin.forms.models import WagtailAdminModelForm
1+

markup_doc/marker.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88
def mark_article(text, metadata):
99
if metadata == 'author':
1010
messages, response_format = LlamaInputSettings.get_author_config()
11-
if metadata == 'affiliation':
11+
elif metadata == 'affiliation':
1212
messages, response_format = LlamaInputSettings.get_affiliations()
13-
if metadata == 'doi':
13+
elif metadata == 'doi':
1414
messages, response_format = LlamaInputSettings.get_doi_and_section()
15-
if metadata == 'title':
15+
elif metadata == 'title':
1616
messages, response_format = LlamaInputSettings.get_titles()
17+
else:
18+
raise ValueError(
19+
f"Unsupported metadata value: {metadata!r}. "
20+
"Expected one of: 'author', 'affiliation', 'doi', 'title'."
21+
)
1722

1823
gll = LlamaService(messages, response_format)
1924
output = gll.run(text)

markup_doc/migrations/0002_alter_articledocx_estatus_and_more.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,28 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('markup_doc', '0001_initial'),
9+
("markup_doc", "0001_initial"),
1010
]
1111

1212
operations = [
1313
migrations.AlterField(
14-
model_name='articledocx',
15-
name='estatus',
16-
field=models.IntegerField(blank=True, choices=[(1, 'Processing'), (2, 'Processed')], default=1, verbose_name='Process estatus'),
14+
model_name="articledocx",
15+
name="estatus",
16+
field=models.IntegerField(
17+
blank=True,
18+
choices=[(1, "Processing"), (2, "Processed")],
19+
default=1,
20+
verbose_name="Process estatus",
21+
),
1722
),
1823
migrations.AlterField(
19-
model_name='articledocxmarkup',
20-
name='estatus',
21-
field=models.IntegerField(blank=True, choices=[(1, 'Processing'), (2, 'Processed')], default=1, verbose_name='Process estatus'),
24+
model_name="articledocxmarkup",
25+
name="estatus",
26+
field=models.IntegerField(
27+
blank=True,
28+
choices=[(1, "Processing"), (2, "Processed")],
29+
default=1,
30+
verbose_name="Process estatus",
31+
),
2232
),
2333
]

0 commit comments

Comments
 (0)