-
Notifications
You must be signed in to change notification settings - Fork 112
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-608: Add EpisodeOfCare FHIR2 Module with Mapping of Patient Program #536
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #536 +/- ##
============================================
+ Coverage 77.84% 77.95% +0.11%
- Complexity 2683 2708 +25
============================================
Files 239 244 +5
Lines 7452 7498 +46
Branches 901 904 +3
============================================
+ Hits 5801 5845 +44
- Misses 1115 1116 +1
- Partials 536 537 +1 ☔ View full report in Codecov by Sentry. |
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.
Nice work! A few notes on things, but this looks like a great starting point!
@@ -63,6 +64,9 @@ public class FhirRestServlet extends RestfulServer implements ModuleLifecycleLis | |||
private static final List<String> DEFAULT_NARRATIVE_FILES = Arrays.asList(FhirConstants.OPENMRS_NARRATIVES_PROPERTY_FILE, | |||
FhirConstants.HAPI_NARRATIVES_PROPERTY_FILE); | |||
|
|||
@Autowired | |||
private EpisodeOfCareFhirResourceProvider dao; |
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.
You shouldn't need to autowire this here. (Also the name of the variable is slightly confusing.
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.
Removed, this was an artifact left over when I was debugging something
protected FhirDao<PatientProgram> getDao() { | ||
return dao; | ||
} |
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.
Technically, this should be provided by the @Getter
annotation above.
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.
Good catch, removed
} | ||
|
||
@Override | ||
protected OpenmrsFhirTranslator<PatientProgram, EpisodeOfCare> getTranslator() { |
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.
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.
Removed
public PatientProgram toOpenmrsType(@Nonnull PatientProgram patientProgram, @Nonnull EpisodeOfCare episodeOfCare) { | ||
log.warn("Translation from FHIR resource EpisodeOfCare to OpenMRS object PatientProgram is not supported."); | ||
return null; | ||
} |
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 it's better to throw an UnsupportedOperationException
here rather than logging a warning that could easily be missed.
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.
Done and updated corresponding test
Description of what I changed
Added support for fhir EpisodeOfCare with a mapping from the openmrs PatientProgram. This is a one-way mapping from the openmrs PatientProgram to EpisodeOfCare and doesn't include support for deleting / creating / updating.
Issue I worked on
see https://issues.openmrs.org/browse/FM2-608
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