Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k4pran
Copy link
Contributor

@k4pran k4pran commented Mar 29, 2024

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 and
    added 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

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 97.82609% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 77.95%. Comparing base (c7f2ec2) to head (9f434e3).

Files Patch % Lines
.../translators/impl/EpisodeOfCareTranslatorImpl.java 96.30% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@k4pran k4pran marked this pull request as ready for review April 1, 2024 15:05
Copy link
Member

@ibacher ibacher left a 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;
Copy link
Member

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.

Copy link
Contributor Author

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

Comment on lines 39 to 41
protected FhirDao<PatientProgram> getDao() {
return dao;
}
Copy link
Member

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.

Copy link
Contributor Author

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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment on lines 66 to 68
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;
}
Copy link
Member

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants