{"id":20726977,"url":"https://github.com/hmcts/ccd-definition-processor","last_synced_at":"2025-04-23T18:49:18.516Z","repository":{"id":35818293,"uuid":"153093403","full_name":"hmcts/ccd-definition-processor","owner":"hmcts","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-03T12:14:43.000Z","size":2789,"stargazers_count":1,"open_issues_count":12,"forks_count":9,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-03-30T02:33:19.959Z","etag":null,"topics":["ccd","xlsx"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hmcts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-10-15T10:17:52.000Z","updated_at":"2024-09-17T12:04:23.000Z","dependencies_parsed_at":"2024-09-19T05:32:28.366Z","dependency_job_id":null,"html_url":"https://github.com/hmcts/ccd-definition-processor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fccd-definition-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fccd-definition-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fccd-definition-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fccd-definition-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hmcts","download_url":"https://codeload.github.com/hmcts/ccd-definition-processor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250496123,"owners_count":21440225,"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","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":["ccd","xlsx"],"created_at":"2024-11-17T04:28:40.151Z","updated_at":"2025-04-23T18:49:18.497Z","avatar_url":"https://github.com/hmcts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ccd-definition-processor\n\n## Overview\n\nTooling to support collaborative development of CCD configuration thought the use of text based representation of CCD definitions, supporting textual comparison, change control and the treatment of configuration as source code during development.\n\n## Features\n\n### Variable substitution\n\nA `json2xlsx` processor is able to replace variable placeholders defined in JSON definition files with values read from environment variables as long as variable name starts with `CCD_DEF` prefix. \n \nFor example `CCD_DEF_BASE_URL=http://localhost` environment variable gets injected into fragment of following CCD definition:\n\n```json\n[\n  {\n    \"LiveFrom\": \"2017-01-01\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"ID\": \"initiateCase\",\n    \"CallBackURLSubmittedEvent\": \"${CCD_DEF_BASE_URL}/callback\"\n  }\n]\n```\n\nto become:\n\n```json\n[\n  {\n    \"LiveFrom\": \"2017-01-01\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"ID\": \"initiateCase\",\n    \"CallBackURLSubmittedEvent\": \"http://localhost/callback\"\n  }\n]\n```\n\n### JSON fragments\n\nA `json2xlsx` processor is able to read smaller JSON fragments with CCD definitions that helps splitting large definition files into smaller chunks.\nThese fragments can be read from any level of nested directory as long as the top level directory corresponds to a valid sheet name.\n\nFor example large `AuthorisationCaseField.json` file presented below: \n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker\",\n    \"CRUD\": \"CRU\"\n  },\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"solicitor\",\n    \"CRUD\": \"CRU\"\n  }\n]\n```\n\ncan be split into `caseworker.json` file presented below:\n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker\",\n    \"CRUD\": \"CRU\"\n  }\n]\n```\n\nand `solicitor.json` file presented below:\n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"solicitor\",\n    \"CRUD\": \"CRU\"\n  }\n]\n```\n\nlocated in `AuthorisationCaseField` directory that corresponds the XLS tab name.\n\n### Access control shortcuts\n\n**UserRoles** and **AccessControl** tags has special meanings which reduces verbosity of access control related definitions\n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRoles\": [\"caseworker1\",\"caseworker2\"],\n    \"CRUD\": \"CRU\"\n  }\n]\n```\n\nis transformed to\n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker1\",\n    \"CRUD\": \"CRU\"\n  },\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker2\",\n    \"CRUD\": \"CRU\"\n  }\n]\n```\n\nAnd \n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"AccessControl\": [\n      {\n        \"UserRoles\": [\"caseworker1\", \"caseworker2\"],\n        \"CRUD\": \"CR\"\n      },\n      {\n        \"UserRoles\": [\"caseworker3\"],\n        \"CRUD\": \"D\"\n      }\n    ]\n  }\n]\n```\n\nis transformed to\n\n```json\n[\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker1\",\n    \"CRUD\": \"CR\"\n  },\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker2\",\n    \"CRUD\": \"CR\"\n  },\n  {\n    \"LiveFrom\": \"01/01/2017\",\n    \"CaseTypeID\": \"DRAFT\",\n    \"CaseFieldID\": \"caseTitle\",\n    \"UserRole\": \"caseworker3\",\n    \"CRUD\": \"D\"\n  }\n]\n```\n\n## Dependencies\n\nDependencies have to be installed prior first use by running:\n\n```sh\n$ yarn install\n```\n\n## Usage\n\nThe following commands are available:\n\n```sh\n$ yarn json2xlsx options\n$ yarn xlsx2json options [\u003csheet name\u003e ...]\n```\n\nCommands take the following arguments:\n\n###  json2xlsx\n\n_options:_\n\n* -o    path to the output XLSX file\n* -D    path to the input folder with JSON files\n* -e    (optional) comma delimited list of wildcards patterns of the files which needs to be excluded from processing,\n        i.e. -e 'UserProfile.json, *-nonprod.json' will exclude UserProfile.json and all -nonprod.json files from processing \n\n#### Warning: \n\nThe previous support for includes parameters to select JSON files to process was removed (replaced with -e option).\n\n###  xlsx2json\n\n* -i    path to the input XLSX file\n* -D    path to the output folder for JSON files\n\n[\\\u003csheet name\\\u003e ...]: A list of sheet names in the XLSX for processing. Data will be imported to a file named \u003csheet name\u003e.json. If no \u003csheet name\u003e's are specified then all JSON files will be processed that are found in the sheet folder path.\n\n### Examples\n\nTo import all JSON files found in the ./sheets folder into a XLSX named CCD-Definition.xlsx which was created based on the embedded template CCD definition XLSX file, you would use:\n\n```sh\n$ yarn json2xlsx -D ./sheets -o CCD-Definition.xlsx\n```\n\nTo export all of the sheets in a CCD definition XLSX file you would use:\n\n```sh\n$ yarn xlsx2json -D ./sheets -i CCD-Definition.xlsx\n```\n\nTo export just CaseType and CaseEvent sheets from a CCD definition XLSX file you would use:\n\n```sh\n$ yarn xlsx2json -D ./sheets -i CCD-Definition.xlsx CaseType CaseEvent\n```\n\n## Docker image\n\nTo build Docker image please run:\n\n```bash\n$ docker build --tag hmctspublic.azurecr.io/ccd/definition-processor:latest .\n```\n\n## Building\n\nDockerhub (https://hub.docker.com/r/hmcts/ccd-definition-processor) is deprecated - please use ACR.\n\nAny commit or merge into master will automatically trigger an Azure ACR task. This task has been manually\ncreated using `./bin/deploy-acr-task.sh`. The task is defined in `acr-build-task.yaml`. \n\nNote: you will need a GitHub personal token defined in `GITHUB_TOKEN` environment variable to run deploy script (https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line). The token is for setting up a webhook so Azure will be notified when a merge or commit happens. Make sure you are a repo admin and select token scope of: `admin:repo_hook  Full control of repository hooks`\n\nMore info on ACR tasks can be read here: https://docs.microsoft.com/en-us/azure/container-registry/container-registry-tasks-overview\n\n## License \n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmcts%2Fccd-definition-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhmcts%2Fccd-definition-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmcts%2Fccd-definition-processor/lists"}