Skip to content

Commit

Permalink
Merge branch 'main' into oddpubmetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
quang-ng committed Dec 10, 2024
2 parents 2081ae2 + 08af374 commit da63428
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions dsst_etl/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
String,
Text,
)
from sqlalchemy.orm import declarative_base, relationship
from sqlalchemy.orm import declarative_base
from sqlalchemy.sql import func

naming_convention = {
Expand All @@ -34,8 +34,6 @@ class Works(Base):
primary_document_id = Column(Integer, ForeignKey("documents.id"), nullable=True)
provenance_id = Column(Integer, ForeignKey("provenance.id"))

oddpub_metrics = relationship("OddpubMetrics", back_populates="work")


class Documents(Base):
__tablename__ = "documents"
Expand All @@ -46,8 +44,6 @@ class Documents(Base):
s3uri = Column(Text, nullable=False)
provenance_id = Column(Integer, ForeignKey("provenance.id"))

oddpub_metrics = relationship("OddpubMetrics", back_populates="document")


class Provenance(Base):
__tablename__ = "provenance"
Expand All @@ -59,8 +55,6 @@ class Provenance(Base):
personnel = Column(Text)
comment = Column(Text)

oddpub_metrics = relationship("OddpubMetrics", back_populates="provenance")


class RTransparentPublication(Base):
__tablename__ = "rtransparent_publication"
Expand Down Expand Up @@ -273,16 +267,3 @@ class OddpubMetrics(Base):
open_data_statements = Column(String)
cas = Column(String)
open_code_statements = Column(String)

# Foreign key relationships
work_id = Column(Integer, ForeignKey("works.id"), nullable=False)
document_id = Column(Integer, ForeignKey("documents.id"), nullable=False)
provenance_id = Column(Integer, ForeignKey("provenance.id"), nullable=False)

# Relationships
work = relationship("Works", back_populates="oddpub_metrics")
document = relationship("Documents", back_populates="oddpub_metrics")
provenance = relationship("Provenance", back_populates="oddpub_metrics")

def __repr__(self):
return f"<OddpubMetrics(article='{self.article}', work_id={self.work_id})>"

0 comments on commit da63428

Please sign in to comment.