# Patient The Patient project provides Web APIs specific to the patient. Currently only HDID to PHN translation has been written and is documented via OpenAPI. ## Patient Service Configuration ### Secrets Configuration You will need to obtain a current secrets file from a team member. On MacOs/Linux perform the following ```bash mkdir -p ~/.microsoft/usersecrets/84e2fe9a-a1f5-4de7-bef6-4518a33fa8b9 cp [PATH TO SECRETS]/secrets.json ~/.microsoft/usersecrets/84e2fe9a-a1f5-4de7-bef6-4518a33fa8b9 ``` On Windows, create the following folder path ```console %APPDATA%\Microsoft\UserSecrets\84e2fe9a-a1f5-4de7-bef6-4518a33fa8b9\secrets.json ``` and then copy the secrets file into that folder. To verify the secrets file has been created properly ```console cd $GATEWAYHOME/Apps/Patient/src/ dotnet user-secrets list ``` Which should display a flattened list of secrets. ### Certificate installation You will need your IDIR to download the Client Registries Auth [zip package](https://hlth.sp.gov.bc.ca/sites/EHLTH/ihit/HSIMIT/Gateway%20Shared%20Folder/00.%20Health%20Gateway%20Agile/zz.%20Protected/HGWAY_HI1.zip). Unzip to a secure location on your local machine. Edit the project secrets file and update the ClientCertificate path to the appropriate location ```console { "PatientService": { "ClientRegistry":{ "ClientCertificate": { "Path": "[YOUR PATH]/HGWAY_HI1.pfx", } } } } ``` ## Run Patient Service ### Command line ````bash cd $GATEWAYHOME/Apps/Patient/src/ dotnet run ```` ### VS Code * Select the Patient project * Say Yes or Accept any popups regarding adding assets for debugging * Select the Patient Solution and click Enter which should create a .vscode/launch.json * Click F5 or Run/Start Debugging ### Visual Studio * Right Click on the solution and select Properties * Select Multiple startup projects * Set Patient action to **Start** * Click Ok * Click F5 or Debug/Start Debugging ### Visual Studio for Mac * Right Click on the solution and select set startup project * Ensure that the Patient solution item is checked * Click Ok * Select Run Menu then Start Debugging ## Patient Service Verification * Ensure WebClient is running * Open a Chrome session to [http://localhost:5000](http://localhost:5000) * Open Developer tools. * Logon to WebClient * In the console make note of the HDID or you can likely use: P6FFO433A5WPMVTGM7T4ZVWBKCSVNAYGTWTU3J2LWMGUMERKI72A * Go to the network tab and refresh the page. * You will want to look for a failed call to Medication or Immunization go to the Headers tab and copy the text after Authorization: Bearer You should be able to open a new Browser window and connect to [http://localhost:3002/swagger](http://localhost:3002/swagger) * Click on the Authorize button and paste in the bearer token, then click Authorize and Close. * Click on the Patient Get API to expand it. * Click on Try it out button. * Paste the HDID into the text input. * Click on Execute You should see a response of 200 and a body similar to: ````console { "hdid": "P6FFO433A5WPMVTGM7T4ZVWBKCSVNAYGTWTU3J2LWMGUMERKI72A", "personalhealthnumber": "9735353315", "firstname": "BONNET", "lastname": "PROTERVITY", "birthdate": "1967-06-02T00:00:00", "email": "" } ```` If you encounter an error similar to socket reset, then you need to contact the PO to have CGI add your IP to the authorized whitelist.