Developing the "OCL for OpenMRS" Application

(Darius Jazayeri) #490

@abulojoshua1 for example you could manually create the mappings for “Bronchitis, Acute” based on how it looks on the production OCL: image

@akanter is this a good example to use?

(Darius Jazayeri) #491

We were planning to have a regular weekly call at 7am Seattle = 9am Chicago = 6pm Nairobi, that would be set up for either Wednesdays or Fridays.

Can we start this now that the new year has started, and people should be back from holidays?

(collins Ijeomah) #492

Thanks for the response, yes It is a blocker. Like you said there can be 60,000 concepts in a CIEL dictionary. If I am to get the first 10 (page by page), I need a count telling me that the total concept available is 60,000 so I can implement pagination. @raff @paynejd

(Jonathan Payne) #493

The count is available as a response header. If you look at the traditional OCL interface it shows both the current and total count using info received from the API. If you can provide specific API requests you are using it will be easier to diagnose. FYI You can also use the “limit” parameter to control how many results are returned and you can also use the “nextUrl” and “previousUrl” response attributes (I think those names are correct but verify in the API documentation) to link directly to the next and previous pages of.results.

(Darius Jazayeri) #494

@shine and just for completeness, I wanted to point out that you can implement pagination without knowing the total count. For example in my gmail when I search for “ocl openmrs” it shows me: image

(in some places this would be called indeterminate pagination).

(collins Ijeomah) #495

@paynejd I am facing an issue of not being able to get all response headers When I console.log my response I get

My research so far points me to set the Access-Control-Expose-Headers header on the server. I found some people with similar issue

(collins Ijeomah) #496

@darius can you give me a mockup of how you want the indeterminate pagination to be implemented on the table. Thanks

(John Joshua Abulo) #497

Hello @darius

Can I set up a calendar event so the OCL team can have sync with you and gauge whether or not they are on track with their different tasks? Kindly let me know if it will be possible this week.


(Jonathan Payne) #498

@collins can you share which API calls you are making?

(collins Ijeomah) #499


(Darius Jazayeri) #500

Sorry, don’t have time to do any mockups now but this really depends on the pagination widget you are using and what it supports.

(Darius Jazayeri) #501

I can do tomorrow or Friday at the time mentioned earlier in the thread. In general we should make this a standing meeting at a time Andy Kanter can join, ie Wednesday or Friday.

(Jonathan Payne) #502

Hi @collins, I’m not able to reproduce the issue you’re experiencing. I am able to see the response header just fine – see below. Is it something about the client that you’re using?

Server →nginx/1.10.3 (Ubuntu)

Date →Wed, 09 Jan 2019 17:32:54 GMT

Content-Type →application/json; charset=utf-8

Transfer-Encoding →chunked

Connection →keep-alive

Vary →Accept, Cookie

next →

ETag →"91bb43a2ec95fa69ea91c59d611e96ba"

num_found →1217


offset →4

num_returned →4

previous →

Access-Control-Allow-Methods →GET, OPTIONS, POST, PUT, DELETE

Access-Control-Allow-Headers →authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range

Access-Control-Expose-Headers →Content-Length,Content-Range

(Andrew Kanter) #503

I do want us to find a time when Darius and I can be available. Were we going to use a doodle to find a recurring time?


(collins Ijeomah) #504

@paynejd Yes I can get that on postman but I cant get it on the browser. The reason being that browsers can only access the following response headers by default:

  • Cache-Control
  • Content-Language
  • Content-Type
  • Expires
  • Last-Modified
  • Pragma

If you would like your client app to be able to access other headers, you need to set the Access-Control-Expose-Headers header on the server:

We can have a Zoom sync anytime you are available so that I can demonstrate it.

(Jonathan Payne) #505

@collins - thanks for clarifying! I have forwarded this to our dev (Rafal) to get a bit more insight. Let me get back to you tomorrow after I hear from him.

(Cintia Del Rio) #506

If you say exactly which headers you want, how it should look, I can change it @shine . Just remember I don’t really have any application context, so I need the exact string you want me to configure nginx.

(Cintia Del Rio) #507

Unfortunately I couldn’t yet make the repository public, but I keep posting the CORS nginx config here. If there’s some wiki page you use, please copy it here, because it’s a recurring question.

location / {
    if ($request_method = 'OPTIONS') {
      add_header 'Access-Control-Allow-Origin' '*';
      add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS, POST, PUT, DELETE';
      # Custom headers and headers various browsers *should* be OK with but aren't
      add_header 'Access-Control-Allow-Headers' 'authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
      # Tell client that this pre-flight info is valid for 20 days
      add_header 'Access-Control-Max-Age' 1728000;
      add_header 'Content-Type' 'text/plain; charset=utf-8';
      add_header 'Content-Length' 0;
      return 204;
    if ($request_method = 'POST') {
      add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS, POST, PUT, DELETE';
      add_header 'Access-Control-Allow-Headers' 'authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
      add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
    if ($request_method = 'PUT') {
      add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS, POST, PUT, DELETE';
      add_header 'Access-Control-Allow-Headers' 'authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
      add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
    if ($request_method = 'GET') {
      add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS, POST, PUT, DELETE';
      add_header 'Access-Control-Allow-Headers' 'authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
      add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
    if ($request_method = 'DELETE') {
      add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS, POST, PUT, DELETE';
      add_header 'Access-Control-Allow-Headers' 'authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
      add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';

(John Joshua Abulo) #508

Hello @darius

I am writing to bring to your notice that I set a calendar event for the team sync tomorrow (10/01/2018) between 6:00 pm to 7:00 pm (East African Time). I also created this Doodle to enable us to choose a perfect time for future team syncs. Kindly let me know if you will be available for the event.

cc: @akanter, @dkayiwa, @sheriff, @samdiano, @shine, @stonecoder, @tittoh, @collinewait.

(Darius Jazayeri) #509

Yes I can do this time at least this week. For the recurring slot, please confirm this still works for @akanter, and/or share a doodle poll.