PViMS in Bangladesh

Please grant the user you are logged in as access to the analytical role in the administration portal. Then log out and back in again with that user and the analytical portal will appear.

Please can you indicate line number of code in workflow service with regards to the current user issue

@Jihan

Dear Shaun,
We are getting a cors error when downloading reports from when the yellow card was submitted successfully. I called the same API which is on
[HttpGet(“workflow/{workFlowGuid}/reportinstances/{id}”, Name = “DownloadPatientSummary”)]
Can you please help me out with this? I also try to disable [Authorize(Roles = “Analyst”)]

A CORS issue can be misleading. The ACCESS-CONTROL-ALLOW-ORIGIN header can be stripped if there is an error earlier in the pipeline. Is any error logged in the SystemLog table?

Dear Shaun,
There is no error in the system log table. When we click API from public form cors is coming.
U can check entry from URL and try to download 401 coming.
http://202.84.39.78:8088/

I do not believe this is a permissions issue, else you would be getting a 404 forbidden error.

try commenting out the middleware exception handler in the startup file:

app.UseMiddleware< ExceptionMiddleware >();

And then see if the app is erroring during the download.

Dear Shaun,
This is not working. I shared the link http://202.84.39.78:8088/
Can you please make an entry after the entry success page comes? Please click on download button check the console and network

There is not much I can do with a CORS issue client side. I saw the error on your screen shot shared.

As I have advised, I believe the error is server side, earlier in the pipeline.

Can you please share the API log.

Earlier you mentioned commenting out the [Authorize(Roles = “Analyst”)] decorator,

Could you also try comment out

[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + “,” + ApiKeyAuthenticationOptions.DefaultScheme)]

It is the main decorator for the controller.

Dear Shaun,

[15:41:37 INF] Request starting HTTP/2 GET https://localhost:44380/weatherforecast - -
[15:41:37 INF] Request finished HTTP/2 GET https://localhost:44380/weatherforecast - - - 404 - - 207.2847ms
[15:41:45 INF] Request starting HTTP/2 GET https://localhost:44380/api/workflow/4096D0A3-45F7-4702-BDA1-76AEDE41B986/reportinstances/46 - -
[15:41:45 INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
[15:41:45 INF] AuthenticationScheme: Bearer was challenged.
[15:41:45 INF] AuthenticationScheme: API Key was challenged.
[15:41:45 INF] Request finished HTTP/2 GET https://localhost:44380/api/workflow/4096D0A3-45F7-4702-BDA1-76AEDE41B986/reportinstances/46 - - - 401 - - 99.4715ms
[15:41:46 INF] Request starting HTTP/2 GET https://localhost:44380/api/w

Just in case you missed my previous comment, please try commenting out:

[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + “,” + ApiKeyAuthenticationOptions.DefaultScheme)]

It is the main authorise decorator for the controller.

Just following up on this… Has commenting out the main authorize decorator at controller level removed the 401 error?

It is strange that a 401 failure results in the CORS error, but as I mentioned, for some reason the 401 error results in the stripping of the cross domain CORS header resulting in the CORS error on the browser prefetch.

Commenting out the main controller authorize is not a long term fix, it is just to establish that the 401 is at the root of your problem.

We may have to extend the public controller to allow public access to the download function for a specific spontaneous dataset. But perhaps this can be done using a temporary short term key to access the report, rather than allow any public access to any report in the database.

Just some initial thoughts from me.

Dear Shaun,
I already develop a public api for downloading reports. Didn’t change anything in ReportInstance Controller. All other authentication remain unchanged. My issue is resolved when I develop a new API for downloading reports from yellow card.

Shaun needs another technical help from you.
For the Division District Thana Data element, I used the Field table for Data Set.
I already assign value for the division which is on FieldValue Table.
But District and Thana need a mapping table based on division id.
Should I create a new table for this? if I create it will be very helpful or you can suggest another one. Also, I have to expose two APIs for District and thana based on Division ID.

Thanks
Shafkat

Dear Shafkat,

With regards to your query on division, my suggestion is to use the OrgUnit table which is self referencing thereby allowing you to create a hierarchical breakdown of your division, district, facility etc. If you look at the facility table, it has a FK to OrgUnit so that you can indicate what district/division etc. the facility belongs to.

My suggestion was then to have a Facility look up field type which allows you to navigate through the Org Unit hierarchy and then select facility based on your navigation.

Would you like to have a discussion about this?
Kind regards
Shaun

Dear Shaun,
Thanks.
We need a technical discussion about this. I have some query and confusion.

Thanks
Shafkat

No problem, please let me know when would be good for you.

Hi Shafkat,

We are next meeting on Thursday, but if you would like to suggest a few times to meet before then, I am happy to meet to discuss on Tuesday or Wednesday.

Thanks
Shaun

Dear Shaun,
Thanks.
Can we sit down tomorrow(Wednesday) for a technical session?
I have some queries, I will not take too much time from you.
When you are free for discussion tomorrow please let me know.

Hi Shafkat,

I am not sure of the time difference but we can have the technical session on Wednesday 5th at:

  • 7:00 am SAST
  • 10:00 am SAST
  • 2:00 pm SAST
  • 3:00 pm SAST

Please let me know which time suits you.
Thanks
Shaun