Skip to main content

DTO pakages for hj3415

Project description

Contracts-hj3415

1) 3가지 Envelope DTO (정확한 타입명 / 파일 경로)

A. NfsEnvelopeDTO

  • 파일: contracts_hj3415/common/envelope.py

  • 타입명: class NfsEnvelopeDTO(TypedDict)

필드

  • topic: Literal["nfs"]

  • key: CodeKey  (contracts_hj3415/common/types.py에서 CodeKey = str)

  • asof: datetime

  • payload: NfsPayloadDTO  (contracts_hj3415/nfs/payloads.py)

  • meta: EnvelopeMeta  (contracts_hj3415/common/types.py)

팩토리

  • make_nfs_envelope(...) -> NfsEnvelopeDTO (contracts_hj3415/common/envelope.py)

B. UniverseEnvelopeDTO

  • 파일: contracts_hj3415/common/envelope.py

  • 타입명: class UniverseEnvelopeDTO(TypedDict)

필드

  • topic: Literal["universe"]

  • key: Universe (contracts_hj3415/universe/types.py의 Universe = Literal["KRX300"])

  • asof: datetime

  • payload: UniversePayloadDTO (contracts_hj3415/universe/payloads.py)

  • meta: EnvelopeMeta

팩토리

  • make_universe_envelope(...) -> UniverseEnvelopeDTO (contracts_hj3415/common/envelope.py)

C. AnalysisEnvelopeDTO

  • 파일: contracts_hj3415/common/envelope.py

  • 타입명: class AnalysisEnvelopeDTO(TypedDict)

필드

  • topic: Literal["analysis"]

  • key: CodeKey (str)

  • asof: datetime

  • payload: AnalysisPayloadDTO (contracts_hj3415/analysis/payloads.py)

  • meta: EnvelopeMeta

팩토리

  • make_analysis_envelope(...) -> AnalysisEnvelopeDTO (contracts_hj3415/common/envelope.py)

2) 공통 타입(정확한 타입명 / 파일 경로)

common/types.py

  • 파일: contracts_hj3415/common/types.py

타입들

  • Topic = Literal["nfs", "universe", "analysis"]

  • CodeKey = str

  • Num = float | int | None

  • Source = Literal["", "scraper2", "krx", "analyser2"]

  • class EnvelopeMeta(TypedDict, total=False):

    • source: Source

    • trace_id: str

    • note: str

    • tags: list[str]


3) payload 유니온(정확한 타입명 / 파일 경로)

A. NFS payload

  • 파일: contracts_hj3415/nfs/payloads.py

  • 타입명: NfsPayloadDTO

NfsPayloadDTO = C101Payload | C103Payload | C104Payload | C106Payload | C108Payload

각 payload 정의 파일:

  • contracts_hj3415/nfs/c101.py → C101Payload (필드: endpoint: Literal["c101"], blocks: C101Blocks)

  • contracts_hj3415/nfs/c103.py → C103Payload (필드: endpoint: Literal["c103"], blocks, labels)

  • contracts_hj3415/nfs/c104.py → C104Payload

  • contracts_hj3415/nfs/c106.py → C106Payload

  • contracts_hj3415/nfs/c108.py → C108Payload

공통 키/엔드포인트 타입:

  • 파일: contracts_hj3415/nfs/types.py

    • Endpoint = Literal["c101","c103","c104","c106","c108"]

    • MetricKey = str

    • PeriodKey = str

    • BlockKey = ... (각 C101~C108 블록 리터럴 유니온)


B. Universe payload

  • 파일: contracts_hj3415/universe/payloads.py

  • 타입명: UniversePayloadDTO = KRX300Payload

  • KRX300Payload 정의: contracts_hj3415/universe/krx300.py

    • class UniverseItem(TypedDict, total=False): code/name/market/meta

    • class KRX300Payload(TypedDict): source, universe, blocks: list[UniverseItem]

  • Universe 타입: contracts_hj3415/universe/types.py (Universe = Literal["KRX300"])


C. Analysis payload

  • 파일: contracts_hj3415/analysis/payloads.py

  • 타입명: AnalysisPayloadDTO = FeaturesPayload

  • FeaturesPayload 정의: contracts_hj3415/analysis/features.py

    • service: Literal["features"]

    • endpoint: Endpoint (nfs Endpoint 사용)

    • blocks: dict[MetricKey, LatestAndTtm]

  • AnalysisService 타입: contracts_hj3415/analysis/types.py

    • AnalysisService = Literal["features","red"] (현재 payload는 features만 연결돼 있음)

4) 앞으로 “모든 프로젝트 코딩 시” 적용 기준

너희 모노레포에서 “프로젝트 간 통신”은 앞으로 무조건 아래처럼만:

  • scraper2 → db2 : NfsEnvelopeDTO

  • krx → db2 : UniverseEnvelopeDTO

  • analyser2 → db2 : AnalysisEnvelopeDTO

  • 그 외 어떤 프로젝트 간 이동도 이 3종 envelope 중 하나로만 주고받기

그리고 생성은 원칙적으로:

  • contracts_hj3415/common/envelope.py의

    • make_nfs_envelope

    • make_universe_envelope

    • make_analysis_envelope

      를 사용

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contracts_hj3415-0.5.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contracts_hj3415-0.5.2-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file contracts_hj3415-0.5.2.tar.gz.

File metadata

  • Download URL: contracts_hj3415-0.5.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for contracts_hj3415-0.5.2.tar.gz
Algorithm Hash digest
SHA256 31f06877de29e953da3b91c534dfd699e8fe1cb8fa9ea158950b7a110fa828e3
MD5 e384b7abd578c4dcc90128ade7b7cc99
BLAKE2b-256 6e9ab074cbc715ad9a820406e3150788db5cce03dce536a0a067939c3de4a2ed

See more details on using hashes here.

File details

Details for the file contracts_hj3415-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for contracts_hj3415-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c142dde67fb1be2dfbd74d8fd971e6c2ede6d2d420cf82a67b7ab4222a0f2e5d
MD5 6f0d3677423a46cd8f2316bd1ef6f9c6
BLAKE2b-256 7bb534ca02615711df1c9d629ecd18813f8e19236960033fcdd987278cddef1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page