Package: mecoda-minka
Library to extract information collected in the Minka API. This library is part of MECODA (ModulE for Citizen Observatory Data Analysis), aimed to facilitate analysis and viewing of citizen science data.This repository is part of the work made by the EMBIMOS Reseach Group, atMarine Sciences Institute(CSIC) of Barcelona.Installationpipinstallmecoda-minkaUseGet observationsWithget_obsyou can extract data from the observations collected in the API. The function supports combinations of these arguments, which act as filters, getting the observations in descending order of id, with a maximum of 20,000 (API limitation):ArgumentDescritionExamplequeryWord or phrase found in the data of an observationquery="quercus quercus"project_nameName of a projectproject_name="urbamar"id_projectIdentification number of a projectid_project=806id_obsIdentification number of a specific observationid_obs=425userName of user who has uploaded the observationsuser="zolople"taxonOne of the main taxonomiestaxon="fungi"place_idIdentification number of a placeplace_id=1011place_nameName of a placeplace_name="Barcelona"yearYear of observationsyear=2019For thetaxonargument the possible values are:chromista,protozoa,animalia,mollusca,arachnida,insecta,aves,mammalia,amphibia,reptilia,actinopterygii,fungi,plantae,cnidaria,annelida,platyhelminthes,echinodermata,bryozoa,porifera,elasmobranchii,crustaceayctenophora.Example of use:frommecoda_minkaimportget_obsobservations=get_obs(year=2018,taxon='fungi')observationsis an object listObservation.Get projectsWithget_projectyou can get the information of the projects collected in the API. The function supports a single argument, which can be the project identification number or the name of the project. In case the name does not correspond exclusively to a project, it returns the information from the list of projects that include that word.Example of use:frommecoda_minkaimportget_projectprojects=get_project("urbamar")projectses siempre una lista de objetosProject.Get count of observations by taxonomic familyWithget_count_by_taxonwe can know the number of observations that correspond to each of the taxonomic families. The function does not take any argument.Example of use:frommecoda_minkaimportget_count_by_taxoncount=get_count_by_taxon()countis a dictionary with the structure {taxonomy:number of observations}ModelsThe models are defined using objects from [Pydantic] (https://pydantic-docs.helpmanual.io/). Type validation of all attributes is done and data can be extracted with thedictorjsonmethod.ObservationThe objectObservationcontains the information of each of the observations registered in [Minka] (https://minka-sdg.org/observations) and has the following attributes:AttributeTypeDescriptionDefault valueidintObservation numbercaptiveOptional[bool]State of captivityNonecreated_atOptional[datetime]Creation dateNoneupdated_atOptional[datetime]Update dateNoneobserved_onOptional[date]Observation dateNonedescriptionOptional[str]Observation descriptionNoneiconic_taxonOptional[IconicTaxon]Taxonomic familyNonetaxon_idOptional[int]Identification number of the specific taxonomyNonetaxon_nameOptional[str]Name of the species observedNonetaxon_ancestryOptional[str]String of the taxonomic sequence to which the observation corresponds, with identifiers separated by/NonelatitudeOptional[float]LatitudeNonelongitudeOptional[float]LongitudeNoneplace_nameOptional[str]Observation site nameNonequality_gradeOptional[QualityGrade]Quality grade:research,casualoneeds_idNoneuser_idOptional[int]User identification numberNoneuser_loginOptional[str]User registration nameNonephotosList[Photo]Object listsPhoto, that include information about each photograph of the observation[]num_identification_agreementsOptional[int]Number of votes in favor of identificationNonenum_identification_disagreementsOptional[int]Number of unfavorable votes to identificationNoneProjectTheProjectobject contains the information of each of the projects registered in [Minka] (https://minka-sdg.org/observations) and has the following attributes:AttributeTypeDescriptionDefault valueidintProject identification numbertitlestrTitle of the projectdescriptionOptional[str]Project descriptionNonecreated_atOptional[datetime]Project creation dateNoneupdated_atOptional[datetime]Project update dateNonelatitudeOptional[float]LatitudeNonelongitudeOptional[float]LongitudeNoneplace_idOptional[int]Place identification numberNoneparent_idOptional[int]Identification number of the project in which it is includedNonechildren_idList[int]Identification numbers of the projects it has inside[]user_idOptional[int]Identification number of the user who creates itNoneicon_urlOptional[str]Link to project iconNoneobserved_taxa_countOptional[int]Number of observations included in the projectNonePhotoThePhotoobject contains the information of each photography linked to an observation and has the following attributes.AttributeTypeDescriptionDefault valueidintPhoto identification numberlarge_urlstrLink to large format photomedium_urlstrLink to the photograph in medium formatsmall_urlstrLink to the photo in small formatContributionsTo contribute to this library, follow the steps below.You need to have Python 3.7 or higher, virtualenv and git installed.Create a github fork of this project.Clone your fork and enter the directorygitclonegit@github.com:<your_username>/mecoda_minka.gitcdmecoda_minkaConfigure your virtualenv to run the tests:virtualenv-p`whichpython3.7`envsourceenv/bin/activateInstallmecoda_minkaand its dependencies.pip3install-e.
pip3install-rrequirements-dev.txtCreate a new branch and make your changes:gitcheckout-bmi-nueva-ramaRun the tests with:python-mpytest--cov-reportterm-missing--covsrctestsIf you need to pass a specific test, you can usepytest -k <test-name>.Update the documentation.Make commit, push and create your pull request.Upload a new versionSwitch to master and update:gitcheckoutmaster
gitpullCreate a new branch:gitcheckout-b<branch-name>
gitpullMake changes to the codeRun the tests:python-mpytest--cov-reportterm-missing--covsrctestsEdit thesetup.pyfile to upload the version, which means changing theversionargument in thesetupfunction. The convention is 0.1.0 == major.minor.patch.majoris to introduce changes that break the existing code.minorrefers to changes that add functionality but do not break existing code.patchrefers to changes that fix bugs but do not add functionality.Make commit and push:gitadd.
gitcommit-m"<comment>"gitpush--set-upstreamorigin<branch-name>Follow the link to github returned by the push and merge.Update master:gitcheckoutmaster
gitpullCreate tag with the new version:gittag<new-version>
gitpush--tagsBuild the package:rmdist/build/-r
pythonsetup.py-qbdist_wheel
pythonsetup.py-qsdistUpload package to pypi:twineupload-rpypidist/*Thanks for contributing to this project!