def __init__(self, dt, name, language_cls, link=False, **kw): self._link = link self._col = getattr(language_cls, 'family') kw['choices'] = [ (f.id, f.name) for f in DBSession.query(Family).order_by(Family.name)] kw['choices'].insert(0, ('isolate', '--none--')) Col.__init__(self, dt, name, **kw)
def col_defs(self): res = [] if self.language: res.extend([ LinkCol(self, 'gloss_en', sTitle=self.req._('English'), model_col=common.Parameter.name, get_object=lambda v: v.valueset.parameter), ]) elif self.parameter: res.extend([ LinkCol(self, 'language', sTitle=self.req._('Language'), get_object=lambda v: v.valueset.language), Col( self, 'desc', sTitle=self.req._('Location'), get_object=lambda v: v.valueset.language, model_col=common.Language.description, ), ]) # FIXME: link to map! res.append(Col(self, 'name', sTitle=self.req._('Word'))) res.append(AudioCol(self, '#')) return res
def col_defs(self): return [ Col(self, 'Designer', model_col=Designer.contributor), Col(self, 'Domain of Design', model_col=Designer.domain), Col(self, 'Citation', model_col=Designer.citation), Col(self, 'More Information', model_col=Designer.pdflink), ]
def col_defs(self): res = [] if self.language: res.extend([ IntegerIdCol(self, 'id', model_col=Concept.id, get_object=lambda x: x.valueset.parameter), ConceptLinkCol(self, 'concept', model_col=Concept.name, get_object=lambda x: x.valueset.parameter) ]) elif self.parameter: res.extend([ DoculectLinkCol(self, 'language', model_col=Doculect.name, get_object=lambda x: x.valueset.language) ]) res.extend([ Col(self, 'form', model_col=Word.name, sTitle='Orthographic form'), Col(self, 'raw_ipa', model_col=Word.raw_ipa, sTitle='Automatically generated IPA'), # Col(self, 'norm_ipa', model_col=Word.norm_ipa, sTitle='Normalised IPA'), NextStepCol(self, 'next_step', model_col=Word.next_step) ]) return res
def __init__(self, model, taxon_col, *args, **kw): self.taxon_col = taxon_col kw['choices'] = [ (o.id, '%s %s' % (o.id, o.name)) for o in DBSession.query(model).filter(model.active == true()).order_by(model.id)] kw['model_col'] = getattr(Taxon, self.taxon_col) Col.__init__(self, *args, **kw)
def col_defs(self): res = [ Col(self, 'swadesh_id', sTitle='Swadesh ID', sDescription="Swadesh ID", model_col=Word.swadesh_id), Col(self, 'swadesh_word', sTitle='Swadesh Word', sDescription="Swadesh Word", model_col=Word.swadesh_word), Col(self, 'form', sTitle='Form', sDescription="Form", model_col=Word.form), Col(self, 'cognation_index', sTitle='Cognation Index', sDescription="Cognation Index", model_col=Word.cognation_index), Col(self, 'notes', sTitle='Notes', sDescription="Notes", model_col=Word.notes), ] return res
def col_defs(self): return [ LinkCol(self, 'name'), Col(self, 'experiments', model_col=models.Species.count_experiments, input_size='mini'), GBIFLinkCol(self, 'gbif', sTitle='GBIF', model_col=models.Species.gbif_name), Col(self, 'class', model_col=models.Species.klass, choices=get_distinct_values(models.Species.klass)), Col(self, 'order', model_col=models.Species.order, choices=get_distinct_values(models.Species.order)), Col(self, 'family', model_col=models.Species.family, choices=get_distinct_values(models.Species.family)), Col(self, 'genus', model_col=models.Species.genus, choices=get_distinct_values(models.Species.genus)), ]
def col_defs(self): return [ IntegerIdCol(self, 'number'), LinkCol(self, 'name'), Col( self, 'canton', sTitle='Canton', model_col=models.Variety.canton, choices=get_distinct_values(models.Variety.canton), ), Col( self, 'group', sTitle='Dialect group', model_col=models.Variety.group, choices=get_distinct_values(models.Variety.group), ), #Col(self, 'population', model_col=models.Variety.population), Col(self, 'recorded', model_col=models.Variety.recorded, sTitle='Date of recording'), Col(self, 'latitude', sDescription='<small>The geographic latitude</small>'), Col(self, 'longitude', sDescription='<small>The geographic longitude</small>'), LinkToMapCol(self, 'm'), ]
def col_defs(self): from clld.web.datatables.contribution import ContributorsCol, CitationCol return [ Col(self, 'number', sTitle='number', model_col=Dictionary.number, input_size='mini'), LinkCol( self, 'dictionary', sTitle='dictionary'), ContributorsCol( self, name='author', sTitle='author'), Col(self, 'entries', sTitle='entries', sClass='right', model_col=Dictionary.count_words), YearCol( self, 'year', bSearchable=False, sTitle='year', model_col=Dictionary.published), CitationCol(self, 'cite', sTitle='cite'), ]
def col_defs(self): res = [] if self.parameter: res = [ LinkCol(self, 'language', model_col=Language.name, get_object=lambda i: i.valueset.language), ] elif self.language: res = [ IntegerIdCol(self, 'id', input_size='mini', model_col=Parameter.id, get_object=lambda i: i.valueset.parameter), LinkCol(self, 'meaning', model_col=Parameter.name, get_object=lambda i: i.valueset.parameter), ] return res + [ Col(self, 'name', sTitle='Word', model_col=Value.name), Col(self, 'loan', model_col=Word.loan), ]
def col_defs(self): base = [ Col(self, 'id', bSortable=False, input_size='mini'), LinkCol(self, 'name', sTitle='Primary text', sClass="object-language"), TsvCol(self, 'analyzed', sTitle='Analyzed text'), TsvCol(self, 'gloss', sClass="gloss"), Col(self, 'description', sTitle=self.req.translate('Translation'), sClass="translation"), DetailsRowLinkCol(self, "d", sTitle="IGT"), ] if not self.language: base.append( LinkCol(self, 'language', model_col=Language.name, get_obj=lambda i: i.language, bSortable=not self.language, bSearchable=not self.language)) base.append(RefsCol(self, 'references')) return base
def col_defs(self): er_col = EcoregionCol(self, 'ecoregions') if 'er' in self.req.params: er_col.js_args['sFilter'] = self.req.params['er'] res = [ LinkCol(self, 'name', sTitle='Taxon'), Col(self, 'english_name', model_col=Taxon.english_name), ClassificationCol(self, 'order', sTitle='Biological classification'), ThumbnailCol(self, 'thumbnail'), # TODO: second thumbnail? ] if self.languages: for i, lang in enumerate(self.languages): res.append( CommonNameCol(self, 'cn%s' % i, lang, self._langs[i])) #res.append(_CategoryCol(self, 'categories', self.languages, bSortable=False)) else: res.append( Col(self, 'characteristics', model_col=Taxon.characteristics)) res.extend([er_col, CountriesCol(self, 'countries')]) # TODO: characteristics col? return res
def __init__(self, dt, name, **kw): kw['choices'] = [ r[0] for r in DBSession.query(ImageData.value).filter( ImageData.key == 'permission').order_by( ImageData.value).distinct() ] Col.__init__(self, dt, name, **kw)
def __init__(self, model, taxon_col, *args, **kw): self.taxon_col = taxon_col kw['choices'] = [(o.id, '%s %s' % (o.id, o.name)) for o in DBSession.query(model).filter( model.active == true()).order_by(model.id)] kw['model_col'] = getattr(Taxon, self.taxon_col) Col.__init__(self, *args, **kw)
def col_defs(self): if self.type == 'families': return [ NameCol(self, 'name'), #StatusCol(self), LevelCol(self), MacroareaCol(self, 'macro-area'), Col(self, 'child_family_count', model_col=Languoid.child_family_count, sTitle='Sub-families'), Col(self, 'child_language_count', model_col=Languoid.child_language_count, sTitle='Child languages'), #Col(self, 'child_dialect_count', sTitle='Child dialects'), FamilyCol(self, 'top-level family'), ] else: return [ Col(self, 'id', sTitle='Glottocode'), NameCol(self, 'name'), FamilyCol(self, 'top-level family'), IsoCol(self, 'iso', sTitle='ISO-639-3'), #StatusCol(self), MacroareaCol(self, 'macro-area'), Col(self, 'child_dialect_count', sTitle='Child dialects'), ]
def col_defs(self): return [ IntegerIdCol(self, 'id'), LinkCol(self, 'name', sTitle='Language structure dataset'), ContributorsCol(self, 'contributors', bSearchable=False, bSortable=False, sTitle='Authors of dataset'), Col(self, 'lexifier', choices=get_distinct_values(Lect.lexifier, key=lambda v: 'z' + v if v == 'Other' else v), get_obj=lambda item: item.language, model_col=Lect.lexifier), Col(self, 'region', choices=get_distinct_values(Lect.region), get_obj=lambda item: item.language, model_col=Lect.region), CitationCol(self, 'cite', bSearchable=False, bSortable=False), IntegerIdCol(self, 'survey', get_object=lambda c: c.language.survey, bSearchable=False, bSortable=False, sTitle='Survey'), ]
def col_defs(self): return [ LinkCol(self, 'contributor'), Col(self, 'description'), BaseRefsCol(self, 'sources'), Col(self, 'url', format=lambda i: maybe_external_link(i.url)), ]
def col_defs(self): return [ NumeralParameterCol( self, "numeral", model_col=Parameter.name, ), Col( self, "count_of_datapoints", sTitle='Number of data points', sTooltip='number of data points per numeral', model_col=NumberParameter.count_of_datapoints, ), Col( self, "count_of_varieties", sTitle='Number of distinct varieties', sTooltip= 'number of distinct varieties based on assigned Glottocodes', model_col=NumberParameter.count_of_varieties, ), NumberConcepticonCol( self, "concepticon_id", model_col=NumberParameter.concepticon_id, sTitle='', sWidth=40, ) ]
def col_defs(self): if self.parameter: return [ InventoryCol(self, 'inventory'), Col(self, 'marginal', model_col=Phoneme.marginal), Col(self, 'allophones', model_col=Phoneme.allophones), LinkCol(self, 'language', model_col=Language.name, get_object=lambda i: i.valueset.language), RefsCol(self, 'source'), LinkToMapCol(self, 'm', get_object=lambda i: i.valueset.language), ] res = super(Phonemes, self).col_defs()[1:] if self.contribution: param = lambda item: item.valueset.parameter return [ ClassCol(self, 'segment_class', Segment.segment_class, get_object=param), DatapointCol(self, 'valueset'), Col(self, 'marginal', model_col=Phoneme.marginal), Col(self, 'allophones', model_col=Phoneme.allophones), FrequencyCol(self, 'frequency', get_object=param), ] return res
def col_defs(self): return [ LinkCol(self, 'name'), LinkToMapCol(self, '#'), Col(self, 'region', model_col=Sample.region, choices=get_distinct_values(Sample.region)), Col(self, 'location', model_col=Sample.location), Col(self, 'latitude', input_size='mini', sDescription='<small>The geographic latitude</small>'), Col(self, 'longitude', input_size='mini', sDescription='<small>The geographic longitude</small>'), Col(self, 'samplesize', input_size='mini', model_col=Sample.samplesize), LangCol(self, 'languoid', get_object=lambda i: i.languoid, model_col=Languoid.name), FamilyCol(self, 'family', get_object=lambda i: i.languoid, model_col=Languoid.family_name, choices=get_distinct_values(Languoid.family_name)), ]
def __init__(self, dt, name, languages, **kw): assert languages self.lang_dict = {l.pk: l for l in languages} q = DBSession.query(Category.name).order_by(Category.name)\ .filter(Category.language_pk.in_(list(self.lang_dict.keys()))) kw['choices'] = [r[0] for r in q] Col.__init__(self, dt, name, **kw)
def col_defs(self): cols = [DetailsRowLinkCol(self, 'd', button_text='citation')] if self.provider: cols.append(BibkeyCol(self, 'key')) cols.extend([ LinkCol(self, 'name'), Col(self, 'description', sTitle='Title'), FtsCol(self, 'fts', model_col=Ref.fts), CaCol(self, 'ca_language'), ]) if not self.complexquery: cols.append(Col(self, 'year', model_col=Source.year_int)) cols.append(Col(self, 'pages', model_col=Source.pages_int)) cols.append(DoctypeCol(self, 'doctype')) cols.append(CaCol(self, 'ca_doctype')) if not self.provider: cols.append(ProviderCol(self, 'provider')) if self.language: cols.append(DirectAssignmentCol( self, 'd', sTitle='da', sDescription="Signals whether the reference is directly assigned to this languoid or inherited from daughter languoids.", bSortable=False, bSearchable=False)) return cols
def col_defs(self): if self.parameter: return [ LinkCol(self, 'sample', model_col=Sample.name, get_object=lambda i: i.valueset.language), Col(self, 'region', model_col=Sample.region, get_object=lambda i: i.valueset.language, format=lambda i: i.valueset.language.region), FamilyCol(self, 'family', get_object=lambda i: i.valueset.language.languoid, model_col=Languoid.family_name, choices=get_distinct_values(Languoid.family_name)), Col(self, 'value', model_col=Measurement.value), LinkToMapCol(self, '#', get_object=lambda i: i.valueset.language), ] if self.language: return [ LinkCol(self, 'measure', model_col=Parameter.name, get_object=lambda i: i.valueset.parameter), Col(self, 'description', get_object=lambda i: i.valueset.parameter, model_col=Parameter.description), Col(self, 'value', model_col=Measurement.value), ] return Values.col_defs(self)
def col_defs(self): return [ Col(self, 'id'), Col(self, 'name'), RefCountCol(self, 'refs', bSortable=False, bSearchable=False), Col(self, 'description'), ]
def col_defs(self): return [ IdCol(self, 'id'), Col(self, 'name', sTitle='Title'), Col(self, 'description', sTitle='Abstract'), SourcesCol(self, 'sources', bSearchable=False, bSortable=False) ]
def col_defs(self): res = [ SampleIdCol(self, 'sample', model_col=common.Value.id), Col(self, 'artefact', model_col=models.Sample.artefact_id), ] if not self.parameter: res.append( CategoryCol(self, 'type', choices=get_distinct_values( common.DomainElement.name), model_col=common.DomainElement.name)) if self.parameter: res.append( LinkCol(self, 'contribution', get_object=lambda v: v.valueset.contribution)) if self.contribution: pass if not self.language: res.extend([ RegionCol(self, 'region', choices=get_distinct_values(models.Location.region)), SubRegionCol(self, 'subregion'), Col(self, 'site', model_col=models.Sample.site_name, choices=get_distinct_values(models.Sample.site_name)), ]) return res
def col_defs(self): res = [ ConceptIdCol(self, 'id', sClass='left'), ] if self.parameter: res.extend([ Col(self, 'name', sTitle='Concept in source'), Col(self, 'description', sTitle='English gloss'), LinkCol(self, 'conceptlist', get_object=lambda v: v.valueset.contribution), ]) elif self.contribution: # # TODO: join Value_data for each source language! # for lang, alias in self._langs.items(): res.append(ConceptInSourceCol(self, lang, alias=alias)) res.append(Col(self, 'description', sTitle='English gloss')) res.append( LinkCol(self, 'concept_set', model_col=Parameter.name, get_object=lambda v: v.valueset.parameter)) else: res.extend([ Col(self, 'name', sTitle='Description in source'), Col(self, 'description', sTitle='English gloss'), LinkCol(self, 'concept_set', model_col=Parameter.name, get_object=lambda v: v.valueset.parameter), ]) return res
def col_defs(self): return [ ConstructionFeatureIdCol(self, 'Id', sClass='left', model_col=sailsUnitParameter.id), LinkCol(self, 'Feature', model_col=sailsUnitParameter.name), ConstructionFeatureDomainCol(self, 'Domain'), Col(self, '# Constructions', model_col=sailsUnitParameter.nconstructions), Col(self, '# Languages', model_col=sailsUnitParameter.nlanguages), ]
def __init__(self, dt, name, language_cls, link=False, **kw): self._link = link self._col = getattr(language_cls, 'family') kw['choices'] = [(f.id, f.name) for f in DBSession.query(Family).order_by(Family.name) ] kw['choices'].insert(0, ('isolate', '--none--')) Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = [ r[0][5:].capitalize() for r in DBSession.query(Value_data.key) .filter(Value_data.key.startswith('lang_')) .order_by(Value_data.key) .distinct()] kw['bSortable'] = False Col.__init__(self, dt, name, **kw)
def col_defs(self): return [ Col(self, 'grapheme', sTitle='Grapheme'), Col(self, 'unicode', sTitle="Unicode"), LinkCol(self, 'name'), Col(self, 'aliases', sTitle='Aliases'), Col(self, 'representation', sTitle='Representation') ]
def __init__(self, *args, **kw): choices = set() for row in DBSession.query(Species.order, Species.family, Species.genus): for name in row: if name: choices.add(name) kw['choices'] = sorted(choices) Col.__init__(self, *args, **kw)
def col_defs(self): return [ LinkCol(self, 'name'), Col(self, '# of feature lists', model_col=models.Metafeature.representation), Col(self, 'area'), ]
def __init__(self, dt, name, **kw): self.subtype = kw.pop('subtype', name) kw['sDescription'] = { 'mp4': external_link('https://en.wikipedia.org/wiki/MPEG-4'), 'quicktime': external_link('https://en.wikipedia.org/wiki/QuickTime'), 'x-msvideo': external_link('https://en.wikipedia.org/wiki/Audio_Video_Interleave'), }[self.subtype] kw['sTitle'] = name.upper() Col.__init__(self, dt, name, **kw)
def col_defs(self): return [ LinkCol(self, 'name'), Col(self, 'description', sTitle='definition'), Col(self, 'GOLD_counterpart'), Col(self, 'ISOCAT_counterpart'), Col(self, 'defined by', model_col=models.Concept.in_degree), Col(self, 'defining', model_col=models.Concept.out_degree), ]
def __init__(self, *args, **kw): choices = set() self.rank_cols = [Taxon.kingdom, Taxon.phylum, Taxon.class_, Taxon.family] for row in DBSession.query(*self.rank_cols): for name in row: if name: choices.add(name) kw['choices'] = sorted(choices) Col.__init__(self, *args, **kw)
def col_defs(self): return [ NameCol(self, 'name', model_col=Language.name, sTitle="Name"), IsoCol(self, 'iso', model_col=lotw_devLanguage.iso, sTitle='ISO-639-3'), FamilyCol(self, 'family', model_col=lotw_devLanguage.family, sTitle="Family"), BranchCol(self, 'branch', model_col=lotw_devLanguage.branch, sTitle="Branch"), Col(self, 'latitude'), Col(self, 'longitude'), ]
def __init__(self, dt, *args, **kw): kw['choices'] = [(c.pk, c.name) for c in self._choices(dt)] Col.__init__(self, dt, *args, **kw)
def __init__(self, dt, name, lang, alias, **kw): self.lang = lang self.alias = alias kw['sTitle'] = 'Colloquial names in %s' % lang.name Col.__init__(self, dt, name, **kw)
def __init__(self, *args, **kw): kw['choices'] = [ er.name for er in DBSession.query(Ecoregion).join(SpeciesEcoregion).order_by(Ecoregion.id)] kw['model_col'] = Species.ecoregions_str Col.__init__(self, *args, **kw)
def __init__(self, dt, name, **kw): kw['sDescription'] = 'If "yes" the word is a dialectal variant.' kw['sFilter'] = '2' kw['model_col'] = Entry.variant kw['choices'] = [('1', 'yes'), ('2', 'no')] Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = [ r[0] for r in DBSession.query(ImageData.value) .filter(ImageData.key == 'permission') .order_by(ImageData.value).distinct()] Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, language_cls, **kw): self._col = getattr(language_cls, 'macroarea') kw['choices'] = get_distinct_values(self._col) self.language_cls = language_cls Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['sTitle'] = 'Alternative reconstruction' if dt.language and dt.language.proto \ else 'Phonetic Siouan' Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = [(sd, sd.replace('_', ' ')) for sd in get_distinct_values(Entry.sd)] kw['model_col'] = Entry.sd Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, alias, **kw): self.alias = alias kw['sTitle'] = name.capitalize() Col.__init__(self, dt, name, **kw)
def format(self, item): return add_unit_links(self.dt.req, item.dictionary, Col.format(self, item))
def __init__(self, dt, name, sds, **kw): kw['choices'] = sds Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = get_distinct_values(Languoid.lineage) kw['model_col'] = Languoid.lineage Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = [ r[0] for r in DBSession.query(Lineage.name).order_by(Lineage.name)] kw['model_col'] = Lineage.name Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = DBSession.query(Biome.id, Biome.name)\ .order_by(as_int(Biome.id)) Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, maintype, **kw): self.maintype = maintype kw['bSearchable'] = False kw['bSortable'] = False Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, **kw): sq = DBSession.query(models.Village.languoid_pk).distinct().subquery() kw['choices'] = [ (l.id, l.name) for l in DBSession.query(common.Language).filter(common.Language.pk.in_(sq))] Col.__init__(self, dt, name, **kw)
def format(self, item): label = Col.format(self, item) href = item.href(self.link_type) if href: return external_link(href, label=label) return label
def __init__(self, *args, **kw): kw['choices'] = [ (f.pk, f.name) for f in DBSession.query(Family).order_by(Family.name)] kw['model_col'] = Family.name Col.__init__(self, *args, **kw)
def __init__(self, dt, name, **kw): kw['choices'] = ['yes'] kw['input-size'] = 'mini' kw['model_col'] = Sentence_files.id Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, roleid, **kw): kw['sTitle'] = ROLES[roleid] Col.__init__(self, dt, name, **kw) self.roleid = roleid
def __init__(self, dt, name, index, spec, **kw): kw['sTitle'] = spec[0] Col.__init__(self, dt, name, **kw) self.index = index self.choices = spec[1]
def __init__(self, dt, name, link_type, **kw): self.link_type = link_type Col.__init__(self, dt, name, **kw)
def __init__(self, dt, name, cls, attribute = 'combinatory_status', **kw): self._col = getattr(cls, attribute) self.attribute = attribute kw['choices'] = get_distinct_values(self._col) Col.__init__(self, dt, name, **kw)