diff --git a/odm2api/ODM2/models.py b/odm2api/ODM2/models.py index 76a88c7..91f8fe8 100644 --- a/odm2api/ODM2/models.py +++ b/odm2api/ODM2/models.py @@ -248,18 +248,37 @@ class SamplingFeatures(Base): Where or on what an action was performed. """ SamplingFeatureID = Column('samplingfeatureid', Integer, primary_key=True, nullable=False) + """int: Primary key identifier.""" SamplingFeatureUUID = Column('samplingfeatureuuid', String(36), nullable=False) + """str: A universally unique identifier for the sampling feature.""" SamplingFeatureTypeCV = Column('samplingfeaturetypecv', ForeignKey(CVSamplingFeatureType.Name), nullable=False, index=True) + """str: CV term describing the type of sampling feature.""" SamplingFeatureCode = Column('samplingfeaturecode', String(50), nullable=False) + """str: A short but meaningful text identifier for the sampling feature.""" SamplingFeatureName = Column('samplingfeaturename', String(255)) + """str: Sampling Feature name (free text).""" SamplingFeatureDescription = Column('samplingfeaturedescription', String(500)) + """str: Text describing the sampling feature.""" SamplingFeatureGeotypeCV = Column('samplingfeaturegeotypecv', ForeignKey(CVSamplingFeatureGeoType.Name), index=True) + """str: Dimensionality of SamplingFeature; point2d, line2d, etc.""" Elevation_m = Column('elevation_m', Float(53)) + """float: The elevation of the sampling feature in meters, or in the case of Specimen, + the elevation from where the SamplingFeature.Specimen was collected""" ElevationDatumCV = Column('elevationdatumcv', ForeignKey(CVElevationDatum.Name), index=True) - #FeatureGeometry = Column('featuregeometry', String(50)) + """str: The code for the vertical geodetic datum that specifies the zero point for + the Sampling Feature Elevation""" + # FeatureGeometry = Column('featuregeometry', String(50)) + """object: The location geometry of the sampling feature on the Earth expressed using a + geometry data type. Can be a Point, Curve (profile, trajectory, etc), + Surface (flat polygons, etc) or Solid/Volume (although often limited to + 2D geometries). """ FeatureGeometryWKT = Column('featuregeometrywkt', String(50)) + """str: The location geometry of the sampling feature on the Earth expressed as + well known text (WKT). Can be a Point, Curve (profile, trajectory, etc.), + Surface (flat polygons, etc.), or Solid/Volume (although often limited to + 2D geometries).""" __mapper_args__ = { # 'polymorphic_on': SamplingFeatureTypeCV, "polymorphic_on": case([ diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index a3a4b0e..f9ac736 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -363,15 +363,35 @@ def getProcessingLevels(self, ids=None, codes=None): """ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=None, results=False): - """ - getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=None, results=False): - * Pass nothing - returns a list of all sampling feature objects with each object of type specific to that sampling feature - * Pass a list of SamplingFeatureID - returns a single sampling feature object for the given ids - * Pass a list of SamplingFeatureCode - returns a single sampling feature object for the given code - * Pass a list of SamplingFeatureUUID - returns a single sampling feature object for the given UUID's - * Pass a SamplingFeatureType - returns a list of sampling feature objects of the type passed in - * Pass a SamplingFeature Well Known Text - return a list of sampling feature objects - * Pass whether or not you want to return only the sampling features that have results associated with them + """Retrieve a list of Sampling Feature objects. + + If no arguments are passed to the function, or their values are None, + all Sampling Feature objects in the database will be returned. + + Args: + ids (list, optional): List of SamplingFeatureIDs. + codes (list, optional): List of SamplingFeature Codes. + uuids (list, optional): List of UUIDs string. + type (str, optional): Type of Sampling Feature from + `controlled vocabulary name `_. + wkt (str, optional): SamplingFeature Well Known Text. + results (bool, optional): Whether or not you want to return only the + sampling features that have results associated with them. + + Returns: + list: List of Sampling Feature objects + + Examples: + >>> READ = ReadODM2(SESSION_FACTORY) + >>> READ.getSamplingFeatures(ids=[39, 40]) + >>> READ.getSamplingFeatures(codes=['HOME', 'FIELD']) + >>> READ.getSamplingFeatures(uuids=['a6f114f1-5416-4606-ae10-23be32dbc202', + ... '5396fdf3-ceb3-46b6-aaf9-454a37278bb4']) + >>> READ.getSamplingFeatures(type='Site') + >>> READ.getSamplingFeatures(wkt='POINT (30 10)') + >>> READ.getSamplingFeatures(results=True) + >>> READ.getSamplingFeatures(type='Site', results=True) + """ if results: try: