chop-dbhi / cilantro

Official client for Harvest (http://harvest.research.chop.edu)
http://cilantro.harvest.io
Other
28 stars 8 forks source link

Handle boolean values correctly in results #714

Closed ryanjohara closed 10 years ago

ryanjohara commented 10 years ago

Fixes #705

Signed-off-by: Ryan O'Hara oharar@email.chop.edu

ryanjohara commented 10 years ago

While working on a fix, I updated the open-mrs AgeFormatter in openmrs/formatters.pyto look something like this:

class AgeFormatter(HTMLFormatter):
    def to_html(self, values, **context):
        est = values['birthdate_estimated']
        return est

The est variable in this example is of type boolean. The serrano enpoint http://localhost:8000/api/data/preview/?_=1412705211778&limit=20&page=1 was returning a response that looked something like this:

"objects": [
        {
            "pk": 1, 
            "values": [
                "<a href=\"/patient/MRN/\">MRN</a>", 
                false, 
                "<span class=\"muted\">Unknown</span>"
            ]
        }, 
        {
            "pk": 2, 
            "values": [
                "<a href=\"/patient/MRN/\">MRN</a>", 
                true, 
                "Male"
            ]
        }, 

However, in cilantro/ui/tables/cell.js the value for the false boolean in render was an empty object.

bruth commented 10 years ago

See this comment. I don't think this is something the client should try to disambiguate. As far as the value being an object.. that may be an unrelated issue.

bruth commented 10 years ago

This line may be the cause of the issue. Move that line below line 138 and see if you get objects.

ryanjohara commented 10 years ago

Yes that fixed it, I'll repush and create another PR.

ryanjohara commented 10 years ago

I must not have tested this correctly. The problem still remains, unfortunately. Any other ideas, @bruth?

ryanjohara commented 10 years ago

The breakdown appears to happen between Series and DatumArray in structs.js.