-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FM2-640: added FHIR Flag resource #80
Conversation
Narrative narrative = new Narrative(); | ||
narrative.setStatus(Narrative.NarrativeStatus.GENERATED); | ||
|
||
XhtmlNode xhtmlNode = new XhtmlNode(); | ||
xhtmlNode.setName(patientFlag.getMessage()); | ||
narrative.setDiv(xhtmlNode); | ||
flag.setText(narrative); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do this in a translator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibacher where should I add this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be best if you could plug into the narrative generation system here, otherwise, just leave it alone for now (I don't, off-hand, remember how that system works).
Identifier identifier = new Identifier(); | ||
identifier.setValue(String.valueOf(patientFlag.getPatientFlagId())); | ||
flag.setIdentifier(Collections.singletonList(identifier)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifier
is always the UUID. Never use the database identifier for anything except internal operations.
flag.addCategory(codeableConcept); | ||
}); | ||
|
||
flag.setCode(priorityTranslator.toFhirResource(patientFlag.getFlag().getPriority())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code should be the actual message to display to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module name has a typo here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, instead of just copying this, you should be able to rely on the FhirConstants
file from the FHIR2 module, i.e., the fhir
submodule should have the fhir2 OMOD as part of its dependencies.
public IBundleProvider searchFlags(ReferenceAndListParam patient) { | ||
SearchParameterMap theParams = new SearchParameterMap(); | ||
if(patient != null ){ | ||
theParams.addParameter("aa",patient); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The parameter should probably be
FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER
, which will (hopefully) make things easier. - There no issue adding the value
null
to theSearchParameterMap
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibacher I made some changes on the search operation, could you please review ?
Currently, flags can be searched by patient ID, name, and identifiers and also I am working on implementing the ability to search flags using code (flag message), date, and category.
FLAG-67: fixed flag rendering on platform lower versions FLAG-67: change code styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ManojLL! Mostly looks good. A few comments though.
pom.xml
Outdated
<module>omod</module> | ||
<module>fhir</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMOD is the final artifact, so it always goes last.
<module>omod</module> | |
<module>fhir</module> | |
<module>fhir</module> | |
<module>omod</module> |
pom.xml
Outdated
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<uiframeworkVersion>3.11.0</uiframeworkVersion> | ||
<metadatadeployVersion>1.8.1</metadatadeployVersion> | ||
<metadatasharingVersion>1.2.2</metadatasharingVersion> | ||
<webservices.rest-omod.version>2.40.0</webservices.rest-omod.version> | ||
<legacyuiVersion>1.16.0</legacyuiVersion> | ||
<fhirversion>2.2.0</fhirversion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably depend on an older version of the FHIR2 module. Maybe 1.9.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fhirVersion
like the others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibacher if use fhir version 1.9.0 , I get this error: https://pastebin.com/kz3RRTbX. with version 2.0.0 working correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fair enough.
omod/pom.xml
Outdated
<dependency> | ||
<groupId>org.openmrs.module</groupId> | ||
<artifactId>patientflags-fhir</artifactId> | ||
<version>3.0.8-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<version>3.0.8-SNAPSHOT</version> | |
<version>${project.parent.version}</version> |
<patientflags_patient_flag patient_flag_id="1" patient_id="1" flag_id="1" message="Test" creator="1" date_created="2007-05-01 00:00:00.0" voided="false" uuid="7d89924e-e8df-4553-a956-95de80529735"/> | ||
<patientflags_patient_flag patient_flag_id="2" patient_id="2" flag_id="1" message="Test" creator="1" date_created="2007-05-01 00:00:00.0" voided="true" uuid="7d89924e-e8df-4543-a956-95de80529735"/> | ||
|
||
</dataset> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</dataset> | |
</dataset> | |
if (system == null) { | ||
coding.setDisplay(flag.getName()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be localizable in some fashion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically something like FhirUtils#getMetadataTranslation()
, but I'm not entirely sure how the flag name gets populated, etc.
public IBundleProvider searchFlags(@OptionalParam(name = Flag.SP_PATIENT, chainWhitelist = { "", Patient.SP_IDENTIFIER, | ||
Patient.SP_GIVEN, Patient.SP_FAMILY, Patient.SP_NAME }, targetTypes = Patient.class) ReferenceAndListParam patientReference, | ||
@OptionalParam(name = Flag.SP_RES_ID) TokenAndListParam id, | ||
@OptionalParam(name = "code") StringAndListParam codeParam, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code should always be TokenAndListParam
Patient.SP_GIVEN, Patient.SP_FAMILY, Patient.SP_NAME }, targetTypes = Patient.class) ReferenceAndListParam patientReference, | ||
@OptionalParam(name = Flag.SP_RES_ID) TokenAndListParam id, | ||
@OptionalParam(name = "code") StringAndListParam codeParam, | ||
@OptionalParam(name = "category") StringAndListParam category, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also shouldn't category
at least have an SP
constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we don't have constant for category and code like flag.SP_CODE
and flag.SP_CATEGORY
public IBundleProvider searchFlags(FlagSearchParams patient) { | ||
return searchQuery.getQueryResults(patient.toSearchParameterMap(), dao, translator, searchQueryInclude); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
fhir/pom.xml
Outdated
<properties> | ||
<MODULE_ID>${project.parent.artifactId}</MODULE_ID> | ||
<MODULE_NAME>${project.parent.name}</MODULE_NAME> | ||
<MODULE_VERSION>${project.parent.version}</MODULE_VERSION> | ||
<MODULE_PACKAGE>${project.parent.groupId}.${project.parent.artifactId}</MODULE_PACKAGE> | ||
</properties> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not needed, I will remove this.
@ibacher I made the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small things, but basically looks fine.
@Override | ||
protected void validateObject(PatientFlag object) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this override strictly necessary? We shouldn't be invoking any of the endpoints that use it (create, update, patch).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this. I just added here as it is used in other services
omod/src/main/resources/config.xml
Outdated
<modules> | ||
<module> | ||
<moduleId>fhir2</moduleId> | ||
<version>1.9.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could use ${fhirversion}
here instead and have that correctly filled in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed hard coded fhir version to ${fhirversion}
@ibacher Do I need to update the OpenMRS FHIR Implementation Guide, or is it sufficient to update the flag module documentation to include information about the FHIR flag mapping? |
I think just documenting it here is sufficient. We need to give some thought about how we handle these things with IGs. |
Description of what I changed
added fhir resource provider, flag dao, translator and service for FHIR flag mapping
Issue I worked on
see https://openmrs.atlassian.net/browse/FM2-640
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amend
I have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amend
I ran
mvn clean package
right before creating this pull request andadded all formatting changes to my commit.
No? -> execute above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master