https://github.com/acdh-oeaw/apimapper

https://github.com/acdh-oeaw/apimapper

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.2%) to scientific vocabulary

Keywords

api api-wrapper mapping response-parsing
Last synced: 6 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: acdh-oeaw
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 39.1 KB
Statistics
  • Stars: 1
  • Watchers: 4
  • Forks: 0
  • Open Issues: 2
  • Releases: 0
Topics
api api-wrapper mapping response-parsing
Created almost 7 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License

README.md

API Wrapper

Install package

  • from PyPi: pip install apimapper
  • from source: pip install -e .

Unit Testing

pytest

Usage

  • See https://github.com/acdh-oeaw/apimapper/blob/develop/demo/APIMapper%20Demo.ipynb
  • Multiple APIs (GND and VIAF) mapped to a common JSON schema

VIAF only returns VIAF ID - which is contructed into a url using a "rule" ``` from apimapper import APIMapper from apimapper import config

GNDPERSONMAP = {config.DIRECT: {'uri': 'id', 'label': 'label'}}

VIAFPERSONMAP = {config.RESULT: 'result', config.FILTER: {'nametype': 'personal'}, config.DIRECT: {'label': 'displayForm'}, config.RULES: {'uri': {config.RULE: '"http://www.viaf.org/viaf/{p1}"', config.FIELDS: {'p1': 'viafid'}}}}

GNDPERSONSOURCE = {config.URL: 'https://lobid.org/gnd/search', config.QUERY_FIELD: 'q', config.PAYLOAD: {'format':'json:suggest', 'filter': 'type:Person'}}

VIAFPERSONSOURCE = {config.URL: 'http://www.viaf.org/viaf/AutoSuggest', config.QUERY_FIELD: 'query'}

gnd = APIMapper(GNDPERSONSOURCE, GNDPERSONMAP) viaf = APIMapper(VIAFPERSONSOURCE, VIAFPERSONMAP) apis = [gnd, viaf] results = [] for api in apis: res = api.fetch_results('Pratchett') results.extend(res)

print(results) ```

  • Using mapping rules

Splitting the GND label field into meaningful subparts ``` from apimapper import APIMapper from apimapper import config

GNDPERSONSOURCE = {config.URL: 'https://lobid.org/gnd/search', config.QUERY_FIELD: 'q', config.PAYLOAD: {'format':'json:suggest', 'filter': 'type:Person'}}

GNDPERSONMAP = {config.DIRECT: {'label': 'label', 'uri': 'id'}, config.RULES: {'source': {config.RULE: '"GND"'}, 'labelname': {config.RULE: '"{p1}".split("|")[0].strip()', config.FIELDS: {'p1': 'label'}}, 'labelyear': {config.RULE: '"{p1}".split("|")[1].strip() if "{p1}".split("|")[1].strip()[0].isnumeric() else ""', config.FIELDS: {'p1': 'label'}}, 'label_profession': {config.RULE: '"{p1}".split("|")[2].strip() if "{p1}".split("|")[1].strip()[0].isnumeric() else "{p1}".split("|")[1].strip()', config.FIELDS: {'p1': 'label'}}}}

api = APIMapper(GNDPERSONSOURCE, GNDPERSONMAP) res = api.fetch_results('Rosalind Franklin') ```

  • More example usage in apimapper/demo

Owner

  • Name: Austrian Centre for Digital Humanities & Cultural Heritage
  • Login: acdh-oeaw
  • Kind: organization
  • Email: acdh@oeaw.ac.at
  • Location: Vienna, Austria

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 27
  • Total Committers: 3
  • Avg Commits per committer: 9.0
  • Development Distribution Score (DDS): 0.148
Top Committers
Name Email Commits
Saranya Balasubramanian S****n@o****t 23
Gytha Ogg g****g@u****m 2
gythaogg g****t@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (2)
Top Labels
Issue Labels
Pull Request Labels
dependencies (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 195 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 14
  • Total maintainers: 1
pypi.org: apimapper

API Mapper

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 195 Last month
Rankings
Dependent packages count: 10.1%
Downloads: 17.0%
Dependent repos count: 21.5%
Average: 22.1%
Forks count: 29.8%
Stargazers count: 31.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • Markdown ==3.0.1
  • atomicwrites ==1.2.1
  • attrs ==18.2.0
  • certifi ==2019.3.9
  • chardet ==3.0.4
  • idna ==2.8
  • more-itertools ==5.0.0
  • pluggy ==0.8.1
  • py ==1.7.0
  • pytest ==4.1.0
  • requests ==2.21.0
  • requests-futures ==0.9.9
  • six ==1.12.0
  • urllib3 >=1.24.2
setup.py pypi
  • markdown *
  • requests *