Skip to content

Commit

Permalink
Merge pull request #93 from monarch-initiative/support_basemodel
Browse files Browse the repository at this point in the history
Add support for BaseModel entities
  • Loading branch information
kevinschaper authored Jul 16, 2022
2 parents 3eb5f9b + 0230a73 commit 79eabe3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion koza/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Koza, an ETL framework for LinkML data models"""
__version__ = '0.2.0'
__version__ = '0.2.1'
6 changes: 5 additions & 1 deletion koza/converter/kgx_converter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import asdict
from typing import Iterable, Tuple

from pydantic import BaseModel

class KGXConverter:
"""
Expand Down Expand Up @@ -40,7 +40,11 @@ def convert(self, entities: Iterable) -> Tuple[dict, dict]:
return nodes, edges

def convert_node(self, node) -> dict:
if isinstance(node, BaseModel):
return dict(node)
return asdict(node)

def convert_association(self, association) -> dict:
if isinstance(association, BaseModel):
return dict(association)
return asdict(association)

0 comments on commit 79eabe3

Please sign in to comment.