Assert a resource conforms to FHIR Profile - hl7-fhir

Want to be able to programmatically declare that a FHIR resource conforms to one or more profiles. Especially want to declare conformance to profiles that don't have any extensions, but only restrictions to the resource such as changing the cardinality of an optional property from 0..1 to 1..1 to make it required or restricting a value set/code system.
Want to be able to associate such an assertion to a Resource when it is created (POST operation) as well as after the fact to an existing resource (PUT operation).
This wiki page: http://wiki.hl7.org/index.php?title=Profile_Validation_Tooling suggests using the Category HTTP header but a particular URL is not specified in the example. “Resources are able to declare that they conform to a profile by being "tagged" with the URI that identifies the profile."
Notional profile URL: http://www.hl7.org/fhir/profiles/patient-restriction-profile.xml
For example let's use a simple Patient Resource:
http://www.hl7.org/fhir/Patient/101
<?xml version="1.0" encoding="UTF-8"?>
<Patient xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
Mr. John Smith
</div>
</text>
<identifier>
<use value="usual"/>
<label value="MRN"/>
<system value="urn:oid:1.2.36.146.595.217.0.1"/>
<value value="12345"/>
</identifier>
<name>
<family value="Smith"/>
<given value="John"/>
</name>
<active value="true"/>
</Patient>
UPDATE:
Apparently to add a profile to an existing resource you use tag operations with a taglist as body of the POST with special _tags url suffix.
POST http://www.hl7.org/fhir/Patient/101/_tags
Content-Type: application/xml+fhir
<taglist xmlns="http://hl7.org/fhir">
<category term="http://www.hl7.org/fhir/profiles/patient-restriction-profile.xml"
label="Test profile" scheme="http://hl7.org/fhir/tag/profile"/>
</taglist>

To mark the resource, you'd use
Category: [new profile url];scheme="http://hl7.org/fhir/tag/profile";label="name for profile"
Guidance is here: http://hl7.org/fhir/extras.html#tag
and here: http://hl7.org/fhir/http.html#tags

