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

RDRP-1066_pnp_exports #390

Merged
merged 11 commits into from
Dec 18, 2024
Merged

RDRP-1066_pnp_exports #390

merged 11 commits into from
Dec 18, 2024

Conversation

Ryan2Y79
Copy link
Collaborator

@Ryan2Y79 Ryan2Y79 commented Dec 13, 2024

Pull Request submission

This branch tests if the current src.outputs.output_files.py script works with PNP out. Initial testing shows PNP exports seem to work with the current setup. One only need ensure the RELEVENT schema.toml within scr.config exists. I tested both stagged_full_responses and full_responses_mapped. With full_responses_mapped I had to run create_schema.py to create its schema.toml. Secondary testing included testing the export of gb_sas, which worked!

There is no modification of the pipeline required. This review is to ensure my conclusion is correct, and to review minor changes to src.outputs.export_files.py.

How to run the export script: python src//outputs//export_files.py

The exported files will appear here: R:\BERD Results System Development 2023\DAP_emulation\outgoing_export

A note of import, there are config settings within this branch that exists purely for testing purposes. The config setting will not be merged into develop. So myself or the reviewer can clean the config after the review is done.

Closes or fixes

  • Detail the ticket(s) you are closing with this PR
    Closes #

Code

  • Code runs The code runs on my machine and/or CDSW
  • Conflicts resolved There are no conflicts (I have performed a rebase if necessary)
  • Requirements My/our code functions according to the requirements of the ticket
  • Dependencies I have updated the environment yaml so it includes any new libraries I have used
  • Configuration file updated any high level parameters that the user may interact with have been put into the config file (and imported to the script)
  • Clean Code
    • Code is as PEP 8 compliant as I can humanly make it
    • Code passess flake8 linting check
    • Code adheres to DRY
  • Type hints All new functions have type hints

Documentation

