Health-Informatics-UoN / Carrot-Mapper

Carrot: Convenient And Reusable Rapid Omop Transformer.
https://carrot4omop.ac.uk
MIT License
12 stars 3 forks source link

"Refresh Rules" does not create rules from existing concepts #641

Closed AndyRae closed 3 months ago

AndyRae commented 4 months ago

Is there an existing issue for this?

Current Behavior

I have existing Concepts in my Scan Report Table:

Screenshot 2024-02-23 at 15 23 24

And my ID / Date fields are allocated:

Screenshot 2024-02-23 at 15 24 19

But clicking Refresh Rules does not create any rules:

Screenshot 2024-02-23 at 15 23 35

Expected Behavior

I would expect rules to be created based on these existing Concepts.

Steps To Reproduce

  1. A new Carrot mapper install
  2. Upload a sample scan report
  3. Allocate the ID / Date fields, and allocate the Concepts
  4. Click the Refresh Rules

Environment

- OS: Macos Sonoma
- Other environment details: Developer environment

I'm part of a Project Team

Yes - DRS

Anything else?

This is very much related to #637

But it's important enough to create a new issue I think, as Mapping Rules is pretty much the heart of Carrot, and definitely does prevent this product being deployed elsewhere.

The code that creates the Mapping Rules first has to get the existing Scan Reports concepts _(aside note that the second parameter table_id should be called scan_report_id as that's what is used to filter)_.

This is also filtering using the GenericRelation between ScanReportConcept and ScanReportValue/ScanReportField, so it's using the content_type as mentioned in #637. .filter(concepts__isnull=False) This time - as the content_type that is being allocated to ScanReportConcept when they are created (15 or 17) is wrong, the filtering will correctly return an empty object. So no rules are created.

Again the fix is to enforce correct use of the Django content_type system.

This is basically a block to use/develop Carrot locally - we can do everything up to Rule generation but after that we're blind to as what might be working.

Are you willing to contribute to resolve this issue?

✅ Yes, me or my team intend to do the development.