When you send a resource to a server (either using POST/PUT to update it or to the validation endpoint), you as the sender include a Category header with contains the claims you make as a sender about to which profiles the sent data (in this case an Observation) complies. So this category header would contain the url of the profile the Observation conforms to (because you say it's organization's A's BloodPressure)
Category: http://www.organA.com/profiles/our-fhir-profile#bloodpressure; scheme="http://hl7.org/fhir/tag/profile"
Now, of course, organB would send its profiles like so:
Category: http://www.organB.com/profiles/measurements#bloodpressure; scheme="http://hl7.org/fhir/tag/profile"
It could well be that some instances of observations (because A and B have agreed on some overlap) conform to both:
Category: http://www.organB.com/profiles/measurements#bloodpressure; scheme="http://hl7.org/fhir/tag/profile", http://www.organB.com/profiles/measurements#bloodpressure; scheme="http://hl7.org/fhir/tag/profile"
In addition, the server itself may periodically run all instances against all profiles it knows about and add additional claims.

Related

Mapping existing resource to hl7-fhir response

Trying to understand the concept of the code datatype in hl7-fhir. Looking at the appointment (https://www.hl7.org/fhir/appointment.html) resource as an example it has a status parameter with suggested values of "proposed | pending | booked" etc.
Given an existing database with it's own custom status' (Attended, Confirmed, Attended but late) what is the correct way to handle a hl7-fhir response to a consumer?
If the "code" data type is used, then the FHIR binding strength is always "required" - which means you are required to use the FHIR-defined list of codes and no others.
It appears that two of your statuses - "Attended" and "Attended but late" aren't actually statuses of the appointment - the booking, but are instead commentary about the resulting encounter. So I would capture those as extensions. "confirmed" sounds similar to "booked", though I'd need to know the definition to know for sure. Do you have any appointment statuses for appointments that are not yet confirmed (let alone attended)?
To extend on Lloyds notes, you will want to put the extension under the status property, and map your existing values to the provided FHIR values, and put your local actual value in the extension underneath.
This way when other systems read the resource and don't know about your extension status values, they will still be able to act sensibly based on the core values.
<status value="fulfilled">
<extension url="http://yourorg.com/fhir/.../ExtendedAppointmentStatuses">
<valueCoding>
<code value="abl" />
<display value="Attended but late" />
</valueCoding>
</extension>
</status>

Redeem rate for Freestanding Coupons in Oracle ATG commerce

Any clue on how can I keep a track regarding how many Freestanding Coupons were used in Oracle ATG? I know that for bulk vouchers we have the Redemption Rate, but for the simple vouchers there's no such thing.
For example I created 500 vouchers with the code XXXXX and I want to see how many were used during the checkout.
Cheers
One way to do this would be to use the dyn/admin to query the number of uses for the given voucher code:
Open the ClaimableRepository in dyn/admin http://your-host-name:your-port/dyn/admin/nucleus/atg/commerce/claimable/ClaimableRepository/
In the text area below Run XML Operation Tags on the Repository enter the following:
<print-item item-descriptor="PromotionClaimable" id="my-promotion-id" /> and hit the 'enter' button. This will print something like this:
------ Printing item with id: my-promotion-id
<add-item item-descriptor="DeployablePromotionClaimable" id="my-promotion-id">
<set-property name="expirationDate"><![CDATA[11/26/2015 23:59:00]]></set-property>
<set-property name="displayName"><![CDATA[10% discount on my items]></set-property>
<!-- rdonly derived <set-property name="derivedDisplayName"><![CDATA[10% discount on my items]]></set-property> -->
<set-property name="uses"><![CDATA[4]]></set-property>
<!-- export is false <set-property name="version"><![CDATA[13]]></set-property> -->
<set-property name="lastModified"><![CDATA[10/28/2015 16:18:09]]></set-property>
<set-property name="status"><![CDATA[claimed]]></set-property>
<set-property name="startDate"><![CDATA[8/13/2015 00:00:00]]></set-property>
<!-- rdonly derived <set-property name="hasPromotions"><![CDATA[true]]></set-property> -->
<set-property name="promotions"><![CDATA[promo100001]]></set-property>
<set-property name="type"><![CDATA[DeployablePromotionClaimable]]></set-property>
</add-item>
The line <set-property name="uses"><![CDATA[4]]></set-property> tells you how many times that voucher/coupon has been used, which in this case is 4.
UPDATE:
The above method does not work as it returns the total number of coupons available when the promotion is setup. This means the quickest way to get this information would be to query the completed orders which use the coupon.

Using Schema.org Review with copyrightHolder?

I'm trying to implement correct properties of Schema.org, in video game reviews. It's not hard to understand the basics http://schema.org/Review, but some properties are a bit confuse (to me).
For example, a review about "Gran Turismo", of "Sony PlayStation", released in "1996", is correct to use properties of "Creative Work", this way:
<meta itemprop="copyrightHolder" content="Sony" />
<meta itemprop="copyrightYear" content="1996" />
Or do this is it related to the review itself, so I should use the review's author name and publication date? If yes, what's the right properties to those info (if needed)?
When reviewing a video game, there are two CreativeWorks (resp. more specific types) involved:
the video game
the review
The properties copyrightYear and copyrightHolder refer to the nearest parent CreativeWork. You have to make sure not to mix them: it’s all about the correct nesting.
<div itemscope itemtype="http://schema.org/CreativeWork">
<!-- this is *your* CreativeWork, i.e., the review -->
<div itemprop="itemReviewed" itemscope itemtype="http://schema.org/CreativeWork">
<!-- this is *not your* CreativeWork, i.e., the video game -->
</div>
<!-- this is, again, *your* CreativeWork -->
</div>
(Note that I’ve used the general CreativeWork type in this example; you should of course use more specific types if available, e.g., http://schema.org/Review for the review).
Daniel, you should use the review schema as your primary schema, then nest the others such as creative work within it. The review schema should include the item, the author's name, date of the review, and of course the actual review body and rating markups. But it really is not necessary to use the copyright item properties. You can simply leave those tags out if you wish.

how to get the attribute value by another attribute's value in xpath

<?xml version="1.0" encoding="UTF-8"?>
<serviceOfferings xmlns="http://www.abc.com/aaa" xmlns:ns2="http://www.w3.org/2005/Atom">
<serviceOffering type="provider">
<links>
<link title="Service Provider" type="application/xml" rel="self" href="https://www.yahoo.com"/>
<link rel="create" href="https://www.google.com/create"/>
</links>
</serviceOffering>
</serviceOfferings>
How do I get the href value for the link which attribute rel is create
The target element is in a default namespace. First, you'll need to register that namespace with your XPath engine. How you do this depends on the tool you're using, which means it's outside the scope of this question (since you haven't told us how you're evaluting your expressions).
Let's assume you've registered the namespace to a prefix called aaa. Select the desired link like this:
//aaa:link[#rel='create']
Or, more specifically:
/*/*/*/aaa:link[#rel='create']
For completeness, in most cases this can also be achieved without registering a namespace, at the cost of reduced readability:
/*/*/*/*[name()='link' and #rel='create']
This selects all elements whose name is "link" (regardless of the namespace they belong to) and that have a rel attribute whose string value is "create", and that are grand-grand-children of the top element of the XML document.

Google checkout merchant shipping calculation doesn't make sense

Google checkout is having an issue with dynamic merchant shipping callback calculation.
When customer click on the checkout with google button, I pass in the shipping method called "default shipping" and shipping cost is $100.
This default value will only show to customer when he selected shipping address and google callback to merchant site to fetch shipping method fail.
When customer login to google account and entered the shipping address (country/city/state/postcode...) , google will do an instant callback to merchant script to fetch the latest shipping method available.
I able to have google callback to me successfully, but my shipping method to google is not accepted.
Example,
When customer selected to ship to US NC, then:
I will return FedEx Economy as shipping method (my system will retrive available shipping method based on address given)
I don't need to show default shipping at all
but google say error below:
Merchant Calculations: We were looking for data in your merchant-calculation-results, but were not able to find it: result: address-id:209802946439880shipping-name: default shipping when fail
XML received from google instant callback:
<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-callback xmlns="http://checkout.google.com/schema/2" serial-number="abd99db3-d3e3-485b-ba9c-75863d02ed65">
<shopping-cart>
<merchant-private-data>
<session-id>f199c97f7fa9b19ade6fa57a17ce79d61508aef4</session-id>
</merchant-private-data>
<items>
<item>
<item-weight value="0.0" unit="LB" />
<tax-table-selector>food</tax-table-selector>
<item-name>Test prod 3</item-name>
<item-description></item-description>
<unit-price currency="USD">1.0</unit-price>
<quantity>1</quantity>
<merchant-item-id>test11</merchant-item-id>
</item>
</items>
<cart-expiration>
<good-until-date>2011-05-20T23:59:59.000Z</good-until-date>
</cart-expiration>
</shopping-cart>
<buyer-id>119687448728341</buyer-id>
<calculate>
<addresses>
<anonymous-address id="209802946439880">
<country-code>US</country-code>
<city>Charlotte</city>
<region>NC</region>
<postal-code>28227</postal-code>
</anonymous-address>
</addresses>
<shipping>
<method name="default shipping" />
</shipping>
<tax>false</tax>
<merchant-code-strings />
</calculate>
<buyer-language>English</buyer-language>
</merchant-calculation-callback>
XML to post to google after merchant script custom shipping calculation done:
<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>
<result shipping-name="Fedex Economy" address-id="209802946439880">
<shipping-rate currency="USD">15.20</shipping-rate>
<shippable>true</shippable>
</result>
</results>
</merchant-calculation-results>
So I suspect google must require me to return back the same default shipping name when I post back to google.
I tried it, if return the same default shipping name by modify the shipping amount, it works!
But when I return same default shipping name, at the same time an additional shipping method as FedEx Economy to google, google will reply error saying invalid extra data:
Merchant Calculations: You sent us invalid extra data in your merchant-calculation-results: [address-id: 209802946439880/shipping-name: Fedex Economy ]
<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>
<result shipping-name="default shipping" address-id="209802946439880">
<shipping-rate currency="USD">8</shipping-rate>
<shippable>true</shippable>
</result>
<result shipping-name="Fedex Economy" address-id="209802946439880">
<shipping-rate currency="USD">15.20</shipping-rate>
<shippable>true</shippable>
</result>
</results>
</merchant-calculation-results>
How come! Isn't it not practical to have this kind of rules...
When google pass back shipping city/state/postcode/country to me, my system will calculate and return available shipping method(s) only
It means before google let me know the address, I don't even know there is how many shipping method available for the particular customer.
That is how merchant calculated shipping works:
REF: Merchant Calculations API -> Shipping
You must specify a unique name and a
default shipping cost for each
shipping option.
An alternative is for you to collect the zip code prior to sending your customer to Google Checkout. Your system can then pre-determine shipping availability and costs prior to redirecting your customer to Google and pass the shipping options/costs as "flat rate shipping" - this is just a Google Checkout specific term that means "here are the shipping costs for this order" (that you have already pre-calculated some way).
More reference:
Ok to ask for zip code
More forum discussions
Hope this helps...

Resources