Machine readable and standardized data sources for use in Elastic Map Service.
Create a new JSON or Hjson file in the appropriate folder in sources. The source file must match the schema in schema/source_schema.json.
To validate data sources against the schema run
yarn testSetting the environment variable EMS_STRICT_TEST will perform an additional check to ensure all field definitions are present in all features:
EMS_STRICT_TEST=ok yarn testTo build manifests and vector data files for all versions run
yarn build- New feature layers can be developed on the
feature-layersbranch (git checkout --track upstream/feature-layers). Buildkite will build and deploy all commits to this branch into a testing bucket on GCP. Test feature layers on this branch in Kibana by addingmap.manifestServiceUrl: http://storage.googleapis.com/elastic-bekitzur-emsfiles-catalogue-dev/v7.2/manifesttoconfig/kibana.yml. - Pull requests for new feature layers should be made from the
feature-layersagainst themasterbranch. Pull requests for any other changes should be made on a new branch in your fork, e.g.git checkout -b my-bugfix. - Once merged, Buildkite will run
.buildkite/deploy.shscript, which will place the contents of thedistdirectory into the staging bucket. - Deploying to production requires pushing a tag (
git push --tags) and accepting theDeploy to production?block step. This will execute thedeploy.shscript against the production GCP buckets, creating also an archive in a separate bucket for future reference.
- The file
scripts/constants.jscontains the versions for the manifests to be generated. It is OK to generate a few versions ahead of the Elastic Stack current status. - Aside of the Elastic Stack Semantic Versioning tailored for the cloud and self-managed environments, date-based version manifests are also generated, mapped to semver, at the
DATE_VERSIONSarray. Check PR #287 for details. - A final
/latest/manifestis generated from the last entry in theDATE_VERSIONSarray. - If the manifest contract needs to be changed, a new date version entry should be generated. Otherwise is OK to upgrade an entry in
DATE_VERSIONSin place, to upgrade to a newer semantic version of the Stack. For example PR #306 promotes the2023-10-31version from8.10to point to8.13given that only new data has been added to the repository.
Whenever possible new vector layers should be created using a SPARQL query in Sophox.
- Checkout the upstream
feature-layersbranch. - If necessary, create a new folder in the
sourcesdirectory with the corresponding two-digit country code (ex.rufor Russia). - Copy and paste the template source file (
templates/source_template.hjson) into the new directory you created in step 1. Give it a useful name (ex.states.hjson,provinces.hjson, etc). - Complete the
noteandnamefields in the new source file. - Copy and paste the
query.sparqlvalue into the query box on http://sophox.org. - Change the
Q33in theVALUES ?entity { wd:Q33 }to the corresponding Wikidata ID for the country for which you are adding subdivisions (ex.Q33is the Wikidata ID for Finland). - Run the SPARQL query and compare the
iso_3166_2results with the corresponding country's subdivision list on the ISO website looking for missingiso_3166_2codes. - The most common reason for missing
iso_3166_2codes in the query results is an incomplete "contains administrative territorial entity" property in the immediate parent region of the subdivision in Wikidata (usually, but not always, the country). You may need to add the subdivision Wikidata item to this property (ex. https://www.wikidata.org/wiki/Q33#P150). - Add
label_*fields for each official language of the country to the SPARQL query similar to thelabel_enfield. - Optionally, add unique subdivision code fields from other sources (ex.
logianmin Ireland) to the query. - Run the SPARQL query and check the map output.
- Optionally, click the "Simplify" link and drag the slider to reduce the number of vertices (smaller file size).
- Click the "Export" link on the top right of the map. Choose GeoJSON or TopoJSON as the File Format.
- Type
rfc7946ƒin the "command line options" to reduce the precision of the coordinates and click "Export" to download the vector file. - Rename the downloaded file with the first supported EMS version number (ex.
_v1,_v2,_v6.6) and the vector type (geofor GeoJSON,topofor TopoJSON) (ex.russia_states_v1.geo.json). Copy this file to thedatadirectory. - Complete the
emsFormatsproperties:typeis eithergeojsonortopojson,fileis the filename specified above,defaultistruewhen there is only one format. Subsequent formats can be added but only one item in the array can havedefault: true. The other items must bedefault: falseor omitdefaultentirely. - Copy and paste the SPARQL query from Sophox to the
query.sparqlfield in the source file. - Use the
scripts/wikidata-labels.jsscript to list thehumanReadableNamelanguages from Wikidata (e.g.node scripts/wikidata-labels.js Q33). You should spot check these translations as some languages might lack specificity (e.g.Provinsrather thanKinas provinser). - We should maintain the current precedent for title casing
legacyIdsand English labels of thehumanReadableName. This may need to be manually edited in the source (e.g. Paraguay Departments). - All fields used by sources that do not follow the
label_<language_code>schema must have translations in (schema/fields.hjson). If necessary, use thescripts/wikidata-labels.jsscript to list translations and copy them to (schema/fields.hjson) (e.g.node scripts/wikidata-labels P5097). - Use the following bash command to generate the timestamp for the
createdAtfield. Usegdateon Mac OSX.date -u +"%Y-%m-%dT%H:%M:%S.%6N" - Generate a 17 digit number for the
idfield. A timestamp using the following bash command is suitable. UsegdateOn Mac OSX.date +%s%6N - The
filenamefield in the source file should match the name of the file you added to thedatadirectory. - Run
yarn testto test for errors. - Invalid or non-simple geometry errors that occur during testing can usually be fixed by running the
clean-geom.jsscript against the GeoJSON file (e.g.node scripts/clean-geom.js data/usa_states_v1.geo.json). - Run
./build.shto build the manifest and blob files locally.