Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In a file, "ODM2PythonAPI/ODM2/models.py" #1

Open
cdesyoun opened this issue May 20, 2015 · 5 comments
Open

In a file, "ODM2PythonAPI/ODM2/models.py" #1

cdesyoun opened this issue May 20, 2015 · 5 comments
Assignees

Comments

@cdesyoun
Copy link
Contributor

Would you please fix these problems below?
-- please fix the spelling error (ResultDateTimeUTCOfffset ==> ResultDateTimeUTCOffset)
-- please add the "cv_relationshiptype" class
class CVRelationshipType(Base):
tablename = 'cv_relationshiptype'
table_args = {u'schema': 'odm2'}

Term = Column('term', String(255), nullable=False)
Name = Column('name', String(255), primary_key=True)
Definition = Column('definition', String(1000))
Category = Column('category', String(255))
SourceVocabularyUri = Column('sourcevocabularyuri', String(255))
def __repr__(self):
    return "<CV('%s', '%s', '%s', '%s')>" %(self.Term, self.name, self.Definition, self.Category)

-- plead add the type, "Integer" in the class "SamplingFeatureExternalIdentifiers".
"BridgeID = Column('bridgeid', Integer, primary_key=True, nullable=False)"
-- please replace "BIT" type with "Boolean" type in the class "Specimens".
"IsFieldSpecimen = Column('isfieldspecimen', Boolean, nullable=False)"

sreeder pushed a commit that referenced this issue May 20, 2015
@cdesyoun
Copy link
Contributor Author

Great! Two problems below were found.
-- in the class "Results", add the column name, "resulttypecv".
-- in the class "RelatedActions", remove the column, "ActionTypeCV" which is not in the table.

@cdesyoun
Copy link
Contributor Author

another one was found.
-- in the class "RelatedFeatures", switch "SamplingFeatureObj" with "RelatedFeatureObj".

@cdesyoun cdesyoun reopened this Jun 17, 2015
@sreeder
Copy link
Contributor

sreeder commented Jul 29, 2015

@cdesyoun I've made all of these changes except changing the Boolean to a Bit. Could you explain why you would like this change. BIT is db specific, and we are trying to keep the api generic across the b types. are you having errors when running with Boolean?

@cdesyoun
Copy link
Contributor Author

@sreeder No, I meant changing the type in "Specimens" class below from "BIT" type to "Boolean" type in ODM2PythonAPI.

class Specimens(Base):
tablename = u'specimens'
table_args = {u'schema': u'odm2'}

SamplingFeatureID = Column('samplingfeatureid', ForeignKey('odm2.samplingfeatures.samplingfeatureid'), primary_key=True)
SpecimenTypeCV = Column('specimentypecv', ForeignKey('odm2.cv_specimentype.name'), nullable=False, index=True)
SpecimenMediumCV = Column('specimenmediumcv', ForeignKey('odm2.cv_specimenmedium.name'), nullable=False, index=True)
#IsFieldSpecimen = Column('isfieldspecimen', BIT, nullable=False)
IsFieldSpecimen = Column('isfieldspecimen', Boolean, nullable=False)
SamplingFeatureObj = relationship(SamplingFeatures)

@sreeder sreeder self-assigned this Aug 4, 2015
@cdesyoun
Copy link
Contributor Author

@sreeder, I imported this api into ODM2 Web service, and tested it.
In the class Results at the model.py,
ResultTypeCV = Column('resulttypecv', ForeignKey(CVResultType.Name), nullable=False, index=True)
Like the above, please add the column name.
-- in the class "RelatedFeatures", switch "SamplingFeatureObj" with "RelatedFeatureObj".

In addition,
in class "ReferenceMaterials", in this line, "ReferenceMaterialMediumCV = Column('referencematerialmediumcv', ForeignKey('cv_referencematerialmedium.name'), nullable=False, index=True)", there is no CV table for this.
Please add this class which I created.

class CVReferenceMaterialMedium(Base):
tablename = 'cv_referencematerialmedium'
table_args = {u'schema': 'odm2'} # table_args = {u'schema': Schema.getSchema()}

Term = Column('term', String(255), nullable=False)
Name = Column('name', String(255), primary_key=True)
Definition = Column('definition', String(1000))
Category = Column('category', String(255))
SourceVocabularyURI = Column('sourcevocabularyuri', String(255))

def __repr__(self):
    return "<CV('%s', '%s', '%s', '%s')>" % (self.Term, self.Name, self.Definition, self.Category)

After this, please correct it as follows:
ReferenceMaterialMediumCV = Column('referencematerialmediumcv', ForeignKey(CVReferenceMaterialMedium.Name), nullable=False, index=True)

I have made an change all of these things in my github below:
https://github.com/ODM2/ODM2RESTfulWebServices/tree/master/odm2proj/ODM2PythonAPI

If you are OK, you can replace it with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants