Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Gabriel Weisse
/
presupuestov1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
pr0nstar
2026-04-29 17:31:05 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
27a9950d0a9a9c414f8716108a2a506151795e3b
27a9950d
1 parent
d3b54dc1
ubigeo total
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
4 deletions
metrics.py
models/__init__.py
models/ubigeo.py
routers/entity.py
schemas/ubigeo.py
metrics.py
View file @
27a9950
...
...
@@ -385,14 +385,14 @@ def get_header_value(headers, key):
def
get_client_ip
(
headers
):
real_ip
=
get_header_value
(
headers
,
b
"x-real-ip"
)
if
real_ip
:
return
real_ip
.
strip
()
forwarded_for
=
get_header_value
(
headers
,
b
"x-forwarded-for"
)
if
forwarded_for
:
return
forwarded_for
.
split
(
","
,
1
)[
0
]
.
strip
()
real_ip
=
get_header_value
(
headers
,
b
"x-real-ip"
)
if
real_ip
:
return
real_ip
.
strip
()
return
None
...
...
models/__init__.py
View file @
27a9950
...
...
@@ -8,5 +8,6 @@ from . import (
entity
,
rubro
,
organismo
,
ubigeo
,
daily
,
)
...
...
models/ubigeo.py
0 → 100644
View file @
27a9950
from
sqlalchemy.orm
import
Mapped
,
mapped_column
from
presupuestov1.model
import
Base
from
sqlalchemy
import
(
Integer
,
String
,
Text
,
Numeric
,
Index
,
MetaData
,
)
class
ProyectoResumenes
(
Base
):
__tablename__
=
"ubigeo_resumenes"
__table_args__
=
(
Index
(
"idx_proyecto_resumenes_gestion"
,
"gestion"
),
{
"schema"
:
"web"
},
)
id
:
Mapped
[
int
]
=
mapped_column
(
Integer
,
primary_key
=
True
,
autoincrement
=
True
)
gestion
:
Mapped
[
int
]
=
mapped_column
(
Integer
)
ubigeo
:
Mapped
[
int
]
=
mapped_column
(
String
(
9
))
desc_ubigeo
:
Mapped
[
str
|
None
]
=
mapped_column
(
Text
)
desc_departamento
:
Mapped
[
str
|
None
]
=
mapped_column
(
Text
)
monto
:
Mapped
[
float
|
None
]
=
mapped_column
(
Numeric
(
30
,
15
))
per_capita
:
Mapped
[
float
|
None
]
=
mapped_column
(
Numeric
)
ranking
:
Mapped
[
int
|
None
]
=
mapped_column
(
Integer
)
routers/entity.py
View file @
27a9950
...
...
@@ -64,6 +64,24 @@ def fetch_entidad(
return
entidad
@router_ubigeo.get
(
'/todo'
,
response_model
=
List
[
schemas
.
ubigeo
.
UbigeoResumenes
])
@not_found
def
fetch_ubigeo_todo
(
db
:
Session
=
Depends
(
model
.
get_db
),
query
:
schema
.
QueryParams
=
Depends
(),
):
gestion
=
query
.
gestion
is
not
None
else
0
UbigeoResumenesSchema
=
schemas
.
ubigeo
.
UbigeoResumenes
UbigeoResumenes
=
model
.
ubigeo
.
UbigeoResumenes
schema_fields
=
UbigeoResumenesSchema
.
model_fields
.
keys
()
cols
=
[
getattr
(
UbigeoResumenes
,
name
)
for
name
in
schema_fields
]
return
db
.
execute
(
select
(
*
cols
)
.
where
(
UbigeoResumenes
.
gestion
==
gestion
)
)
.
mappings
()
.
all
()
@router_ubigeo.get
(
'/{ubigeo_id:str}'
,
response_model
=
schemas
.
entity
.
ClasGeograficoIngresosGastos
)
@not_found
...
...
schemas/ubigeo.py
0 → 100644
View file @
27a9950
from
typing
import
List
from
presupuestov1.schema
import
OrmBaseModel
from
presupuestov1
import
schemas
class
UbigeoResumenes
(
OrmBaseModel
):
gestion
:
int
ubigeo
:
str
desc_ubigeo
:
str
desc_departamento
:
str
mont
:
float
per_capita
:
str
ranking
:
int
n_entidades
:
int
Please
register
or
login
to post a comment