{"id":19594579,"url":"https://github.com/toggle-corp/enketo-transformer","last_synced_at":"2025-08-18T01:36:55.491Z","repository":{"id":82218188,"uuid":"139801649","full_name":"toggle-corp/enketo-transformer","owner":"toggle-corp","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-05T06:04:05.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T14:22:33.351Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toggle-corp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-05T06:01:20.000Z","updated_at":"2018-07-05T06:04:16.000Z","dependencies_parsed_at":"2024-04-21T19:50:28.747Z","dependency_job_id":null,"html_url":"https://github.com/toggle-corp/enketo-transformer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/toggle-corp/enketo-transformer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toggle-corp%2Fenketo-transformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toggle-corp%2Fenketo-transformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toggle-corp%2Fenketo-transformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toggle-corp%2Fenketo-transformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toggle-corp","download_url":"https://codeload.github.com/toggle-corp/enketo-transformer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toggle-corp%2Fenketo-transformer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270932581,"owners_count":24670241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T08:44:02.530Z","updated_at":"2025-08-18T01:36:55.471Z","avatar_url":"https://github.com/toggle-corp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Enketo Transformer \n=================\n\n[![npm version](https://badge.fury.io/js/enketo-transformer.svg)](http://badge.fury.io/js/enketo-transformer) [![Build Status](https://travis-ci.org/enketo/enketo-transformer.svg?branch=master)](https://travis-ci.org/enketo/enketo-transformer) [![Dependency Status](https://david-dm.org/enketo/enketo-transformer.svg)](https://david-dm.org/enketo/enketo-transformer)\n\nNodeJS library that transforms OpenRosa/ODK XForms into a format the Enketo understands. It works both as a library module, as well as a standalone app.\n\n### Prerequisites\n\n1. nodeJS 6+ and npm (only tested on Ubuntu 14.04, on older distros the GCC compiler may not be recent enough)\n\n### Install as module\n\n```bash\nnpm install enketo-transformer --save\n```\n\n### Use as module\n\n```js\nconst transformer = require('enketo-transformer');\nconst xform = fs.readFileSync( 'path/to/xform.xml' );\n  \ntransformer.transform( {\n    // required string of XForm\n    xform: xform,\n    // optional string, to add theme if no theme is defined in the XForm\n    theme: 'sometheme', \n    // optional map, to replace jr://..../myfile.png URLs\n    media: {\n        'myfile.png' : '/path/to/somefile.png',\n        'myfile.mp3' : '/another/path/to/2.mp3'\n    },\n    // optional ability to disable markdown rendering (default is true)\n    markdown: false,\n    // optional preprocess function that transforms the XForm (as libXMLJs object) to \n    // e.g. correct incompatible XForm syntax before Enketo's transformation takes place \n    preprocess: doc =\u003e doc,\n} ).then(function( result ){\n    // do something with result\n});\n```\n\n### Install as app (web API)\n1. clone repo\n2. install dependencies with `npm install`\n\n### Use as app (web API)\n\n1. start with `npm start`\n2. limited use with `GET /transform` with xform parameter (required, **xform URL**), or\n3. full-featured use with: `POST /transform` with URL-encoded body including `xform` (required, **full XForm as a string**), `theme` (optional, string), and `media` (optional, map) parameters\n\nsample GET request:\n```\ncurl http://localhost:8085/transform?xform=https://example.com/forms/78372/form.xml\n```\n\nsample POST request: \n```bash\ncurl -d \"xform=\u003cxform\u003ex\u003c/xform\u003e\u0026theme=plain\u0026media[myfile.png]=/path/to/somefile.png\u0026media[this]=that\" http://localhost:8085/transform\n```\n\n### Response format\n\n```json\n{\n    \"form\" : \"\u003cform\u003e.....\u003c/form\u003e\",\n    \"model\": \"\u003cmodel\u003e...\u003c/model\u003e\",\n    \"transformerVersion\": \"1.13.0\",\n    \"languageMap\": { \"Français\": \"fr\", \"English\": \"en\" }\n}\n    \n```\n\n### Test\n\n* run tests with `npm test`\n\n### Develop\n \nThe script `npm run develop` runs the app on port 8085 and also serves test/forms on port 8081. You could test the transformation output by placing an XForm in test/forms and running\nhttp://localhost:8085/transform?xform=http://localhost:8081/autocomplete.xml\n\nA vagrant configuration file and provisioning script is also included. Use DEBUG environment variable to see debug terminal output, e.g.:\n\n```bash\nDEBUG=api,transformer,markdown,language node app.js\n```\n\n### License\n\nSee [license document](./LICENSE). Also note the additional 'powered by enketo' [footer requirement of enketo-xslt](https://github.com/enketo/enketo-xslt#license) which is used in this repository and therefore applicable.\n\n### Change Log\n\nSee [change log](./CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoggle-corp%2Fenketo-transformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoggle-corp%2Fenketo-transformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoggle-corp%2Fenketo-transformer/lists"}