Improve metadata documentation
laggery opened this issue · 1 comments
Improve documentation
I started to use the Asymmetrik/node-fhir-server-core.
I needed a while to implement metadata for a resource and I made it as follow:
index.js
let config = {
profiles: {
observation: {
service: `${__dirname}/services/observation.service.js`,
versions: [
VERSIONS['4_0_0']
],
metadata: `${__dirname}/metadata/observation.metadata.js`
}
}
};
observation.metadata.js
module.exports = {
makeResource: (args, logger)=> {
const subject = {
name: 'subject',
type: 'reference',
fhirtype: 'reference',
xpath: 'Observation.subject',
definition: 'http://hl7.org/fhir/SearchParameter/Observation-subject',
description: 'The subject that the observation is about',
};
const partof = {
name: 'part-of',
type: 'reference',
fhirtype: 'reference',
xpath: 'Observation.partOf',
definition: 'http://hl7.org/fhir/SearchParameter/Observation-part-of',
description: 'Part of referenced event',
};
return {searchParam: [subject, partof]};
}
};
If it is the right way to implement it, I can write the “Metadata” page in the wiki.
Thanks for your reply.
Yannick Lagger
Hi @laggery ,
Sorry for the delay! This is the correct way to implement custom metadata. I did some digging in the old pull request where the ability to do this was added and it looks like it never made it into the documentation.
If you would be willing to write the Metadata page for the Wiki it would be greatly appreciated! You will not be able to directly edit the wiki yourself, but if you create a markdown file in the node-fhir-server-core/docs/ directory (https://github.com/Asymmetrik/node-fhir-server-core/tree/master/docs), we can review it and get it added to the Wiki.
The only edit we would have to your solution is in the profile definition of the version. In older versions of our server we used constants to define version numbers, but have since removed that, as it seemed unnecessary. As such, for the latest version of our server, you would define your profile as:
let config = {
profiles: {
observation: {
service: `${__dirname}/services/observation.service.js`,
versions: ['4_0_0'],
metadata: `${__dirname}/metadata/observation.metadata.js`
}
}
};
where the 'versions' value is just a list of version strings.
Thank you for your help! It's much appreciated!
-Sumeet