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-276: Add create, update and delete methods for RelatedPerson #317

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

theanandankit
Copy link
Contributor

@theanandankit theanandankit commented Dec 30, 2020

Description of what I changed

Issue I worked on

see https://issues.openmrs.org/browse/FM2-276

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

@codecov
Copy link

codecov bot commented Dec 30, 2020

Codecov Report

Merging #317 (fa388ec) into master (f02280e) will increase coverage by 0.10%.
The diff coverage is 93.02%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #317      +/-   ##
============================================
+ Coverage     80.76%   80.86%   +0.10%     
- Complexity     2258     2275      +17     
============================================
  Files           206      206              
  Lines          6046     6088      +42     
  Branches        710      719       +9     
============================================
+ Hits           4883     4923      +40     
+ Misses          744      743       -1     
- Partials        419      422       +3     
Impacted Files Coverage Δ
...roviders/r4/RelatedPersonFhirResourceProvider.java 94.74% <88.89%> (-5.26%) ⬇️
...roviders/r3/RelatedPersonFhirResourceProvider.java 95.24% <90.91%> (-4.76%) ⬇️
.../translators/impl/RelatedPersonTranslatorImpl.java 92.59% <95.65%> (+5.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f02280e...fa388ec. Read the comment docs.

@theanandankit
Copy link
Contributor Author

@ibacher @varung-31 I've made the changes and added the methods for RelatedPerson. PTAL

@ibacher
Copy link
Member

ibacher commented Jan 5, 2021

@theanandankit I don't want to discourage you and thanks for your work on this, but the real challenge here is figuring out how to map a FHIR relationship back into OpenMRS in a sensible way. If you look at the translator, trying to create or update a relationship will just result in an exception. The reason is that OpenMRS Relationship objects use a free-text field to identify the type of relationship and there isn't really a great way to capture that in FHIR other than adding it as an extension. If you're happy to go ahead and do that part of the work, this could be quite useful.

@theanandankit
Copy link
Contributor Author

@ibacher thank you for the review, I've added the translator for RelatedPerson to OpenMRS. am I still missing something or it's okay? PTAL

@theanandankit theanandankit marked this pull request as ready for review January 27, 2021 21:21
@theanandankit
Copy link
Contributor Author

@ibacher I've added tests. PTAL

@theanandankit
Copy link
Contributor Author

@ibacher can we merge this PR?

@@ -110,6 +113,42 @@ public RelatedPerson toFhirResource(@Nonnull Relationship relationship) {

@Override
public Relationship toOpenmrsType(@Nonnull RelatedPerson resource) {
throw new UnsupportedOperationException();
Relationship relationship = new Relationship();
Copy link
Member

Choose a reason for hiding this comment

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

We can't always generate a new relationship... there needs to be some allowance for updating an existing relationship, right? So I think we need to change RelatedPersonTranslator to extend UpdatableOpenmrsTranslator. Likewise personA should be retrieved from the database, if at all possible... Honestly, I think that's the really hard part about this....

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

Successfully merging this pull request may close these issues.

3 participants