The parameter _sort in hapi fhir 4.2 shows a strange behaviour. While a query without any conditions like /Procedure returns all existing procedures, a sorted query like /Procedure?_sort=date returns only procedures having a date != null.
From a developers perspective one might say: Ok, I don't have a value to sort by, so I can't make an assertation, but practically this makes the _sort parameter completely useless for fields that can be null.
Why is a value of Null not treated as the least possible value for the field, like in sql or other ?
I got through the Hapi fhir changelog, but havn't found this issue mentioned ( for me, it is an issue )
I know that sort parameters are based on search parameters. Does anyone know whether there is a chance to change this behaviour by any option in the searchparameter ?
I guess No :-(
Cheers
Christian
Related
I'm trying to figure out how the patient searching on EPIC FHIR is working.
Testing all on the sandbox here: https://fhir.epic.com/Documentation?docId=testpatients.
The docs:
Starting in May 2019, Patient.Search requests require one of the following minimum data sets by > default in order to match and return a patient record:
FHIR ID
{IDType}|{ID}
SSN identifier
Given name, family name, and birthdate
Given name, family name, legal sex, and phone number/email
This is working correctly (returning one patient):
/api/FHIR/R4/Patient?family=Lin&given=Derrick&birthdate=1973-06-03
But this is also returning same record (extra character in family, wrong gender)
:
/api/FHIR/R4/Patient?family=Lina&given=Derrick&birthdate=1973-06-03&gender=female
Also this one is returning one record (extra character in family, no given name):
/api/FHIR/R4/Patient?family=Lina&birthdate=1973-06-03
Not sure what I am doing wrong, or is it expected behaviour?
There is a bunch of history here, but Epic's current Patient.search behaves more like Patient.$match. Specifically, the criteria provided to Patient.search are combined using (approximately) OR logic rather than AND logic. Behind the scenes, it is actually more of weighted score, but ultimately, the more criteria you provide, the more possible results you might get. This is often counterintuitive if you are used to how REST API query params normally work. Technically it is spec legal though, since FHIR has a blurb in there about servers being able to return other appropriate results as it sees fit.
https://build.fhir.org/search.html#Introduction
However, the server has the prerogative to return additional search results if it believes them to be relevant.
We don't have any specific updates right now, but there may be changes coming in Soon(tm).
I'm surprised the last one is returning any results, but regarding the first two searches, this is quite possible or even expected with Epic. Epic has special logic in the background that evaluates the parameter values you pass in against certain criteria, such as whether the name matches exactly, the name is similar, the birthdate matches exactly, etc. As a result, oftentimes not only exact matches but also similar matches will be returned by the Patient.Search API. The weighting of the criteria is customizable by Epic customer, so some may have stricter logic than others.
I'd recommend always validating the returned result against your input parameters to verify you are working with an exact match.
I have the first parameter (client drop down) that passes an ID to the second parameter to be used in the 3rd and 4th parameter. During testing all the parameters are set to visible to verify what's being passed. As soon as I hide that second parameter the rest don't refresh. Again, visible, correct info flowing through, hidden, DOA. I have this set up exactly like this on at least a dozen other reports with no issue. I'm not real sure where this going wrong since I can see the correct value being passed while visible?
I was able to duplicate your issue. While I can't find a reference to support my supposition, I believe that hidden parameters (even those with a default value) are not evaluated until rendering, which would explain this behavior. Data sets that drive parameter values are run prior to the report being rendered.
As you're talking about having trouble with dependencies between the parameter values, I assume you're using queries to drive your available values for parameters three and four. If this is the case, then simply embed the logic that relates the value(s) of parameter 1 to the value(s) of parameter 3 into the query that drives parameter 3's available values. By cutting out Parameter 2 and incorporating it into the query logic for parameter 3, you will work around this issue.
If you're having trouble accomplishing this, reply in a comment and I'll see if I can help. As it stands, I don't know enough about what you're trying to do to help any more.
I've been experimenting with VersionOne's data api and have come up with a query that matches the Estimate, Detail Estimate, Done (Actuals), To Do and Allocated To Do values for stories or defects that we see via the UI. As you can see below (nl's added for legibility), I've placed filters on the aggregated values. What I am wondering is whether the where clause is needed since the aggregate filters seems to cover them. It seems to work OK with or without the where clause as it returns the same values (but it definitely doesn't work if I remove the aggregate filters). Would anyone comment on whether I'll run into some unforeseen issue if I remove the where clause?
Data/Story/oid-number-portion?
sel=PrimaryWorkitem.Name,
PrimaryWorkitem.Number,
PrimaryWorkitem.AssetState,
PrimaryWorkitem.Status.Name,
PrimaryWorkitem.Number,
PrimaryWorkitem.Scope.Name,
PrimaryWorkitem.Timebox.Name,
PrimaryWorkitem.Team.Name,
PrimaryWorkitem.Priority.Name,
PrimaryWorkitem.Owners.Name,
PrimaryWorkitem.AssetType,
PrimaryWorkitem.Parent.Name,
PrimaryWorkitem.Super.Name,
PrimaryWorkitem.Children,
PrimaryWorkitem.SplitTo,
PrimaryWorkitem.SplitFrom,
PrimaryWorkitem.Estimate,
PrimaryWorkitem.ChildrenMeAndDown,
PrimaryWorkitem.ChildrenMeAndDown[AssetState!='Dead','Deleted'].ToDo.#Sum,
PrimaryWorkitem.Children[AssetState!='Dead','Deleted'].ToDo.#Sum,
PrimaryWorkitem.ChildrenMeAndDown[AssetState!='Dead','Deleted'].Actuals.Value.#Sum,
PrimaryWorkitem.Children[AssetState!='Dead','Deleted'].DetailEstimate.#Sum,
PrimaryWorkitem.ChildrenMeAndDown%[AssetState!='Dead','Deleted'].AllocatedToDo.#Sum,
PrimaryWorkitem.CreateDateUTC,
PrimaryWorkitem.CreatedBy.Name,
PrimaryWorkitem.ChangeDateUTC,
PrimaryWorkitem.ChangedBy.Name
&where=(PrimaryWorkitem.AssetState!='Dead','Deleted';
PrimaryWorkitem.ChildrenMeAndDown!='Dead','Deleted';
PrimaryWorkitem.Children!='Dead','Deleted')
Jerry
The short answer is yes, the where is unnecessary. It would only reduce the set of Stories returned and does not affect the results of relationships, like the attribute filters do. Since the start of your query includes and OID, you are just getting a single item in your result set anyway.
I see some other opportunities to improve your query. For one, the AssetState of Dead includes Deleted and Template. So you could just have [AssetState!='Dead'].
You might also tune your use of hierarchy navigation. For example, you are requesting both the Children and the ChildrenMeAndDown as attributes. For Story, the Children are SecondaryWorkitems which themselves have no Children. Therefore, Story.Children and Story.ChildrenAndDown return the same results. The only thing different about Story.ChildrenMeAndDown is that it includes the Story that you are already querying. So, I suspect the Children relationship is sufficient for all of your uses.
If you are only reading from VersionOne, have a look at the query.v1 endpoint. The query language is fundamentally the same, just expressed in YAML or JSON in the body of an HTTP POST. Just extrapolating from your query, you might find the subquery capability of query.v1 to be handy.
UPDATE: It was suggested in the comments that I create a wiki for this. I have done, you can find it here (should you wish to keep tabs on it and/or contribute).
http://vrs.tomelders.com
I've never worked on anything like this before, so I'm completely winging it.
I've never worked on anything like this before, so please
I'm want to work on an open "standard" or "language", or... well, I don't really know what to call it.... to make form validation easier. I'm calling it VRS (Validation Rule Sheets) but at this stage, everything is negotiable.
The idea is to create a sheet of rules, similar to CSS that define how forms should be validated. This will require
A Syntax / Specification
A VRS Parser to convert the VRS into something useable
A VRS Processor to compare the form data against the rules and return a response.
A response format.
The benefits of a system like this would be
A platform/language agnostic way to define form validations.
A cross platform, highly portable way to define form validations.
Easy to read, easy to setup, easy to modify.
Client side and backend integration.
First things first though. What should the syntax / specification look like.
The way I see this working online is that a VRS file could be specified as a hidden field and the application routes the supplied form data through the VRS processor before processing it.
By way of an example, you could validate the content type of the "name" field would look like this
name {
content-type: alpha;
}
content-type could be one of three values: alpha, numeric or alpha-numeric.
Hopefully that makes sense. I've never done anything like this before so I'm eager to get other peoples input. Here's as far as I've gotten
------------------------------------------------------------
content-type: (string) alphanumeric | alpha | numeric
Restricts content to either numeric, text or alphanumeric.
------------------------------------------------------------
is-fatal: BOOL
If the rule fails, is it fatal? This could be really useful
for AJAX responses.
------------------------------------------------------------
allow-null: BOOL
wether a field can be empty or not. Good for required fields
and checkboxes
------------------------------------------------------------
pattern-match: (string) email | url | regex
match the field against a pattern.
------------------------------------------------------------
field-match: (string) field_name
compares a field to another field. eg: password confirmation
------------------------------------------------------------
greater-than: INT | FLOAT
less-than: INT | FLOAT
within-range: INT | FLOAT, INT | FLOAT
Pretty self explanatory. With regard to strings however,
the string length is compared against the params.
------------------------------------------------------------
is-unique: (func) connection(host,user,pass), (func) map(table, field)
Check the value against a field in the database to see if
it's unique.
------------------------------------------------------------
date & time validations
This i'm a bit worried about in terms of terminology. I also
want to include dynamic vars in VRS such as
#now
#today
#thisMonth
#thisYear
------------------------------------------------------------
before: STRING | VAR
after: STRING | VAR
Again, self explanatory. Although I'm unsure what the date/time
format should be. UTC?
------------------------------------------------------------
Elapsed Time:
I'm completely stuck on how to handle conditions like
"years elapsed since date is more than 16"
I don't relish the idea of rules as prolix as
years-elapsed-since-now-are-more-than:18;
years-elapsed-since-now-are-less-than:18;
Finally, I'm debating wether devs should be able to specify the errors/warnings in the VRS or should they do that when handling the response?
So, that's a lot to take in and I hope it's clear. My question(s) I guess are
Good idea / bad idea?
Is this the right kind of syntax?
Are there more elegant ways of naming the rules.
What's missing.
thanks
UPDATE: A few people have stated that this proposed system is a bad idea. If you think so, please provide a scenario in which it wouldn't work. Thinking it's a bad idea is one thing, proving it's a bad idea is another, and I'd like to see proof that it's a bad idea sooner rather than later. If you really think form validation could not be made easier or less tedious, please explain why.
In addition, I'm aware that form validation is not a new issue. However, there is currently no portable, cross platform, cross language solution to address form validation, which is what this proposal is specifically addressing.
I like the idea of putting the error messages in the VRS too. But they should specific to the rule that failed.
Also, you might consider not developing an entirely new "language" but use something like YAML for which parses already exist.
I see this language as being useful as you could use the same VRS for both client- and server-side validation.
PS: This should be community wiki methinks.
I suppose it is a good idea, if you can maintain it yourself.
Remember, your making the syntax. It's up to you (so long as it looks decent).
no, not really. So long as the names are obvious (look like what they are), and aren't too long or confusing, then the're fine.
Perhaps you should note default values for the rules when they aren't specified.
Good idea / bad idea?
Generally, this kind of thing is a bad idea. That's what PHP is for.
What's wrong with http://www.phpformclass.com/
http://www.x-code.com/vdaemon_web_form_validation.php
or other PHP form management tools?
Is this the right kind of syntax?
No. What's wrong with PHP? It has good syntax for this kind of thing.
Are there more elegant ways of naming the rules.
Yes. PHP object classes. Numerous Other projects. You're not the first person to validate form input.
What's missing.
Answering the fundamental question: What's wrong with PHP?
A list of related projects that already do this and specific reasons why your project is better than all the other ones already out there.
I made a report with about 30 different rectangles and textboxes that have different visibility expressions depending on the parameters. (It's a student invoice and many different messages have to appear depending on the semester) When I made all the expressions I coded in the parameters in all upper case. Now I have a problem when users enter lowercase letters, the SQL all works fine since it is not case sensitive, but the different rectangles and textboxes don't show. Is there a way in the report code to first capitalize all the parameters before running the SQL? Or do I actually have to go back to every visibility expression and add separate iif's for upper and lower case? (That seems incredibly silly to have to do). I can't change my parameters to numbers because I have been given strict requirements for input. Thanks.
I do not know if this is the most elegant solution, but you could accomplish this by following this procedure for every parameter on the Report Parameters page:
1)Re-name the parameter, leaving its prompt as that of the old parameter.
2)Add a new parameter with the same name as the old parameter.
3)Mark this new parameter as Hidden.
4)Make sure that the new parameter's available values are marked as non-queried(available values will never be actually used.)
5)Mark the Default Values as Non-queried, using the following syntax:
=ucase(Parameters!OldParameterName.Value)
Can't you just UCASE the params (do it in the xml view, it will be quicker and you might even be able to do a regex find/replace)