dandi / dandi-schema

Schemata for DANDI archive project
Apache License 2.0
7 stars 10 forks source link

Harmonize (strip away Type) *Type models #15

Open yarikoptic opened 3 years ago

yarikoptic commented 3 years ago

ref: https://github.com/dandi/dandischema/pull/6/files#r639128369 saying

I am somewhat at loss of when Type suffix is used or not

Here are the ones without `Type` suffix ```shell $> git grep 'class .*(' dandischema/models.py | grep -v 'Type(' dandischema/models.py:class HandleKeyEnumEncoder(json.JSONEncoder): dandischema/models.py:class DandiBaseModelMeta(ModelMetaclass): dandischema/models.py:class DandiBaseModel(BaseModel, metaclass=DandiBaseModelMeta): dandischema/models.py:class PropertyValue(DandiBaseModel): dandischema/models.py:class Anatomy(BaseType): dandischema/models.py:class Disorder(BaseType): dandischema/models.py:class ContactPoint(DandiBaseModel): dandischema/models.py:class Contributor(DandiBaseModel): dandischema/models.py:class Organization(Contributor): dandischema/models.py:class Person(Contributor): dandischema/models.py:class Software(DandiBaseModel): dandischema/models.py:class Agent(DandiBaseModel): dandischema/models.py:class EthicsApproval(DandiBaseModel): dandischema/models.py:class Resource(DandiBaseModel): dandischema/models.py:class AccessRequirements(DandiBaseModel): dandischema/models.py:class AssetsSummary(DandiBaseModel): dandischema/models.py:class Equipment(DandiBaseModel): dandischema/models.py:class Activity(DandiBaseModel): dandischema/models.py:class Project(Activity): dandischema/models.py:class Session(Activity): dandischema/models.py:class PublishActivity(Activity): dandischema/models.py:class Locus(DandiBaseModel): dandischema/models.py:class Allele(DandiBaseModel): dandischema/models.py:class GenotypeInfo(DandiBaseModel): dandischema/models.py:class RelatedParticipant(DandiBaseModel): dandischema/models.py:class Participant(DandiBaseModel): dandischema/models.py:class BioSample(DandiBaseModel): dandischema/models.py:class CommonModel(DandiBaseModel): dandischema/models.py:class Dandiset(CommonModel): dandischema/models.py:class BareAsset(CommonModel): dandischema/models.py:class Asset(BareAsset): dandischema/models.py:class Publishable(DandiBaseModel): dandischema/models.py:class PublishedDandiset(Dandiset, Publishable): dandischema/models.py:class PublishedAsset(Asset, Publishable): ```

so from looks of it, if Type is desired for subclasses of BaseType then it is only

dandischema/models.py:class Anatomy(BaseType):
dandischema/models.py:class Disorder(BaseType):

which should be tuned up. But what is the rationale/benefit from keeping Type suffix altogether? It seems that BaseType is just an Enum-based DandiBaseModel. So they all could just be as happy without Type suffix and thus become consistent (I do not see a value from somehow annotating with Type that it is Enum based... what if some would be relaxed and no longer Enum based?)

satra commented 3 years ago

the difference between the Enum types and the BaseType is that BaseType allows users to fill in the identifier and name, while Enum types limit to specific predefined types. also the predefined types were short lists, the ones related to BaseType are not, except may be SexType, which indeed we could enumerate. all the non-enum types are also more biologically related, while the enumerated ones are more archive/data related.

i don't like this distinction but made life a little easier.