Omar ID EL MOUMEN
commited on
Commit
·
714cb03
1
Parent(s):
442a98d
Handling long-version for url display
Browse files
app.py
CHANGED
@@ -59,7 +59,6 @@ class BatchDocResponse(BaseModel):
|
|
59 |
class KeywordRequest(BaseModel):
|
60 |
keywords: str
|
61 |
release: Optional[str] = None
|
62 |
-
version: Optional[str] = None
|
63 |
wg: Optional[str] = None
|
64 |
spec_type: Optional[Literal["TS", "TR"]] = None
|
65 |
mode: Optional[Literal["and", "or"]] = "and"
|
@@ -253,14 +252,11 @@ def search_spec(request: KeywordRequest):
|
|
253 |
if not any(kw in spec["title"].lower() for kw in kws):
|
254 |
continue
|
255 |
release = request.release
|
256 |
-
version = request.version
|
257 |
working_group = request.wg
|
258 |
spec_type = request.spec_type
|
259 |
|
260 |
if spec.get('vers', None) is None or (release is not None and spec["vers"].split(".")[0] != str(release)):
|
261 |
continue
|
262 |
-
if spec.get('vers', None) is None or (version is not None and spec["vers"] != version):
|
263 |
-
continue
|
264 |
if spec.get('WG', None) is None or (working_group is not None and spec["WG"] != working_group):
|
265 |
continue
|
266 |
if spec_type is not None and spec["type"] != spec_type:
|
@@ -269,7 +265,18 @@ def search_spec(request: KeywordRequest):
|
|
269 |
doc_id = str(spec["spec_num"])
|
270 |
series = doc_id.split(".")[0]
|
271 |
a, b, c = str(spec["vers"]).split(".")
|
272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
results.append({
|
274 |
"id": str(spec["spec_num"]),
|
275 |
"title": spec["title"],
|
|
|
59 |
class KeywordRequest(BaseModel):
|
60 |
keywords: str
|
61 |
release: Optional[str] = None
|
|
|
62 |
wg: Optional[str] = None
|
63 |
spec_type: Optional[Literal["TS", "TR"]] = None
|
64 |
mode: Optional[Literal["and", "or"]] = "and"
|
|
|
252 |
if not any(kw in spec["title"].lower() for kw in kws):
|
253 |
continue
|
254 |
release = request.release
|
|
|
255 |
working_group = request.wg
|
256 |
spec_type = request.spec_type
|
257 |
|
258 |
if spec.get('vers', None) is None or (release is not None and spec["vers"].split(".")[0] != str(release)):
|
259 |
continue
|
|
|
|
|
260 |
if spec.get('WG', None) is None or (working_group is not None and spec["WG"] != working_group):
|
261 |
continue
|
262 |
if spec_type is not None and spec["type"] != spec_type:
|
|
|
265 |
doc_id = str(spec["spec_num"])
|
266 |
series = doc_id.split(".")[0]
|
267 |
a, b, c = str(spec["vers"]).split(".")
|
268 |
+
print(spec["vers"])
|
269 |
+
if not (int(a) > 35 or int(b) > 35 or int(c) > 35):
|
270 |
+
spec_url = f"https://www.3gpp.org/ftp/Specs/archive/{series}_series/{doc_id}/{doc_id.replace('.', '')}-{chars[int(a)]}{chars[int(b)]}{chars[int(c)]}.zip"
|
271 |
+
else:
|
272 |
+
x,y,z = str(a), str(b), str(c)
|
273 |
+
while len(x) < 2:
|
274 |
+
x = "0" + x
|
275 |
+
while len(y) < 2:
|
276 |
+
y = "0" + y
|
277 |
+
while len(z) < 2:
|
278 |
+
z = "0" + z
|
279 |
+
spec_url = f"https://www.3gpp.org/ftp/Specs/archive/{series}_series/{doc_id}/{doc_id.replace('.', '')}-{x}{y}{z}.zip"
|
280 |
results.append({
|
281 |
"id": str(spec["spec_num"]),
|
282 |
"title": spec["title"],
|