Gsoc 2020: Expose System Metrics For Monitoring.

Hi @ibacher @mseaton

Error log for youre reference

In your hibernate mapping file, can you replace org.openmrs.util.HibernateEnumType with ’ ‘org.hibernate.type.EnumType’?

1 Like

Yes I fixed it will send a PR.

thanks alot @dkayiwa :smiley:

So, I think we’d want to be able to capture things like:

  • # of users logged into the system for a period and also aggregates like min, max, and mean simultaneous users (this is likely to be somewhat different from # of sessions)

The following types we would want to be able to disaggregate these by user, user role, encounter role and location:

  • # of patients registered for a period with aggregates for min, max, and mean
  • # of patients voided for a period again with aggregates for min, max, and mean
  • # of encounters by encounter type for a period with aggregates for min, max and mean
  • # of forms used by form type for a period with aggregates for min, max and mean
  • # of obs created by obs concept

I realize this might be a large target, so I would suggest that if a framework can be built around # of patients registered and # of encounters by encounter type, that’d be sufficient for GSoC (at least at an initial stab).

@mseaton @hamish Anything high priority I might’ve missed here?

Hi @dkayiwa @mseaton @ibacher

Have a small issue with the test cases.

I changed the type to org.hibernate.type.EnumType

And .hbm.xml file looks like below now.

<property name="status" column="status" length="50" not-null="true"> <type name="org.hibernate.type.EnumType"> <param name="enumClass">org.openmrs.module.emrmonitor.EmrMonitorReport$SubmissionStatus</param> <param name="useNamed">true</param> </type> </property>

For the test cases It inserts below raw in to the in memory db

<emrmonitor_server id="1" uuid="e6e492e5-4321-11e6-be45-e82aea237783" name="Rwinkwavu" server_type="1"/>

But during the insertion time it gives below error

org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value <LOCAL_ONLY> of type <java.lang.String> to INTEGER

I can see in the mysql db it’s been created correctly as a varchar data type but when it’s inserting in to local db for testing I am not sure why it’s giving this error.

Hi @ayesh,

Good job finding out the surrounds for the project. I wonder what benefit we have using an event queue instead of just querying out from the DataBase.

In fact I have developed such a reporting module back in 2017 as a GSoC project. These metrics are quite similar to what has already implemented on this module.

How would it be different from this module what we already have?

@judeniroshan As I read the purpose of this GSoC, it’s less about generating the information than it is about getting the information into a standarised format that can be consumed by existing monitoring tools. This is especially relevant for monitoring these kinds of data across multiple implementations of OpenMRS or multiple deployments that might be running in different locations across a country.

Incidentally, the event-based approach @ayesh has been talking through will yield somewhat different counts than retrospective SQL reporting might. Retrospective reporting is probably enough for generating reports that are fed upstream to ministries of health (hospital x had 300 new patients this month), but are a less adequate when looking at system usage, which can be asking different questions (hospital x added 300 patients this month, but in the process they created 375 patients and voided 75 of those). In the latter case, this brings out that there is some underlying issue that may be causing the workflow at the hospital to be less efficient than it might otherwise be. Is this because of staff training? Poorly designed forms? Is this within the expected range of human error?

Hope that clarifies at least the value I see in this proposal.

@ibacher @mseaton @dkayiwa

Any idea about the error.

Is your code on github?


I also see it’s using old openmrs version and old version of modules


Are you still getting this error? Because for me, using the latest commit in your repo, everything builds correctly.

It was probably built to support older versions of OpenMRS and older modules. In and of itself, this isn’t a problem.

@ibacher yeah the test cases fails.

org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value <LOCAL_ONLY> of type <java.lang.String> to INTEGER

It works for me. Can you run a mvn clean package in your source tree?

Hm same error :no_mouth:

@ayesh you must be having uncommitted changes.

Hm @dkayiwa nope :roll_eyes: :cold_sweat:

Since this is based on platform 1.9.x, in your hibernate mapping files, replace org.hibernate.type.EnumType with org.openmrs.util.HibernateEnumType and enumClass with enumClassName

Hm root cause started with

org.openmrs.util.HibernateEnumType and enumClassName

Whole build fails

so changed it to

org.hibernate.type.EnumType and enumClass

Then only the test fails.

Does that mean it does not work?