Our goal is to provide a simple and consistent way of contributing to and collecting stakeholder comments from NICE consultations
Table of contents
This service provides a way for NICE stakeholders to comment directly on NICE consultations and documents to provide their viewpoint; and a way for NICE teams to request comments and process them for response which doesn’t require repetitive manual handling.
Consultation is a key part of developing NICE guidance, including NICE quality standards. The consultation processes enable external organisations and individuals to comment on guidance content at specific stages in the development process, and feed into the decision-making process.
What is our motivation for building this product or service?
- NICE efficiencies
- Increase stakeholder engagement
- Improve quality of responses given by NICE
- Internal teams at NICE who consult on the guidance they are producing by collecting comments from external stakeholders
- Our external stakeholders are the people who the guidance and standards that NICE produces affect and who want to provide their views on the development of these, so that their needs and priorities are reflected in the final guidance
What problem will it solve for people?
- Less manual handling when collating comments
- Less variation for stakeholders between different types of consultation - Secondary
- Able to comment against specific parts of a document or more generically
- Easier for NICE to tell which part of the document is being commented on
What problem will it solve for our organisation?
- Efficiency savings for NICE by reducing manual handling during collation
What do we need to measure against these outcomes?
- Time taken to collate results
- End to end time taken for consultation process
- Number of comments received
- Number of distinct organisations commenting
- Improved quality of responses / lower error rate
Consultations sits below Varnish so is under the main niceorg domain. It pulls data from InDev via an API and stores data in SQL Server.
+---------+ +---------- Varnish -------------+ | +----|----+ | | | | | | | +-------v------+ +----v----+ +-------v-------+ +---------------+ | Guidance Web | | Orchard | | Consultations -----> SQL Server DB | +--------------+ +---------+ +-------^-------+ +---------------+ | | | +---|---+ | InDev | +-------+
- Varnish for infrastructure-level routing
- .NET Core 2 on the server
- SQL Server as our database
- Entity Framework Core as an ORM
- EF Core In-Memory Database Provider for integration tests
- React for the UI library
- Create React App for configless React
- Jest for JavaScript tests
- ASP.NET Core JavaScript Services for rendering JavaScript server side in .NET
- ESLint for JavaScript linting
- SASS as a CSS pre-processor
- Modernizr for feature detection
- WebdriverIO for automated functional testing
- NICE Design System for NICE styling
- NICE Icons for icon webfont
- Install KDiff to be able see diffs from integration tests
- Install SQL Server and SQL Server Management Studio (SSMS)
- Restore Consultations database in SSMS and set account running visual studio as db_owner (Your domain username or SUDO account if running as administrator)
- Clone the project
git clone git@github.com:nice-digital/consultations.git
- Open Consultations.sln
- Paste database connection string into DefaultConnection in secrets.json file (see "Secrets" below for format)
- right click on project
- select 'manage user secrets'
- paste contents of secrets.json (from another dev) to replace the defualt text here.
- Press F5 to run the project in debug mode
- Dependencies will download (npm and NuGet) so be patient on first run
- The app will run in IIS Express on http://localhost:52679/
- cd into consultations\Comments\ClientApp
run 'npm install --only=dev'
run 'npm run build'
run
npm start
if Startup is usingUseProxyToSpaDevelopmentServer
. This runs a react dev server on http://localhost:3000/. - Run
npm test
in a separate window to run client side tests in watch mode - If the application has a URL like https://niceorg:44306/ You may need to add a line to your hosts file (C:\Windows\System32\drivers\etc\hosts) pointing "niceorg" at 127.0.0.1
- If you don't have it already, you will need to go into Identity Management for the environment you are working in e.g. https://test-identityadmin.nice.org.uk/ and give youself Administrator access to Consultations.
- Install Redis locally on your machine. Instructions below.
-There is another README file in consultations\Comments\ClientApp which goes into more detail if npm start
does not work immediately.
- First try to copy the secrets file from another developer who has had comment collection working before.
- If you cannot find another developer with a secrets file, you can copy the format below.
{
"ConnectionStrings": {
"DefaultConnection": "<connection string>"
},
"Logging": {
"RabbitMQHost": "<rabbit server URL>",
"RabbitMQPort": "<rabbit server port>",
"IncludeScopes": false,
"LogFilePath": "<log file path>",
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
},
"UseRabbit": false,
"UseFile": true
},
"AppSettings": {
"Environment": {
"Name": "local",
"SecureSite": "false"
}
},
"Feeds": {
"ApiKey": "<indev API key>",
"IndevBasePath": "<indev base path>",
"IndevPublishedChapterFeedPath": "<feed path>",
"IndevDraftPreviewChapterFeedPath": "<feed path>",
"IndevPublishedDetailFeedPath": "<feed path>",
"IndevDraftPreviewDetailFeedPath": "<feed path>",
"IndevPublishedPreviewDetailFeedPath": "<feed path>",
"IndevListFeedPath": "<feed path>",
"CacheDurationSeconds": 60,
"IndevIDAMConfig": {
"Domain": "<InDev IDAM Domain>",
"ClientId": "<Auth0 Client Id>",
"ClientSecret": "<Auth0 Client Secret>",
"APIIdentifier": "<Auth0 API Identifier>"
}
},
"WebAppConfiguration": {
"ApiIdentifier": "<Auth0 API Identifier for comment collection>",
"ClientId": "<Auth0 Client Id for comment collection>",
"ClientSecret": "<Auth0 Client secret for comment collection>",
"AuthorisationServiceUri": "<Auth0 Authorisation service URI for comment collection>",
"Domain": "<Auth0 Domain comment collection>",
"PostLogoutRedirectUri": "<Auth0 Post Logout Redirect Uri>",
"RedirectUri": "<Auth0 Redirect Uri>",
"CallBackPath": "<Auth0 callback path>",
"GoogleTrackingId": "<google tracking id>",
"RedisServiceConfiguration": {
"ConnectionString": "<redis server URL>",
"Enabled": true
}
},
"Encryption": {
"Key": "<Encryption key for encrypting comment text>",
"IV": "<Initialisation Vector for encrypting comment text>"
},
"PDF": {
"PDFDocGenServer": "<PDF DocGen Server>"
},
"ConsultationList": {
"DownloadRoles": {
"AdminRoles": [ "<List of Admin roles>", "<List of Admin roles>" ],
"TeamRoles": [ "<List of team roles>", "<List of team roles>", "<List of team roles>" ]
}
},
"AWS": {
"Profile": "<AWS Profile>",
"Region": "<AWS Region>"
}
}
This application uses a data store called Redis to capture and store Tokens from Auth0. You will need to run a local version of Redis using Chocolatey, A docker/podman container or via WSL at a command prompt. Go to https://redis.io/docs/getting-started/ to get started, the instructions are well written.
spa.UseReactDevelopmentServer
can be slow so try usingspa.UseProxyToSpaDevelopmentServer("http://localhost:3000");
instead within Startup.cs.- Need to ensure that nothing else is running on port 80, otherwise you will encounter a socket exception error when running in debug.
- Exception: OpenIdConnectAuthenticationHandler: message.State is null or empty. -- caused if login is attempted without redis, clear your cookies and login again.
- It might take a few F5's, visual studio restarts and cookie clears to get all the various services/applications to start co-operating
The project uses serveral layers of tests:
- C# low-level unit tests, run via xUnit, asserted with Shouldly. See Comments.Test/UnitTests.
- C# 'integration' tests (approval based of server rendered HTML), run via xUnit, asserted with Shouldly, diffed with Kdiff. See Comments.Test/IntegrationTests.
- JavaScript unit tests via jest. See Comments/ClientApp/src.
- Functional high-level tests, via webdriver.io.
We use Code first Entity Framework migrations to update the consultations database
To update the database
- add a new property to the relevent class in Consultations > Comments > Models > EF
- in visual studio go to Tools > NuGet Package Manager > Package Manager Console
- in the package manager console window run the command Add-Migration [give your migration a useful name] eg Add-Migration AddCommentCreationDate
This will create a new migrations script in Consultations > Comments > Migrations - when the comment collection is next hit the changes in the migration script will be applied to SQL.
A new column will be created in __EFMigrationHistory to flag that the migration has been run.
See the Consultations Sharepoint site
Environment | URL |
---|---|
local | https://local.nice.org.uk/consultations/ |
Alpha | https://alpha.nice.org.uk/consultations/ |
Live | https://www.nice.org.uk/consultations/ |
For further information about the recommended ReadMe structure plus a 'how to' for regenerating the table of contents, follow the instructions in DIT Engineering - ReadMes