npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

observe-export

v1.0.0

Published

Export observations from Observe

Downloads

9

Readme

observe-export

TODO: Put badges here.

Export observations and new OSM nodes from an osm-p2p-db used by field-data-collector

Under development and API is likely to change

Table of Contents

Install

npm install observe-export

Usage

const osmdb = require('osm-p2p-mem')
const memdb = require('memdb')
const OBS = require('osm-p2p-observations')
const ObserveExport = require('../')

const osmOrgdb = osmdb()
const obsDb = osmdb()
const obsIndex = OBS({ db: memdb(), log: osm.log })

const observeExport = new ObserveExport(osmOrgDb, obsDb, obsIndex)

const ids = ['12345', '54321']

observeExport.osmJson(ids, function (err, data) {
  // data is array of OSM objects for observations with `ids`
})

observeExport.osmJson(ids, {linkedNodes: true}, function (err, data) {
  // data is array of OSM objects for observations with `ids`
  // as well as any linked nodes in the p2p db.
})

API

ObserveExport(osmOrgDb, obsDb, obsIndex)

Create an object for export of data from an Observe database

Kind: global function

| Param | Type | Description | | --- | --- | --- | | osmOrgDb | osm-p2p-db | An osm-p2p-db instance with existing nodes from osm.org | | obsDb | osm-p2p-db | An osm-p2p-db instance with observations and any newly created nodes | | obsIndex | osm-p2p-observations | An osm-p2p-observations instance with links between observations and nodes |

observeExport.osmObjects(observationOsmIds, opts, cb) ⇒ undefined

Given a list of OSM IDs of 'observation'-type documents, return a mapping of these IDs to the actual observation documents, with a 'links' property added to each document, that is a list of 'node' OSM IDs that the observation is linked to. If 'opts.linkedNodes' is truthy, the 'node' OSM documents that are linked to will also be included in the results. The linked nodes can either be existing osm.org nodes from the osmOrgDb, or newly created nodes from the obsDb

Kind: instance method of ObserveExport

| Param | Type | Description | | --- | --- | --- | | observationOsmIds | Array.<String> | Array of string ids of osm-p2p-observations | | opts | Object | | | opts.linkedNodes | Boolean | Include linked nodes in the export | | cb | function | Called with an array of OSM documents |

observeExport.osmChange(observationOsmIds, opts, cb) ⇒ undefined

Export a osmChange document as an array of OSM objects. Each object has the property action which is one of create|modify|delete. Created nodes are nodes from the observationDb with a negative (placeholder) id. Modified nodes are constructed from the original node in the osmOrgDb and then merging the tags from linked observations in chronological order. Created nodes also have their placeholder ids replaced with an decremental index from -1 - this is to avoid issues with importing the osmChange document into existing tools since osm-p2p ids can be > 64 bits. Finally version numbers are stripped from created nodes, since existing tools do not expect these.

Kind: instance method of ObserveExport

| Param | Type | Description | | --- | --- | --- | | observationOsmIds | Array.<String> | Array of string ids of osm-p2p-observations | | opts | Object | No options yet | | cb | function | Called with an array of OSM objects with an action property |

observeExport.osmChangeXml(observationOsmIds, opts, cb) ⇒ undefined

Export an OsmChange XML document for changes related to the observations with ids in the passed observationOsmIds array. See docs for osmChange for more details on the export process

Kind: instance method of ObserveExport

| Param | Type | Description | | --- | --- | --- | | observationOsmIds | Array.<String> | Array of string ids of osm-p2p-observations | | opts | Object | No options yet | | cb | function | Called with OsmChange XML document |

Contribute

PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Digital Democracy