{"id":24552972,"url":"https://github.com/npdeehan/sorting-hat-dmn-example","last_synced_at":"2026-01-27T21:41:08.113Z","repository":{"id":90222915,"uuid":"387765306","full_name":"NPDeehan/Sorting-Hat-DMN-Example","owner":"NPDeehan","description":"This is an example of how DMN could have been used in the Harry Potter universe to replace the Sorting Hat","archived":false,"fork":false,"pushed_at":"2021-07-30T11:17:26.000Z","size":212,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T01:34:33.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/NPDeehan.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-07-20T11:11:22.000Z","updated_at":"2021-08-03T16:23:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"1604439e-46da-47c7-8107-88d137eca0ae","html_url":"https://github.com/NPDeehan/Sorting-Hat-DMN-Example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSorting-Hat-DMN-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSorting-Hat-DMN-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSorting-Hat-DMN-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSorting-Hat-DMN-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NPDeehan","download_url":"https://codeload.github.com/NPDeehan/Sorting-Hat-DMN-Example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878491,"owners_count":20362433,"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":[],"created_at":"2025-01-23T01:33:44.848Z","updated_at":"2026-01-27T21:41:08.085Z","avatar_url":"https://github.com/NPDeehan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# DMN Sorting Hat\nThis is an example of how DMN could have been used in the Harry Potter universe to replace the Sorting Hat\n\n## What You will Need\n* [Java JDK 11](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) so that you can run Camunda Platform Run\n* [Camunda Platform Run](https://camunda.com/download/) for running BPMN and DMN models\n* [Camunda Modeler](https://camunda.com/download/modeler/) for deploying the DMN and BPMN Models\n\n## Running the Project\n\nStartup the Camunda platform.\nOpen the files in the ``/DMN-BPMN-Models`` and ``/Forms`` folder in the Camunda modeler. From there you can also deploy them by clicking on the deploy button:\n\n![deployButton](./images/deployButton-1.png) \n\nthen adding all of the files to as part of the deployment.\n\n![deploymentScreen](./images/deploymentScreen.png)\n\nOnce the deployment is successful you can go to `` http://localhost:8080/camunda/app/tasklist/`` login with ``demo/demo`` and start the process!\n\n## The DRD\nThe highest level you can view the decision is by looking at the Decision requirements diagram.\n![SortingDRD](./images/SortingHatDRD.png)\n\n## The DMN Tables\nThere are 5 DMN tables in this project. Four of them relate to a House in Harry Potter and return a number. The number that each table returns refers to the affinity a user has with that house. The higher the number, the more affinity to a given house a user.\n\n![huffel](./images/huffelpuffDMN.png)\n\nThe hit policy of each table is set to `Collect (Sum)` meaning that multiple rules on this table can match a set of input values. A value called `Score` exists for each rule. All rules that match would have their `Score` added together to give you a single result. This result is the affinity you have for the given house\n\n\n## The BPMN Model\n\nThe BPMN model lets a user enter some data through a UI and then passes that data to the DMN model. It then can take the result and show it to the user in a new user task.\n\n![SortingProcess](./images/SortingProcess.png)\n\n\n\n## Evaluating the DMN tables with SwaggerUI\nYou can evaluate the DMN tables from the Camunda Platform's inbuilt SwaggerUI by going to `http://localhost:8080/swaggerui/#/`\nFinding `Decision Definition` in the list and clicking on the `POST /decision-definition/key/{key}/evaluate` call. \n\nEnter the key as `DecideOnHouse` and you can use the below example as the call body\n\n```Json\n{\n    \"variables\": {\n      \"friend\": {\n        \"value\": \"Jump in the Way\",\n        \"type\": \"String\"\n      },\n      \"houseChoice\": {\n        \"value\": \"Slytherin\",\n        \"type\": \"String\"\n      },\n      \"wand\": {\n        \"value\": \"phoenix feathers\",\n        \"type\": \"String\"\n      },\n      \"quidditch\": {\n        \"value\": true,\n        \"type\": \"Boolean\"\n      },\n      \"horkrux\": {\n        \"value\": 11,\n        \"type\": \"Long\"\n      },\n      \"potion\": {\n        \"value\": \"Beautification Potion\",\n        \"type\": \"String\"\n      },\n      \"rules\": {\n        \"value\": true,\n        \"type\": \"Boolean\"\n      },\n      \"robes\": {\n        \"value\": true,\n        \"type\": \"Boolean\"\n      },\n      \"prime\": {\n        \"value\": 280,\n        \"type\": \"Long\"\n      },\n      \"milk\": {\n        \"value\": 0.75,\n        \"type\": \"Double\"\n      }\n    }\n  \n  }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fsorting-hat-dmn-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpdeehan%2Fsorting-hat-dmn-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fsorting-hat-dmn-example/lists"}