Any new code includes all the following forms of documentation:

  • Function Documentation Docstrings within the function(s')/methods have been created
    • Includes Args and returns for all major functions
    • The docstring details data types
  • Updated Documentation: User and/or developer working doc has been updated

Data

  • All data needed to run this script is available in Dev/Test
  • All data is excluded from this pull request
  • Secrets checker pre-commit passes

Testing

  • Unit tests Unit tests have been created and are passing or a new ticket to create tests has been created

Peer Review Section

  • All requirements install from (updated) requirements.txt
  • Documentation has been created and is clear - check the working document
  • Doctrings (Google format) have been created and accurately describe the function's functionality
  • Unit tests pass, or if not present a new ticket to create tests has been created
  • Code runs The code runs on reviewer's machine and/or CDSW

Final approval (post-review)

The author has responded to my review and made changes to my satisfaction.

  • I recommend merging this request.

Review comments

Insert detailed comments here!

These might include, but not exclusively:

  • bugs that need fixing (does it work as expected? and does it work with other code
    that it is likely to interact with?)
  • alternative methods (could it be written more efficiently or with more clarity?)
  • documentation improvements (does the documentation reflect how the code actually works?)
  • additional tests that should be implemented (do the tests effectively assure that it
    works correctly?)
  • code style improvements (could the code be written more clearly?)
  • Do the changes represent a change in functionality so the version number should increase? Start a discussion if so.
  • As a review you can generates the same outputs from running the code

Your suggestions should be tailored to the code that you are reviewing.
Be critical and clear, but not mean. Ask questions and set actions.

Copy link

github-actions bot commented Dec 13, 2024

Percentage Coverage for this PR

Detailed Coverage Report
FileStmtsMissCoverMissing
src
   __init__.py00100% 
src/construction
   __init__.py00100% 
   all_data_construction.py48480%1–2, 4–5, 7, 9, 17, 23, 46–47, 50, 55–56, 60–62, 66–67, 70, 77–79, 84, 87–91, 93, 98–99, 104–105, 108–110, 114, 118–121, 126–127, 129, 134–135, 139, 141
   construction_helpers.py1041486%31–42, 237, 304
   construction_main.py27270%2–3, 5, 7, 11–12, 15, 18, 54–57, 64, 68–71, 74, 78–81, 84, 89–91, 93
   construction_read_validate.py34340%2–3, 5, 8, 11, 16, 18, 21, 46–49, 51–52, 55–56, 59, 66–68, 72–73, 79, 82, 101–103, 105–106, 109, 116–117, 122, 129
   construction_validation.py102991%83, 86, 113, 121–122, 127, 138, 168, 218
   postcode_construction.py21210%1–2, 4–6, 9, 26, 29, 32, 37, 40–41, 44, 47–49, 51, 55, 59, 62–63
src/estimation
   __init__.py00100% 
   apply_weights.py18288%44–45
   calculate_weights.py520100% 
   estimation_main.py22220%2–4, 6–8, 10, 13, 29, 35, 38, 41–42, 44–51, 53
src/freezing
   __init__.py00100% 
   freezing_apply_changes.py732171%34–37, 40–41, 44–46, 49–52, 56, 64–67, 71–72, 74
   freezing_compare.py682267%111–112, 160–161, 185, 188, 191–193, 197–199, 201–203, 205–206, 238, 261, 264, 267, 270
   freezing_main.py46460%1–3, 5, 7–12, 15, 18, 42–43, 46–47, 49–53, 55, 63, 66–68, 71–72, 76–78, 83–84, 86–87, 90–91, 95, 98, 109–112, 114–116
   freezing_utils.py110100% 
src/imputation
   MoR.py145795%51–52, 92–93, 110, 329, 479
   __init__.py00100% 
   apportionment.py361072%124, 126, 141, 143, 145, 157–159, 162, 164
   expansion_imputation.py373018%23–24, 26–27, 30, 33–35, 39, 42, 44, 47–48, 50, 53, 56, 76–78, 82, 85, 88, 91, 97, 102, 105, 107, 113, 116, 120
   imputation_helpers.py1395659%68, 70, 79, 86, 99–102, 105–106, 108–109, 111–112, 114–115, 117–118, 120–121, 123–124, 126, 135, 137–138, 140–141, 310, 312–313, 317–318, 320, 324, 345, 348, 352, 355–356, 358, 444, 446–447, 450, 462–463, 465–466, 468, 470, 486–487, 490–491, 493
   imputation_main.py71710%2–5, 7–17, 20, 23, 54, 57, 60, 63–64, 67–68, 71, 73, 78, 81–82, 85, 88–89, 92, 94, 97, 100, 104–106, 110–111, 114, 117–119, 121, 125, 128–129, 131–135, 138–140, 142–146, 149, 152, 155–160, 162
   impute_civ_def.py994752%165, 168, 198, 200–201, 204–205, 208–210, 215–216, 218, 221, 223–226, 228, 230, 235–236, 238, 241, 243–245, 248, 250–251, 253–254, 256–257, 270, 273–277, 279–280, 283–284, 286–287, 289
   manual_imputation.py19190%1–2, 4, 6, 9–10, 28–29, 33, 35, 37, 44, 59, 61–62, 64–65, 67–68
   sf_expansion.py746117%24, 27, 30–31, 34–35, 38, 41, 44–45, 48, 50, 57–58, 61, 66–67, 70, 72, 75–76, 78, 80, 83, 87, 89, 100, 103, 107, 109–110, 112, 114, 117, 120, 129, 132, 135, 144, 147, 149, 155, 161, 173, 176, 181–182, 184, 192–193, 196, 200, 204, 207, 215, 220–221, 224, 226, 230, 232
   short_to_long.py21210%1, 3–4, 7, 20, 23, 25, 32–33, 35, 37–38, 40–41, 43–45, 47, 49, 53, 55
   tmi_imputation.py18112729%28–29, 57, 59, 65–67, 71, 77, 80, 82, 87, 92, 97, 218, 221, 223, 226, 230, 234, 256–257, 260, 263–264, 267, 270–271, 274, 276–277, 279, 281, 284–285, 287, 289, 292, 295–296, 298, 301–303, 305–308, 310, 326, 328, 335, 337–338, 340–341, 343, 345, 347, 349, 352, 355–356, 359, 361, 363, 381–382, 384, 386–387, 389–391, 393–394, 397, 399–400, 403, 405–406, 424, 426, 429–431, 433, 435–436, 438–439, 442, 444–445, 448, 450, 452–453, 473, 477, 480–481, 484–485, 488, 491, 493, 498, 500, 505, 507, 514–515, 520, 527–528, 530, 533–534, 536, 539, 541, 543, 548, 550–551
src/mapping
   __init__.py00100% 
   cellno_mapping.py17476%49–51, 53
   itl_mapping.py100100% 
   mapping_helpers.py55590%24–27, 69
   mapping_main.py49490%3–5, 7–15, 17, 20, 45, 50, 59, 68, 75, 78, 85, 88–90, 97, 99, 102–104, 107, 109–111, 114, 117, 122–123, 126, 128–132, 134–136, 139, 142, 145
   pg_conversion.py40880%52, 55, 58, 122, 125, 128, 162–163
   pnp_mapping.py24240%1–2, 5, 8, 17–19, 21, 24, 27, 38–40, 42, 46, 49, 57, 73, 75, 78, 89–91, 93
   ultfoc_mapping.py34488%49–51, 95
src/northern_ireland
   __init__.py00100% 
   ni_headcount_fte.py29290%2–4, 6, 8, 11, 25, 27, 29, 31, 33, 35, 37, 40, 55, 57–59, 61, 63–64, 66–67, 69, 72, 81, 83–84, 86
   ni_main.py21210%3–9, 11, 14, 34, 37–39, 45, 52–54, 62, 64–65, 67
   ni_staging.py33330%3–6, 8–9, 11, 14, 22, 25, 27–29, 31, 34, 40, 44, 46, 49, 78–79, 82, 87, 91, 94, 97–102, 104, 106
src/outlier_detection
   __init__.py00100% 
   auto_outliers.py810100% 
   manual_outliers.py160100% 
   outlier_main.py39390%2–4, 6–8, 10, 13, 42, 44–46, 48–49, 52, 55, 58–63, 65, 70–71, 74, 79–82, 85–89, 91, 94, 96, 98
src/outputs
   __init__.py00100% 
   export_files.py92920%5–11, 13–14, 18, 24, 42, 44, 51–54, 61, 68, 73, 76, 103, 109, 112, 119, 121, 124, 130, 132–133, 136–140, 143–144, 147, 158–160, 162, 165, 178, 180–181, 183, 186, 206, 209, 212–213, 220, 224, 227–229, 232, 234, 236, 238–239, 241, 244–248, 250–251, 253, 256–258, 261, 264, 267, 282, 285–286, 294, 297, 299, 301, 311, 313–315, 324, 326, 329–330
   form_output_prep.py181327%25–27, 29–30, 34, 36–37, 39, 41, 43, 47, 49
   frozen_group.py43430%3–4, 6, 8–11, 13, 16, 45, 47–50, 53, 71, 123, 134, 161, 164–168, 170, 172, 175, 178–179, 181, 184, 187, 192–193, 196–197, 200, 203–205, 208–209, 211
   gb_sas.py23230%2–4, 6–9, 11, 14, 30, 33, 38, 41, 44, 47, 52, 55, 58–60, 63–64, 66
   intram_by_civil_defence.py210100% 
   intram_by_itl.py541572%44, 46–48, 52, 142, 145, 148–150, 153–154, 158–159, 168
   intram_by_pg.py350100% 
   intram_by_sic.py33330%2–5, 7, 10, 30–31, 34–35, 38–39, 41, 44–46, 51, 67–71, 73, 76, 79, 82, 85, 88–89, 92–93, 96, 98
   intram_totals.py14140%3–4, 6–7, 9, 12, 29–30, 33, 36, 39–40, 42–43
   long_form.py17170%2–4, 6–9, 11, 14, 29, 32, 35, 38–40, 42–43
   manifest_output.py82820%1–5, 9, 12–13, 16, 34, 50–53, 56–57, 61–62, 67–68, 76, 79–83, 86–92, 94, 112–113, 118, 120–121, 126, 129, 131, 133, 135, 139, 149, 154–155, 161, 164–165, 167–168, 174–177, 183–185, 187, 194, 196, 201, 203–205, 207–208, 210–211, 213–216, 218, 221, 223, 229–230, 233–234
   map_output_cols.py38781%150–151, 153, 155, 158, 161, 163
   ni_sas.py19190%2–8, 10, 13, 26, 29, 32, 35, 40, 43–45, 48–49
   outputs_helpers.py170100% 
   outputs_main.py83830%3–4, 7, 10–22, 24, 27, 49, 54–56, 61, 64, 67–69, 74, 77–78, 81–83, 89, 92–94, 97, 100–102, 104–105, 110, 113–115, 124, 127–129, 133–134, 143, 146–148, 155, 158–160, 164–165, 173, 176–178, 185, 188–190, 195, 198–200, 207, 210–212, 214–216, 218
   short_form.py341361%78, 85, 87, 104, 107, 110, 113, 116, 119–121, 123–124
   tau.py25250%2–8, 10, 13, 30, 34, 37, 40, 43, 46, 51, 54, 56–57, 60–62, 65–66, 68
   total_fte.py12120%2–5, 8, 11, 24, 26–27, 33, 38–39
src/site_apportionment
   __init__.py00100% 
   output_status_filtered.py261542%25, 27, 31–32, 34–35, 37, 44–45, 72, 75, 77, 79–80, 82
   pnp_pre_processing.py10100%1–3, 6–7, 9, 16, 18, 20, 22
   site_apportionment.py126397%467, 469–470
   site_apportionment_main.py26260%2–4, 6–8, 12, 14, 17, 39–40, 43, 45, 48–49, 57–58, 60–61, 64, 69–72, 74–75
src/staging
   __init__.py00100% 
   postcode_validation.py56394%131–132, 220
   spp_parser.py140100% 
   spp_snapshot_processing.py340100% 
   staging_helpers.py861582%173, 176, 178, 181–182, 185–186, 188–189, 192, 196–197, 199, 203, 209
   staging_main.py98980%3–5, 7, 9–11, 15, 18, 64–66, 69, 71, 75–77, 79–80, 84, 86–87, 90, 93, 96–97, 99–100, 105–107, 111–114, 116–117, 123, 128–130, 132–133, 136, 148–150, 155, 158, 162, 164, 166–168, 171, 175, 177, 179–183, 186, 189, 191–192, 195, 197, 200–204, 207, 211–212, 215–219, 221, 224, 232, 241–242, 244–249, 251, 253–254, 256, 259, 270
   validation.py1434965%34–36, 39, 42, 88–89, 100, 122, 135–136, 141, 145, 153–154, 160–161, 200–201, 207, 209, 212, 214, 221–222, 301, 303–304, 307–308, 311–312, 315, 318–319, 322, 324, 326–327, 341, 343–349, 352, 355
src/utils
   __init__.py00100% 
   breakdown_validation.py1304565%29, 186–188, 190–194, 196, 198, 201–202, 208–209, 212, 215, 217, 220, 222, 234–237, 240–243, 259–260, 265, 308–309, 311, 317–318, 360–363, 365–368, 371
   config.py149298%151–152
   defence.py200100% 
   helpers.py731875%19–20, 24–25, 27, 134–137, 139–140, 143–145, 154, 156–157, 215
   local_file_mods.py1204760%47–53, 98, 148–150, 199–203, 214–215, 226, 237, 248–249, 251, 262–263, 274–275, 284, 292, 303, 305–306, 308–309, 313–315, 319, 333–334, 336–337, 340–341, 343, 360, 365
   path_helpers.py142894%96, 311, 313, 315–316, 318–319, 321
   postcode_reduction_helper.py38380%11, 13–14, 16, 19, 22, 25, 27–28, 30–31, 34–35, 38, 40–41, 43–44, 47, 60, 62, 65, 68, 71–72, 74–75, 77, 80, 95, 97, 100–101, 104–105, 107, 109–110
   s3_mods.py1271270%21–22, 26–27, 31, 41, 45–47, 51, 65, 67–68, 71–74, 76–77, 80, 91, 94, 99, 102, 105, 108, 119–120, 122, 125, 139, 143–144, 146, 149, 159, 166, 169, 171, 174, 176, 179, 190–191, 193, 196, 204–205, 208, 217–218, 222–225, 228, 239–240, 243–244, 247, 252, 255, 266–267, 269–272, 274–275, 278, 284, 287, 300, 303, 306, 308, 311, 317, 320, 323, 326, 329, 337–339, 341, 344, 348–349, 351, 354, 383, 387, 389, 396, 399, 404–406, 413, 416, 431, 433–434, 436–437, 441, 443, 445, 448, 450–452, 454, 457, 467, 470–471, 474, 477, 479–480, 483–485
   singleton_boto.py20200%4–5, 8–10, 12–13, 15–19, 23–25, 27–31
TOTAL3994194651% 

Summary of tests

Tests Skipped Failures Errors Time
261 2 💤 0 ❌ 0 🔥 3.489s ⏱️

@AnneONS AnneONS merged commit 4d7c585 into develop Dec 18, 2024
1 check passed
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.

2 participants