How can I add validation for my extensions to a resource in Spark? Typical use case: I have a look up table of values against which the extension value need to be checked against.
I assume validating each extension in a Other resource is suffice or is there hooks in spark to validate 'Other' resource?
There are multiple types of validation, some of which are currently present in the .NET library. Most of these are around validating the instances against the generic "core" definitions in the specifications of the resources, so these will not be able to validate your specific "look up tables". You can read more about these validations right here: http://ewoutkramer.github.io/fhir-net-api/validation.html
What you want to do is introduce your own "look up tables", which we call "ValueSets" in FHIR. What you'd need to do is create your own valueset, and combine this with a "profile". David Hay has written about this here: http://fhirblog.com/2014/03/11/profiles-and-valuesets-in-fhir/
Now, once you have done this, you need the .NET library to validate your instance against the profile. This is work in progress but we expect to add this functionality to the next version of the .NET NuGet package, which will arrive somewhere late august or early september.
Related
I have built a custom model for identifying customer specific entities in Watson Knowledge Studio. Can i leverage and reuse standard entities (e.g. Email) which are part of the standard model in the custom model without having to redefine them from scratch?
I had the same question and found the info below - more details are at: https://watson-tricks.blogspot.com/
Post titled - "Combining the annotation capabilities of both Watson Knowledge Studio and Watson Discovery Service"
"It is not feasible for users to build a complete WKS model that incorporates all of the normal language dictionaries as well as the specialized domain terminology. However, there is a trick which can be used to get WDS to use both the domain specific annotator from WKS and the generic language annotator from WDS.
Unfurtunately this trick is not possible with the normal WDS UI, but it requires the use of the REST API"
I couldn't find enrichment for NLU. However i simply called the Analyze request two times, once with a custom model for Entities and second time without it. Got two JSON's and will combine the two to get a final list of entities. Not cost effective though as the number of requests will increase
Is there an approach that preserves the single-definition of validation, allows immediate client-side validation, and still provides the strength of server-side validation?
I'm familiar with the following two approaches:
ngval (https://github.com/alisabzevari/ngval)
http://www.danielroot.info/2013/09/hooking-angularjs-validation-to-aspnet.html
The first renders ng-validation syntax in Razor output, based on rules stated in the model. That seems like it couples me too tightly to building Razor views, when Razor views often won't intuitively pair with a well-organized Angular app. I could use this approach, but it seems it's more a result of someone wanting to replicate "Unobtrusive jQuery/MVC Validation", than building something well-suited to Angular.
The second approach just returns server-side validation back to Angular to render. It also doesn't do a thorough job of it. If needed I could run without client-side validation, since a single-page app still won't get screen flashes... but it's not ideal.
For example, maybe there is a toolset to more directly reflect the validation rules directly on WebAPIs and consume them in an Angular app. Or another approach that I haven't found?
At https://www.youtube.com/watch?v=lHbWRFpbma4#t=1336 , the presenter seems to imply this problem is already well-solved for Angular, and refers to specification (DDD Using Specification pattern for Validation). If you are aware of any tools that make this applicable to my problem, I'd love to hear it.
p.s. It seems like this is almost certainly an often-asked question. I'm sorry I was unable to find an answer here before posting
p.p.s. I'm currently planning to use Entity Framework, but I'd switch to address this. Heck, I'd consider switching to a whole different platform for this, my first Angular-focused project.
The approach I recommend is based on #Esteban Felix commented and I used similar strategy in Java/Bean Validation and JSON schema generator.
Annotate your Domain model using Validate Model Data Using DataAnnotations
Generate schema using JSON.net other useful links
Create a AutoValidate directive that goes on and decorate fields with AngularJS build in directives for form validation e.g. ngPattern and simple things like min/max. In my case I created a mapping from Java world to AngularJS directives and wherever I needed we created custom directives.
It seems this can be hacked into Django, but I'd rather prefer a framework that has better support for end user defined models.
Basically, I want the users of my app/website to be able to do at the runtime of the application what I do at compile time when writing the Model code: specify models that generate/modify a database schema. Obviously I cannot let the users of the webApp modify the code in models.py, so there has to be another way. Concurrency shouldn't be an issue, since each user-defined model would belong to only one user.
I don't mind using any programming language (Python, Haskell, JavaScript etc.) or any specific database SQL, NoSQL, whatever. Rails/Django freed me from writing a lot of repetitive code, now I simply want that functionality of modifying the model also at runtime (and preferably the corresponding views and controllers). If there is a good framework that rids me of writing all that code then I'll use it.
If there's no framework supporting it natively, does someone know a framework that at least makes it easy?
Portofino version 3 (http://www.manydesigns.com/en/portofino/portofino3) allows a modeler user to create data models interactively using a web interface called the "upstairs level". The system automatically generates a user interface (CRUD, charts, workflows) based on the model definition, without recompiling and basically in real-time with model changes.
You can check the reference manual to see what kind of models are supported:
http://www.manydesigns.com/en/portofino/portofino3/3_1_x/reference-manual
Currently Portofino 3 is an end-of-life version. The newer version 4 (http://www.manydesigns.com/en/portofino) is a significant re-write that currently does not support online editing of the data model as version 3 did, but keeps the same principle of making the application editable (through admin/configuration pages) and customizable (using Groovy) online without recompiling or restarting the server.
For data-model changes and db refactoring, Portofino 4 relies on Liquibase:
http://www.liquibase.org/
What is the preferred method (one that has minimal custom code and ideally is portable to planned future versions of MVC without extra widgets) to validate common datatypes (e.g. e-mail addresses, dates, phone numbers) at both the client and server?
MY RESEARCH
I'm going to list a few methods I've seen, approximately from worst to best (IMHO). I'm currently using the last method listed. I'll focus on e-mail validation in this post, to keep things clear.
REGEX AND/OR CUSTOM VALIDATION ATTRIBUTE
I know jQuery validate includes some common datatypes including e-mail, and additional plugins exist for download (e.g. integer, max words). So custom regex's here are not the right answer.
I know how to write a custom validator from scratch at server and client, and even to 'adapt' an existing client-side rule to a custom attribute when using the unobtrusive connector. http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html
but it probably doesn't make sense for such a common type as e-mail address.
Nor, probably, to extend a regex rule, as per:
http://www.pagedesigners.co.nz/2011/02/asp-net-mvc-3-email-validation-with-unobtrusive-jquery-validation/
OVERRIDING STOCK DataType ATTRIBUTE VALIDATORS
.NET includes [System.ComponentModel.DataAnnotations.DataType(DataType.EmailAddress)]
This causes always-succeed validation at client or server, and is really only useful out-of-the-box for a tangential purpose of formatting display strings. Overriding the always-succeed validation is possible, as per:
http://weblogs.asp.net/srkirkland/archive/2011/02/15/adding-client-validation-to-dataannotations-datatype-attribute.aspx
MVC DATA VALIDATION EXTENSION (VIA NUGET)
A NuGet-downloadable validation extension was released several months ago, and I'm currently using it, but I was surprised to see that it did not leverage the existing DataAnnotations.DataType enum. It makes me wonder if there is some development divergence that I should be avoiding here.
http://weblogs.asp.net/srkirkland/archive/2011/02/23/introducing-data-annotations-extensions.aspx
Also, it doesn't include phone numbers or US phone numbers.
Any better method?
Have you know about ASP.NET MVC 3 Futures Validation attributes,
http://weblogs.asp.net/imranbaloch/archive/2011/02/05/new-validation-attributes-in-asp-net-mvc-3-future.aspx
I am looking for examples of configuration based validation using Validation Application Block. I've found this
I want to ask if someone has an alternative solution to using EL VAB 5.0 to achieve configuration based validation. I've started with DataAnnotations but soon found out that some properties will need different types of validation depending on who is using the application.
Also if anyone has more examples for configuration with VAB and any advice as to what I might run into, please share.
There are several paths you can walk to achieve this. First of all you can (ab)use rulesets for this. You can create a 'base' ruleset with rules that hold for everybody and you can make a ruleset per role in the system and perhaps even a ruleset per user, but of course that would be cumbersome.
Another option would be to create an IConfigurationSource implementation that is able to return a ValidationSettings instance, based on the logged in user. Now there are several ways that you can build a ValidationSettings object. Here are a few examples:
You can load multiple configuration files from disk using the FileConfigurationSource based on the role. Something like: return (new FileConfigurationSource('validation_' + role + '.config')).GetSection(sectionName);
You can build up the ValidationSettings instances dynamically (and cache them). You can store this definition in the database and load them (this would be a lot of work) or define them in code (perhaps separated by assembly). Here is an example of a code based configuration.
Also to prevent having to duplicate parts of your configuration, you can do the following:
Merge multiple configurations together. You can for instance merge the base line validation with the role specific validation. This saves you from having to manually validate according to the base line and do a second validation for the role specific validation. While this is not supported out of the box, I wrote about how to do this on my blog here.
You can merge rules based on type inheritance. While VAB only supports validator inheritance for attribute based validation out of the box, I've wrote about this on my blog, here.
I hope this helps.